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


PHP Service::addGridFeatureJoins方法代码示例

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


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

示例1: gridProxyAction


//.........这里部分代码省略.........
         if ($this->getParam("fields")) {
             $fields = $this->getParam("fields");
             foreach ($fields as $f) {
                 $parts = explode("~", $f);
                 $sub = substr($f, 0, 1);
                 if (substr($f, 0, 1) == "~") {
                     $type = $parts[1];
                     //                        $field = $parts[2];
                     //                        $keyid = $parts[3];
                     // key value, ignore for now
                     if ($type == "classificationstore") {
                     }
                 } elseif (count($parts) > 1) {
                     $bricks[$parts[0]] = $parts[0];
                 }
             }
         }
         if ($this->getParam("limit")) {
             $limit = $this->getParam("limit");
         }
         if ($this->getParam("start")) {
             $start = $this->getParam("start");
         }
         $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
         $doNotQuote = false;
         if ($sortingSettings['order']) {
             $order = $sortingSettings['order'];
         }
         if (strlen($sortingSettings['orderKey']) > 0) {
             $orderKey = $sortingSettings['orderKey'];
             if (!(substr($orderKey, 0, 1) == "~")) {
                 if (array_key_exists($orderKey, $colMappings)) {
                     $orderKey = $colMappings[$orderKey];
                 } elseif ($class->getFieldDefinition($orderKey) instanceof Object\ClassDefinition\Data\QuantityValue) {
                     $orderKey = "concat(" . $orderKey . "__unit, " . $orderKey . "__value)";
                     $doNotQuote = true;
                 } elseif (strpos($orderKey, "~") !== false) {
                     $orderKeyParts = explode("~", $orderKey);
                     if (count($orderKeyParts) == 2) {
                         $orderKey = $orderKeyParts[1];
                     }
                 }
             }
         }
         $listClass = "\\Pimcore\\Model\\Object\\" . ucfirst($className) . "\\Listing";
         $conditionFilters = [];
         if ($this->getParam("only_direct_children") == "true") {
             $conditionFilters[] = "o_parentId = " . $folder->getId();
         } else {
             $conditionFilters[] = "(o_path = '" . $folder->getRealFullPath() . "' OR o_path LIKE '" . str_replace("//", "/", $folder->getRealFullPath() . "/") . "%')";
         }
         if (!$this->getUser()->isAdmin()) {
             $userIds = $this->getUser()->getRoles();
             $userIds[] = $this->getUser()->getId();
             $conditionFilters[] .= " (\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                                                 )";
         }
         $featureJoins = [];
         $featureFilters = false;
         // create filter condition
         if ($this->getParam("filter")) {
             $conditionFilters[] = Object\Service::getFilterCondition($this->getParam("filter"), $class);
             $featureFilters = Object\Service::getFeatureFilters($this->getParam("filter"), $class);
             if ($featureFilters) {
                 $featureJoins = array_merge($featureJoins, $featureFilters["joins"]);
             }
         }
         if ($this->getParam("condition")) {
             $conditionFilters[] = "(" . $this->getParam("condition") . ")";
         }
         $list = new $listClass();
         if (!empty($bricks)) {
             foreach ($bricks as $b) {
                 $list->addObjectbrick($b);
             }
         }
         $list->setCondition(implode(" AND ", $conditionFilters));
         $list->setLimit($limit);
         $list->setOffset($start);
         if (isset($sortingSettings["isFeature"]) && $sortingSettings["isFeature"]) {
             $orderKey = "cskey_" . $sortingSettings["fieldname"] . "_" . $sortingSettings["groupId"] . "_" . $sortingSettings["keyId"];
             $list->setOrderKey($orderKey);
             $list->setGroupBy("o_id");
             $featureJoins[] = $sortingSettings;
         } else {
             $list->setOrderKey($orderKey, !$doNotQuote);
         }
         $list->setOrder($order);
         if ($class->getShowVariants()) {
             $list->setObjectTypes([Object\AbstractObject::OBJECT_TYPE_OBJECT, Object\AbstractObject::OBJECT_TYPE_VARIANT]);
         }
         Object\Service::addGridFeatureJoins($list, $featureJoins, $class, $featureFilters, $requestedLanguage);
         $list->load();
         $objects = [];
         foreach ($list->getObjects() as $object) {
             $o = Object\Service::gridObjectData($object, $fields, $requestedLanguage);
             $objects[] = $o;
         }
         $this->_helper->json(["data" => $objects, "success" => true, "total" => $list->getTotalCount()]);
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:ObjectController.php

示例2: prepareExportList

 protected function prepareExportList()
 {
     $requestedLanguage = $this->extractLanguage();
     $folder = Pimcore\Model\Object\AbstractObject::getById($this->getParam("folderId"));
     $class = Object\ClassDefinition::getById($this->getParam("classId"));
     $className = $class->getName();
     $listClass = "\\Pimcore\\Model\\Object\\" . ucfirst($className) . "\\Listing";
     if (!empty($folder)) {
         $conditionFilters = ["o_path LIKE '" . $folder->getRealFullPath() . "%'"];
     } else {
         $conditionFilters = [];
     }
     $featureJoins = [];
     if ($this->getParam("filter")) {
         $conditionFilters[] = Object\Service::getFilterCondition($this->getParam("filter"), $class);
         $featureFilters = Object\Service::getFeatureFilters($this->getParam("filter"), $class);
         if ($featureFilters) {
             $featureJoins = array_merge($featureJoins, $featureFilters["joins"]);
         }
     }
     if ($this->getParam("condition")) {
         $conditionFilters[] = "(" . $this->getParam("condition") . ")";
     }
     /** @var Object\Listing\Concrete $list */
     $list = new $listClass();
     $list->setCondition(implode(" AND ", $conditionFilters));
     //parameters specified in the objects grid
     $ids = $this->getParam('ids', []);
     if (!empty($ids)) {
         //add a condition if id numbers are specified
         $list->addConditionParam('o_id IN (' . implode(',', $ids) . ')');
     }
     $list->setOrder("ASC");
     $list->setOrderKey("o_id");
     $objectType = $this->getParam("objecttype");
     if ($objectType) {
         if ($objectType == Object\AbstractObject::OBJECT_TYPE_OBJECT && $class->getShowVariants()) {
             $list->setObjectTypes([Object\AbstractObject::OBJECT_TYPE_OBJECT, Object\AbstractObject::OBJECT_TYPE_VARIANT]);
         } else {
             $list->setObjectTypes([$objectType]);
         }
     }
     list($fields, $bricks) = $this->extractFieldsAndBricks();
     if (!empty($bricks)) {
         foreach ($bricks as $b) {
             $list->addObjectbrick($b);
         }
     }
     $list->setLocale($requestedLanguage);
     Object\Service::addGridFeatureJoins($list, $featureJoins, $class, $featureFilters, $requestedLanguage);
     return [$list, $fields, $requestedLanguage];
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:52,代码来源:ObjectHelperController.php


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