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


PHP AbstractObject::doHideUnpublished方法代码示例

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


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

示例1: preGetData

 public function preGetData($object, $params = array())
 {
     $data = null;
     if ($object instanceof Object\Concrete) {
         $data = $object->{$this->getName()};
         if ($this->getLazyLoading() and !in_array($this->getName(), $object->getO__loadedLazyFields())) {
             //$data = $this->getDataFromResource($object->getRelationData($this->getName(),true,null));
             $data = $this->load($object, array("force" => true));
             $setter = "set" . ucfirst($this->getName());
             if (method_exists($object, $setter)) {
                 $object->{$setter}($data);
             }
         }
     } else {
         if ($object instanceof Object\Localizedfield) {
             $data = $params["data"];
         } else {
             if ($object instanceof Object\Fieldcollection\Data\AbstractData) {
                 $data = $object->{$this->getName()};
             } else {
                 if ($object instanceof Object\Objectbrick\Data\AbstractData) {
                     $data = $object->{$this->getName()};
                 }
             }
         }
     }
     if (Object\AbstractObject::doHideUnpublished() and is_array($data)) {
         $publishedList = array();
         foreach ($data as $listElement) {
             if (Element\Service::isPublished($listElement)) {
                 $publishedList[] = $listElement;
             }
         }
         return $publishedList;
     }
     return is_array($data) ? $data : array();
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:37,代码来源:Objects.php

示例2: preGetData

 /**
  * @param $object
  * @param array $params
  * @return null|Object\Fieldcollection\Data\Object\Concrete|Object\Objectbrick\Data\
  */
 public function preGetData($object, $params = array())
 {
     $data = null;
     if ($object instanceof Object\Concrete) {
         $data = $object->{$this->getName()};
         if ($this->getLazyLoading() and !in_array($this->getName(), $object->getO__loadedLazyFields())) {
             $data = $this->load($object, array("force" => true));
             $setter = "set" . ucfirst($this->getName());
             if (method_exists($object, $setter)) {
                 $object->{$setter}($data);
             }
         }
     } else {
         if ($object instanceof Object\Localizedfield) {
             $data = $params["data"];
         } else {
             if ($object instanceof Object\Fieldcollection\Data\AbstractData) {
                 $data = $object->{$this->getName()};
             } else {
                 if ($object instanceof Object\Objectbrick\Data\AbstractData) {
                     $data = $object->{$this->getName()};
                 }
             }
         }
     }
     if (Object\AbstractObject::doHideUnpublished() and $data instanceof Element\ElementInterface) {
         if (!Element\Service::isPublished($data)) {
             return null;
         }
     }
     return $data;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:37,代码来源:Href.php

示例3: addConditions

 /**
  * @param \Zend_DB_Select $select
  *
  * @return $this
  */
 protected function addConditions(\Zend_DB_Select $select)
 {
     $condition = $this->model->getCondition();
     $objectTypes = $this->model->getObjectTypes();
     if (!empty($objectTypes)) {
         if (!empty($condition)) {
             $condition .= " AND ";
         }
         $condition .= " o_type IN ('" . implode("','", $objectTypes) . "')";
     }
     if ($condition) {
         if (Object\AbstractObject::doHideUnpublished() && !$this->model->getUnpublished()) {
             $condition = "(" . $condition . ") AND o_published = 1";
         }
     } else {
         if (Object\AbstractObject::doHideUnpublished() && !$this->model->getUnpublished()) {
             $condition = "o_published = 1";
         }
     }
     if ($condition) {
         $select->where($condition);
     }
     return $this;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:29,代码来源:Dao.php

示例4: getCondition

 /**
  * @return string
  */
 protected function getCondition()
 {
     $condition = $this->model->getCondition();
     $objectTypes = $this->model->getObjectTypes();
     if (!empty($objectTypes)) {
         if (!empty($condition)) {
             $condition .= " AND ";
         }
         $condition .= " o_type IN ('" . implode("','", $objectTypes) . "')";
     }
     if ($condition) {
         if (Object\AbstractObject::doHideUnpublished() && !$this->model->getUnpublished()) {
             return " WHERE (" . $condition . ") AND o_published = 1";
         }
         return " WHERE " . $condition . " ";
     } else {
         if (Object\AbstractObject::doHideUnpublished() && !$this->model->getUnpublished()) {
             return " WHERE o_published = 1";
         }
     }
     return "";
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:25,代码来源:Resource.php

示例5: prepareDataForIndex

 /**
  * prepare data for index creation and store is in store table
  *
  * @param OnlineShop_Framework_ProductInterfaces_IIndexable $object
  */
 public function prepareDataForIndex(OnlineShop_Framework_ProductInterfaces_IIndexable $object)
 {
     $subObjectIds = $this->tenantConfig->createSubIdsForObject($object);
     foreach ($subObjectIds as $subObjectId => $object) {
         /**
          * @var OnlineShop_Framework_ProductInterfaces_IIndexable $object
          */
         if ($object->getOSDoIndexProduct() && $this->tenantConfig->inIndex($object)) {
             $a = Pimcore::inAdmin();
             $b = \Pimcore\Model\Object\AbstractObject::doGetInheritedValues();
             Pimcore::unsetAdminMode();
             \Pimcore\Model\Object\AbstractObject::setGetInheritedValues(true);
             $hidePublishedMemory = \Pimcore\Model\Object\AbstractObject::doHideUnpublished();
             \Pimcore\Model\Object\AbstractObject::setHideUnpublished(false);
             $categories = $object->getCategories();
             $categoryIds = array();
             $parentCategoryIds = array();
             if ($categories) {
                 foreach ($categories as $c) {
                     $parent = $c;
                     if ($parent != null) {
                         if ($parent->getOSProductsInParentCategoryVisible()) {
                             while ($parent && $parent instanceof OnlineShop_Framework_AbstractCategory) {
                                 $parentCategoryIds[$parent->getId()] = $parent->getId();
                                 $parent = $parent->getParent();
                             }
                         } else {
                             $parentCategoryIds[$parent->getId()] = $parent->getId();
                         }
                         $categoryIds[$c->getId()] = $c->getId();
                     }
                 }
             }
             ksort($categoryIds);
             $virtualProductId = $subObjectId;
             $virtualProductActive = $object->isActive();
             if ($object->getOSIndexType() == "variant") {
                 $virtualProductId = $this->tenantConfig->createVirtualParentIdForSubId($object, $subObjectId);
             }
             $virtualProduct = \Pimcore\Model\Object\AbstractObject::getById($virtualProductId);
             if ($virtualProduct && method_exists($virtualProduct, "isActive")) {
                 $virtualProductActive = $virtualProduct->isActive();
             }
             $data = array("o_id" => $subObjectId, "o_classId" => $object->getClassId(), "o_virtualProductId" => $virtualProductId, "o_virtualProductActive" => $virtualProductActive, "o_parentId" => $object->getOSParentId(), "o_type" => $object->getOSIndexType(), "categoryIds" => ',' . implode(",", $categoryIds) . ",", "parentCategoryIds" => ',' . implode(",", $parentCategoryIds) . ",", "priceSystemName" => $object->getPriceSystemName(), "active" => $object->isActive(), "inProductList" => $object->isActive(true));
             $relationData = array();
             $columnConfig = $this->columnConfig->column;
             if (!empty($columnConfig->name)) {
                 $columnConfig = array($columnConfig);
             } else {
                 if (empty($columnConfig)) {
                     $columnConfig = array();
                 }
             }
             foreach ($columnConfig as $column) {
                 try {
                     //$data[$column->name] = null;
                     $value = null;
                     if (!empty($column->getter)) {
                         $getter = $column->getter;
                         $value = $getter::get($object, $column->config, $subObjectId, $this->tenantConfig);
                     } else {
                         if (!empty($column->fieldname)) {
                             $getter = "get" . ucfirst($column->fieldname);
                         } else {
                             $getter = "get" . ucfirst($column->name);
                         }
                         if (method_exists($object, $getter)) {
                             $value = $object->{$getter}($column->locale);
                         }
                     }
                     if (!empty($column->interpreter)) {
                         $interpreter = $column->interpreter;
                         $value = $interpreter::interpret($value, $column->config);
                         $interpreterObject = new $interpreter();
                         if ($interpreterObject instanceof OnlineShop_Framework_IndexService_RelationInterpreter) {
                             foreach ($value as $v) {
                                 $relData = array();
                                 $relData['src'] = $subObjectId;
                                 $relData['src_virtualProductId'] = $virtualProductId;
                                 $relData['dest'] = $v['dest'];
                                 $relData['fieldname'] = $column->name;
                                 $relData['type'] = $v['type'];
                                 $relationData[] = $relData;
                             }
                         } else {
                             $data[$column->name] = $value;
                         }
                     } else {
                         $data[$column->name] = $value;
                     }
                     if (is_array($data[$column->name])) {
                         $data[$column->name] = OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER . implode($data[$column->name], OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER) . OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER;
                     }
                 } catch (Exception $e) {
                     Logger::err("Exception in IndexService: " . $e->getMessage(), $e);
//.........这里部分代码省略.........
开发者ID:ascertain,项目名称:NGshop,代码行数:101,代码来源:BatchProcessing.php

示例6: updateIndex

 public function updateIndex(OnlineShop_Framework_ProductInterfaces_IIndexable $object)
 {
     if (!$this->tenantConfig->isActive($object)) {
         Logger::info("Tenant {$this->name} is not active.");
         return;
     }
     $subObjectIds = $this->tenantConfig->createSubIdsForObject($object);
     foreach ($subObjectIds as $subObjectId => $object) {
         if ($object->getOSDoIndexProduct() && $this->tenantConfig->inIndex($object)) {
             $a = Pimcore::inAdmin();
             $b = \Pimcore\Model\Object\AbstractObject::doGetInheritedValues();
             Pimcore::unsetAdminMode();
             \Pimcore\Model\Object\AbstractObject::setGetInheritedValues(true);
             $hidePublishedMemory = \Pimcore\Model\Object\AbstractObject::doHideUnpublished();
             \Pimcore\Model\Object\AbstractObject::setHideUnpublished(false);
             $categories = $object->getCategories();
             $themes = $object->getTheme();
             $categoryIds = array();
             $parentCategoryIds = array();
             if ($categories) {
                 foreach ($categories as $c) {
                     $parent = $c;
                     if ($parent != null) {
                         if ($parent->getOSProductsInParentCategoryVisible()) {
                             while ($parent && $parent instanceof OnlineShop_Framework_AbstractCategory) {
                                 $parentCategoryIds[$parent->getId()] = $parent->getId();
                                 $parent = $parent->getParent();
                             }
                         } else {
                             $parentCategoryIds[$parent->getId()] = $parent->getId();
                         }
                         $categoryIds[$c->getId()] = $c->getId();
                     }
                 }
             }
             $themeIds = array();
             if ($themes) {
                 foreach ($themes as $theme) {
                     $parent = $theme;
                     if ($parent != null) {
                         $themeIds[$theme->getId()] = $theme->getId();
                     }
                 }
             }
             ksort($categoryIds);
             $virtualProductId = $subObjectId;
             $virtualProductActive = $object->isActive();
             if ($object->getOSIndexType() == "variant") {
                 $virtualProductId = $this->tenantConfig->createVirtualParentIdForSubId($object, $subObjectId);
             }
             $virtualProduct = \Pimcore\Model\Object\AbstractObject::getById($virtualProductId);
             if ($virtualProduct && method_exists($virtualProduct, "isActive")) {
                 $virtualProductActive = $virtualProduct->isActive();
             }
             $data = array("o_id" => $subObjectId, "o_classId" => $object->getClassId(), "o_virtualProductId" => $virtualProductId, "o_virtualProductActive" => $virtualProductActive, "o_parentId" => $object->getOSParentId(), "o_type" => $object->getOSIndexType(), "categoryIds" => ',' . implode(",", $categoryIds) . ",", "parentCategoryIds" => ',' . implode(",", $parentCategoryIds) . ",", "priceSystemName" => $object->getPriceSystemName(), "active" => $object->isActive(), "inProductList" => $object->isActive(true), "theme" => ',' . implode(",", $themeIds) . ",");
             $relationData = array();
             $columnConfig = $this->columnConfig->column;
             if (!empty($columnConfig->name)) {
                 $columnConfig = array($columnConfig);
             } else {
                 if (empty($columnConfig)) {
                     $columnConfig = array();
                 }
             }
             foreach ($columnConfig as $column) {
                 try {
                     $value = null;
                     if (!empty($column->getter)) {
                         $getter = $column->getter;
                         $value = $getter::get($object, $column->config, $subObjectId, $this->tenantConfig);
                     } else {
                         if (!empty($column->fieldname)) {
                             $getter = "get" . ucfirst($column->fieldname);
                         } else {
                             $getter = "get" . ucfirst($column->name);
                         }
                         if (method_exists($object, $getter)) {
                             $value = $object->{$getter}($column->locale);
                         }
                     }
                     if (!empty($column->interpreter)) {
                         $interpreter = $column->interpreter;
                         $value = $interpreter::interpret($value, $column->config);
                         $interpreterObject = new $interpreter();
                         if ($interpreterObject instanceof OnlineShop_Framework_IndexService_RelationInterpreter) {
                             foreach ($value as $v) {
                                 $relData = array();
                                 $relData['src'] = $subObjectId;
                                 $relData['src_virtualProductId'] = $virtualProductId;
                                 $relData['dest'] = $v['dest'];
                                 $relData['fieldname'] = $column->name;
                                 $relData['type'] = $v['type'];
                                 $relationData[] = $relData;
                             }
                         } else {
                             $data[$column->name] = $value;
                         }
                     } else {
                         $data[$column->name] = $value;
                     }
//.........这里部分代码省略.........
开发者ID:ascertain,项目名称:NGshop,代码行数:101,代码来源:DefaultMysql.php

示例7: addConditions

 /**
  * @param \Zend_DB_Select $select
  *
  * @return $this
  */
 protected function addConditions(\Zend_DB_Select $select)
 {
     $condition = $this->model->getCondition();
     $objectTypes = $this->model->getObjectTypes();
     $tableName = method_exists($this, "getTableName") ? $this->getTableName() : "objects";
     if (!empty($objectTypes)) {
         if (!empty($condition)) {
             $condition .= " AND ";
         }
         $condition .= " " . $tableName . ".o_type IN ('" . implode("','", $objectTypes) . "')";
     }
     if ($condition) {
         if (Object\AbstractObject::doHideUnpublished() && !$this->model->getUnpublished()) {
             $condition = "(" . $condition . ") AND " . $tableName . ".o_published = 1";
         }
     } elseif (Object\AbstractObject::doHideUnpublished() && !$this->model->getUnpublished()) {
         $condition = $tableName . ".o_published = 1";
     }
     if ($condition) {
         $select->where($condition);
     }
     return $this;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:28,代码来源:Dao.php


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