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


PHP Tool::getCustomViewConfig方法代码示例

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


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

示例1: adminCssAction

 public function adminCssAction()
 {
     // customviews config
     $cvData = Tool::getCustomViewConfig();
     $this->view->customviews = $cvData;
     $this->getResponse()->setHeader("Content-Type", "text/css; charset=UTF-8", true);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:7,代码来源:MiscController.php

示例2: treeGetChildsByIdAction

 public function treeGetChildsByIdAction()
 {
     $object = Object::getById($this->getParam("node"));
     $objectTypes = null;
     $objects = [];
     if ($object instanceof Object\Concrete) {
         $class = $object->getClass();
         if ($class->getShowVariants()) {
             $objectTypes = array(Object\AbstractObject::OBJECT_TYPE_FOLDER, Object\AbstractObject::OBJECT_TYPE_OBJECT, Object\AbstractObject::OBJECT_TYPE_VARIANT);
         }
     }
     if (!$objectTypes) {
         $objectTypes = array(Object\AbstractObject::OBJECT_TYPE_OBJECT, Object\AbstractObject::OBJECT_TYPE_FOLDER);
     }
     if ($object->hasChilds($objectTypes)) {
         $limit = intval($this->getParam("limit"));
         if (!$this->getParam("limit")) {
             $limit = 100000000;
         }
         $offset = intval($this->getParam("start"));
         $childsList = new Object\Listing();
         $condition = "o_parentId = '" . $object->getId() . "'";
         // custom views start
         if ($this->getParam("view")) {
             $cvConfig = Tool::getCustomViewConfig();
             $cv = $cvConfig[$this->getParam("view") - 1];
             if ($cv["classes"]) {
                 $cvConditions = array();
                 $cvClasses = explode(",", $cv["classes"]);
                 foreach ($cvClasses as $cvClass) {
                     $cvConditions[] = "o_classId = '" . $cvClass . "'";
                 }
                 $cvConditions[] = "o_type = 'folder'";
                 if (count($cvConditions) > 0) {
                     $condition .= " AND (" . implode(" OR ", $cvConditions) . ")";
                 }
             }
         }
         // custom views end
         if (!$this->getUser()->isAdmin()) {
             $userIds = $this->getUser()->getRoles();
             $userIds[] = $this->getUser()->getId();
             $condition .= " AND (\n                                                    (select list from users_workspaces_object where userId in (" . implode(',', $userIds) . ") and LOCATE(CONCAT(o_path,o_key),cpath)=1  ORDER BY LENGTH(cpath) DESC LIMIT 1)=1\n                                                    OR\n                                                    (select list from users_workspaces_object where userId in (" . implode(',', $userIds) . ") and LOCATE(cpath,CONCAT(o_path,o_key))=1  ORDER BY LENGTH(cpath) DESC LIMIT 1)=1\n                                                 )";
         }
         $childsList->setCondition($condition);
         $childsList->setLimit($limit);
         $childsList->setOffset($offset);
         $childsList->setOrderKey("FIELD(o_type, 'folder') DESC, o_key ASC", false);
         $childsList->setObjectTypes($objectTypes);
         $childs = $childsList->load();
         foreach ($childs as $child) {
             $tmpObject = $this->getTreeNodeConfig($child);
             if ($child->isAllowed("list")) {
                 $objects[] = $tmpObject;
             }
         }
     }
     //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($objects);
     \Pimcore::getEventManager()->trigger("admin.object.treeGetChildsById.preSendData", $this, array("returnValueContainer" => $returnValueContainer));
     if ($this->getParam("limit")) {
         $this->_helper->json(array("offset" => $offset, "limit" => $limit, "total" => $object->getChildAmount(array(Object\AbstractObject::OBJECT_TYPE_OBJECT, Object\AbstractObject::OBJECT_TYPE_FOLDER, Object\AbstractObject::OBJECT_TYPE_VARIANT), $this->getUser()), "nodes" => $returnValueContainer->getData(), "fromPaging" => intval($this->getParam("fromPaging"))));
     } else {
         $this->_helper->json($returnValueContainer->getData());
     }
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:67,代码来源:ObjectController.php

示例3: getCustomviewsAction

 public function getCustomviewsAction()
 {
     $data = Tool::getCustomViewConfig();
     $this->_helper->json(array("success" => true, "data" => $data));
 }
开发者ID:cannonerd,项目名称:pimcore,代码行数:5,代码来源:ObjectHelperController.php

示例4: removeCustomView

 public function removeCustomView()
 {
     $customViews = \Pimcore\Tool::getCustomViewConfig();
     if ($customViews) {
         foreach ($customViews as $key => $view) {
             if ($view['name'] == 'CoreShop') {
                 unset($customViews[$key]);
                 break;
             }
         }
         $writer = new \Zend_Config_Writer_Xml(array('config' => new \Zend_Config(array('views' => array('view' => $customViews))), 'filename' => PIMCORE_CONFIGURATION_DIRECTORY . '/customviews.xml'));
         $writer->write();
     }
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:14,代码来源:Install.php

示例5: indexAction

 public function indexAction()
 {
     // IE compatibility
     //$this->getResponse()->setHeader("X-UA-Compatible", "IE=8; IE=9", true);
     // clear open edit locks for this session (in the case of a reload, ...)
     \Pimcore\Model\Element\Editlock::clearSession(session_id());
     // check maintenance
     $maintenance_enabled = false;
     $manager = Model\Schedule\Manager\Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = \Zend_Json::encode($maintenance_enabled);
     // configuration
     $sysConfig = Config::getSystemConfig();
     $this->view->config = $sysConfig;
     //mail settings
     $mailIncomplete = false;
     if ($sysConfig->email) {
         if (!$sysConfig->email->debug->emailaddresses) {
             $mailIncomplete = true;
         }
         if (!$sysConfig->email->sender->email) {
             $mailIncomplete = true;
         }
         if ($sysConfig->email->method == "smtp" && !$sysConfig->email->smtp->host) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_complete = \Zend_Json::encode(!$mailIncomplete);
     // report configuration
     $this->view->report_config = Config::getReportConfig();
     // customviews config
     $cvConfig = Tool::getCustomViewConfig();
     $cvData = array();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             $rootNode = Model\Object::getByPath($tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = explode(",", $tmpData["classes"]);
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $cvData[] = $tmpData;
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $upload_mb = min($max_upload, $max_post);
     $this->view->upload_max_filesize = $upload_mb;
     // csrf token
     $user = $this->getUser();
     $this->view->csrfToken = Tool\Session::useSession(function ($adminSession) use($user) {
         if (!isset($adminSession->csrfToken) && !$adminSession->csrfToken) {
             $adminSession->csrfToken = sha1(microtime() . $user->getName() . uniqid());
         }
         return $adminSession->csrfToken;
     });
     if (\Pimcore\Tool\Admin::isExtJS6()) {
         $this->forward("index6");
     }
 }
开发者ID:jansarmir,项目名称:pimcore,代码行数:69,代码来源:IndexController.php

示例6: indexAction

 public function indexAction()
 {
     // clear open edit locks for this session (in the case of a reload, ...)
     \Pimcore\Model\Element\Editlock::clearSession(session_id());
     // check maintenance
     $maintenance_enabled = false;
     $manager = Model\Schedule\Manager\Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = \Zend_Json::encode($maintenance_enabled);
     // configuration
     $sysConfig = Config::getSystemConfig();
     $this->view->config = $sysConfig;
     //mail settings
     $mailIncomplete = false;
     if ($sysConfig->email) {
         if (!$sysConfig->email->debug->emailaddresses) {
             $mailIncomplete = true;
         }
         if (!$sysConfig->email->sender->email) {
             $mailIncomplete = true;
         }
         if ($sysConfig->email->method == "smtp" && !$sysConfig->email->smtp->host) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_complete = \Zend_Json::encode(!$mailIncomplete);
     // report configuration
     $this->view->report_config = Config::getReportConfig();
     $cvData = [];
     // still needed when publishing objects
     $cvConfig = Tool::getCustomViewConfig();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             // backwards compatibility
             $treeType = $tmpData["treetype"] ? $tmpData["treetype"] : "object";
             $rootNode = Model\Element\Service::getElementByPath($treeType, $tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = $tmpData["classes"] ? explode(",", $tmpData["classes"]) : null;
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 // Check if a user has privileges to that node
                 if ($rootNode->isAllowed("list")) {
                     $cvData[] = $tmpData;
                 }
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $upload_mb = min($max_upload, $max_post);
     $this->view->upload_max_filesize = $upload_mb;
     // session lifetime (gc)
     $session_gc_maxlifetime = ini_get("session.gc_maxlifetime");
     if (empty($session_gc_maxlifetime)) {
         $session_gc_maxlifetime = 120;
     }
     $this->view->session_gc_maxlifetime = $session_gc_maxlifetime;
     // csrf token
     $user = $this->getUser();
     $this->view->csrfToken = Tool\Session::useSession(function ($adminSession) use($user) {
         if (!isset($adminSession->csrfToken) && !$adminSession->csrfToken) {
             $adminSession->csrfToken = sha1(microtime() . $user->getName() . uniqid());
         }
         return $adminSession->csrfToken;
     });
     if (\Pimcore\Tool\Admin::isExtJS6()) {
         $this->forward("index6");
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:78,代码来源:IndexController.php

示例7: getRuntimeElementTreeConfig

 /** Returns the element tree config for the given config name
  * @param $name
  * @return array
  */
 protected static function getRuntimeElementTreeConfig($name)
 {
     $masterConfig = self::getPerspectivesConfig()->toArray();
     $config = $masterConfig[$name];
     if (!$config) {
         $config = [];
     }
     $tmpResult = $config["elementTree"];
     if (is_null($tmpResult)) {
         $tmpResult = [];
     }
     $result = [];
     $cfConfigMapping = [];
     $cvConfigs = Tool::getCustomViewConfig();
     if ($cvConfigs) {
         foreach ($cvConfigs as $node) {
             $tmpData = $node;
             if (!isset($tmpData["id"])) {
                 Logger::error("custom view ID is missing " . var_export($tmpData, true));
                 continue;
             }
             if ($tmpData["hidden"]) {
                 continue;
             }
             // backwards compatibility
             $treeType = $tmpData["treetype"] ? $tmpData["treetype"] : "object";
             $rootNode = Model\Element\Service::getElementByPath($treeType, $tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["type"] = "customview";
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = $tmpData["classes"] ? explode(",", $tmpData["classes"]) : null;
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $customViewId = $tmpData["id"];
                 $cfConfigMapping[$customViewId] = $tmpData;
             }
         }
     }
     foreach ($tmpResult as $resultItem) {
         if ($resultItem["hidden"]) {
             continue;
         }
         if ($resultItem["type"] == "customview") {
             $customViewId = $resultItem["id"];
             if (!$customViewId) {
                 Logger::error("custom view id missing " . var_export($resultItem, true));
                 continue;
             }
             $customViewCfg = $cfConfigMapping[$customViewId];
             if (!$customViewId) {
                 Logger::error("no custom view config for id  " . $customViewId);
                 continue;
             }
             foreach ($resultItem as $specificConfigKey => $specificConfigValue) {
                 $customViewCfg[$specificConfigKey] = $specificConfigValue;
             }
             $result[] = $customViewCfg;
         } else {
             $result[] = $resultItem;
         }
     }
     usort($result, function ($treeA, $treeB) {
         $a = $treeA["sort"] ? $treeA["sort"] : 0;
         $b = $treeB["sort"] ? $treeB["sort"] : 0;
         if ($a > $b) {
             return 1;
         } elseif ($a < $b) {
             return -1;
         } else {
             return 0;
         }
     });
     return $result;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:77,代码来源:Config.php

示例8: getCustomViewById

 public static function getCustomViewById($id)
 {
     $customViews = Tool::getCustomViewConfig();
     if ($customViews) {
         foreach ($customViews as $customView) {
             if ($customView["id"] == $id) {
                 return $customView;
             }
         }
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:11,代码来源:Service.php


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