Admin_ObjectController::getFolderAction PHP Метод

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

public getFolderAction ( )
    public function getFolderAction()
    {
        // check for lock
        if (Element\Editlock::isLocked($this->getParam("id"), "object")) {
            $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "object")]);
        }
        Element\Editlock::lock($this->getParam("id"), "object");
        $object = Object::getById(intval($this->getParam("id")));
        if ($object->isAllowed("view")) {
            $objectData = [];
            $objectData["general"] = [];
            $objectData["idPath"] = Element\Service::getIdPath($object);
            $allowedKeys = ["o_published", "o_key", "o_id", "o_type", "o_path", "o_modificationDate", "o_creationDate", "o_userOwner", "o_userModification"];
            foreach (get_object_vars($object) as $key => $value) {
                if (strstr($key, "o_") && in_array($key, $allowedKeys)) {
                    $objectData["general"][$key] = $value;
                }
            }
            $objectData["general"]["fullpath"] = $object->getRealFullPath();
            $objectData["general"]["o_locked"] = $object->isLocked();
            $objectData["properties"] = Element\Service::minimizePropertiesForEditmode($object->getProperties());
            $objectData["userPermissions"] = $object->getUserPermissions();
            $objectData["classes"] = $this->prepareChildClasses($object->getDao()->getClasses());
            // grid-config
            $configFile = PIMCORE_CONFIGURATION_DIRECTORY . "/object/grid/" . $object->getId() . "-user_" . $this->getUser()->getId() . ".psf";
            if (is_file($configFile)) {
                $gridConfig = Tool\Serialize::unserialize(file_get_contents($configFile));
                if ($gridConfig) {
                    $selectedClassId = $gridConfig["classId"];
                    foreach ($objectData["classes"] as $class) {
                        if ($class["id"] == $selectedClassId) {
                            $objectData["selectedClass"] = $selectedClassId;
                            break;
                        }
                    }
                }
            }
            $this->_helper->json($objectData);
        } else {
            Logger::debug("prevented getting folder id [ " . $object->getId() . " ] because of missing permissions");
            $this->_helper->json(["success" => false, "message" => "missing_permission"]);
        }
    }