Admin_ObjectController::addFolderAction PHP Метод

addFolderAction() публичный Метод

public addFolderAction ( )
    public function addFolderAction()
    {
        $success = false;
        $parent = Object::getById($this->getParam("parentId"));
        if ($parent->isAllowed("create")) {
            if (!Object\Service::pathExists($parent->getRealFullPath() . "/" . $this->getParam("key"))) {
                $folder = Object\Folder::create(["o_parentId" => $this->getParam("parentId"), "o_creationDate" => time(), "o_userOwner" => $this->user->getId(), "o_userModification" => $this->user->getId(), "o_key" => $this->getParam("key"), "o_published" => true]);
                $folder->setCreationDate(time());
                $folder->setUserOwner($this->getUser()->getId());
                $folder->setUserModification($this->getUser()->getId());
                try {
                    $folder->save();
                    $success = true;
                } catch (\Exception $e) {
                    $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                }
            }
        } else {
            Logger::debug("prevented creating object id because of missing permissions");
        }
        $this->_helper->json(["success" => $success]);
    }