public function propertiesAction() { if ($this->getParam("data")) { $this->checkPermission("predefined_properties"); if ($this->getParam("xaction") == "destroy") { $data = \Zend_Json::decode($this->getParam("data")); if (\Pimcore\Tool\Admin::isExtJS6()) { $id = $data["id"]; } else { $id = $data; } $property = Property\Predefined::getById($id); $property->delete(); $this->_helper->json(array("success" => true, "data" => array())); } else { if ($this->getParam("xaction") == "update") { $data = \Zend_Json::decode($this->getParam("data")); // save type $property = Property\Predefined::getById($data["id"]); $property->setValues($data); $property->save(); $this->_helper->json(array("data" => $property, "success" => true)); } else { if ($this->getParam("xaction") == "create") { $data = \Zend_Json::decode($this->getParam("data")); unset($data["id"]); // save type $property = Property\Predefined::create(); $property->setValues($data); $property->save(); $this->_helper->json(array("data" => $property, "success" => true)); } } } } else { // get list of types $list = new Property\Predefined\Listing(); $list->setLimit($this->getParam("limit")); $list->setOffset($this->getParam("start")); $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams()); if ($sortingSettings['orderKey']) { $list->setOrderKey($sortingSettings['orderKey']); $list->setOrder($sortingSettings['order']); } else { $list->setOrderKey('name'); } if ($this->getParam("filter")) { $list->setCondition("`name` LIKE " . $list->quote("%" . $this->getParam("filter") . "%") . " OR `description` LIKE " . $list->quote("%" . $this->getParam("filter") . "%")); } $list->load(); $properties = array(); if (is_array($list->getProperties())) { foreach ($list->getProperties() as $property) { $properties[] = $property; } } $this->_helper->json(array("data" => $properties, "success" => true, "total" => $list->getTotalCount())); } }