当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::minimizePropertiesForEditmode方法代码示例

本文整理汇总了PHP中Pimcore\Model\Element\Service::minimizePropertiesForEditmode方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::minimizePropertiesForEditmode方法的具体用法?PHP Service::minimizePropertiesForEditmode怎么用?PHP Service::minimizePropertiesForEditmode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Model\Element\Service的用法示例。


在下文中一共展示了Service::minimizePropertiesForEditmode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "asset")) {
         $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "asset")]);
     }
     Element\Editlock::lock($this->getParam("id"), "asset");
     $asset = Asset::getById(intval($this->getParam("id")));
     $asset = clone $asset;
     if (!$asset instanceof Asset) {
         $this->_helper->json(["success" => false, "message" => "asset doesn't exist"]);
     }
     $asset->setMetadata(Asset\Service::expandMetadataForEditmode($asset->getMetadata()));
     $asset->setProperties(Element\Service::minimizePropertiesForEditmode($asset->getProperties()));
     //$asset->getVersions();
     $asset->getScheduledTasks();
     $asset->idPath = Element\Service::getIdPath($asset);
     $asset->userPermissions = $asset->getUserPermissions();
     $asset->setLocked($asset->isLocked());
     $asset->setParent(null);
     if ($asset instanceof Asset\Text) {
         $asset->data = $asset->getData();
     }
     if ($asset instanceof Asset\Image) {
         $imageInfo = [];
         if ($asset->getWidth() && $asset->getHeight()) {
             $imageInfo["dimensions"] = [];
             $imageInfo["dimensions"]["width"] = $asset->getWidth();
             $imageInfo["dimensions"]["height"] = $asset->getHeight();
         }
         if (function_exists("exif_read_data") && is_file($asset->getFileSystemPath())) {
             $supportedTypes = [IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM];
             if (in_array(@exif_imagetype($asset->getFileSystemPath()), $supportedTypes)) {
                 $exif = @exif_read_data($asset->getFileSystemPath());
                 if (is_array($exif)) {
                     $imageInfo["exif"] = [];
                     foreach ($exif as $name => $value) {
                         if (is_string($value) && strlen($value) < 50 || is_numeric($value)) {
                             // this is to ensure that the data can be converted to json (must be utf8)
                             if (mb_check_encoding($value, "UTF-8")) {
                                 $imageInfo["exif"][$name] = $value;
                             }
                         }
                     }
                 }
             }
         }
         $asset->imageInfo = $imageInfo;
     }
     $asset->setStream(null);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new Model\Tool\Admin\EventDataContainer(object2array($asset));
     \Pimcore::getEventManager()->trigger("admin.asset.get.preSendData", $this, ["asset" => $asset, "returnValueContainer" => $returnValueContainer]);
     if ($asset->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(["success" => false, "message" => "missing_permission"]);
 }
开发者ID:solverat,项目名称:pimcore,代码行数:59,代码来源:AssetController.php

示例2: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "asset")) {
         $this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "asset")));
     }
     Element\Editlock::lock($this->getParam("id"), "asset");
     $asset = Asset::getById(intval($this->getParam("id")));
     if (!$asset instanceof Asset) {
         $this->_helper->json(array("success" => false, "message" => "asset doesn't exist"));
     }
     $asset->setMetadata(Asset\Service::expandMetadataForEditmode($asset->getMetadata()));
     $asset->setProperties(Element\Service::minimizePropertiesForEditmode($asset->getProperties()));
     //$asset->getVersions();
     $asset->getScheduledTasks();
     $asset->idPath = Element\Service::getIdPath($asset);
     $asset->userPermissions = $asset->getUserPermissions();
     $asset->setLocked($asset->isLocked());
     $asset->setParent(null);
     if ($asset instanceof Asset\Text) {
         $asset->data = $asset->getData();
     }
     if ($asset instanceof Asset\Image) {
         $imageInfo = array();
         if ($asset->getWidth() && $asset->getHeight()) {
             $imageInfo["dimensions"] = array();
             $imageInfo["dimensions"]["width"] = $asset->getWidth();
             $imageInfo["dimensions"]["height"] = $asset->getHeight();
         }
         if (function_exists("exif_read_data") && is_file($asset->getFileSystemPath())) {
             $supportedTypes = array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM);
             if (in_array(exif_imagetype($asset->getFileSystemPath()), $supportedTypes)) {
                 $exif = @exif_read_data($asset->getFileSystemPath());
                 if (is_array($exif)) {
                     $imageInfo["exif"] = array();
                     foreach ($exif as $name => $value) {
                         if (is_string($value) && strlen($value) < 50 || is_numeric($value)) {
                             // this is to ensure that the data can be converted to json (must be utf8)
                             if (mb_check_encoding($value, "UTF-8")) {
                                 $imageInfo["exif"][$name] = $value;
                             }
                         }
                     }
                 }
             }
         }
         $asset->imageInfo = $imageInfo;
     }
     $asset->setStream(null);
     if ($asset->isAllowed("view")) {
         $this->_helper->json($asset);
     }
     $this->_helper->json(array("success" => false, "message" => "missing_permission"));
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:54,代码来源:AssetController.php

示例3: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "asset")) {
         $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "asset")]);
     }
     Element\Editlock::lock($this->getParam("id"), "asset");
     $asset = Asset::getById(intval($this->getParam("id")));
     $asset = clone $asset;
     if (!$asset instanceof Asset) {
         $this->_helper->json(["success" => false, "message" => "asset doesn't exist"]);
     }
     $asset->setMetadata(Asset\Service::expandMetadataForEditmode($asset->getMetadata()));
     $asset->setProperties(Element\Service::minimizePropertiesForEditmode($asset->getProperties()));
     //$asset->getVersions();
     $asset->getScheduledTasks();
     $asset->idPath = Element\Service::getIdPath($asset);
     $asset->userPermissions = $asset->getUserPermissions();
     $asset->setLocked($asset->isLocked());
     $asset->setParent(null);
     if ($asset instanceof Asset\Text) {
         $asset->data = $asset->getData();
     }
     if ($asset instanceof Asset\Image) {
         $imageInfo = [];
         if ($asset->getWidth() && $asset->getHeight()) {
             $imageInfo["dimensions"] = [];
             $imageInfo["dimensions"]["width"] = $asset->getWidth();
             $imageInfo["dimensions"]["height"] = $asset->getHeight();
         }
         $exifData = $asset->getEXIFData();
         if (!empty($exifData)) {
             $imageInfo["exif"] = $exifData;
         }
         $iptcData = $asset->getIPTCData();
         if (!empty($exifData)) {
             $imageInfo["iptc"] = $iptcData;
         }
         $imageInfo["exiftoolAvailable"] = (bool) \Pimcore\Tool\Console::getExecutable("exiftool");
         $asset->imageInfo = $imageInfo;
     }
     $asset->setStream(null);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new Model\Tool\Admin\EventDataContainer(object2array($asset));
     \Pimcore::getEventManager()->trigger("admin.asset.get.preSendData", $this, ["asset" => $asset, "returnValueContainer" => $returnValueContainer]);
     if ($asset->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(["success" => false, "message" => "missing_permission"]);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:51,代码来源:AssetController.php

示例4: getFolderAction

 public function getFolderAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "object")) {
         $this->_helper->json(array("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 = array();
         $objectData["general"] = array();
         $objectData["idPath"] = Element\Service::getIdPath($object);
         $allowedKeys = array("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->getFullPath();
         $objectData["general"]["o_locked"] = $object->isLocked();
         $objectData["properties"] = Element\Service::minimizePropertiesForEditmode($object->getProperties());
         $objectData["userPermissions"] = $object->getUserPermissions();
         $objectData["classes"] = $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) {
                 $objectData["selectedClass"] = $gridConfig["classId"];
             }
         }
         $this->_helper->json($objectData);
     } else {
         \Logger::debug("prevented getting folder id [ " . $object->getId() . " ] because of missing permissions");
         $this->_helper->json(array("success" => false, "message" => "missing_permission"));
     }
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:37,代码来源:ObjectController.php

示例5: minimizeProperties

 /**
  * @param $document
  */
 protected function minimizeProperties($document)
 {
     $properties = Element\Service::minimizePropertiesForEditmode($document->getProperties());
     $document->setProperties($properties);
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:8,代码来源:Document.php


注:本文中的Pimcore\Model\Element\Service::minimizePropertiesForEditmode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。