setUnpublished() public method

public setUnpublished ( $unpublished ) : boolean
return boolean
Example #1
0
 public static function getUniqueKey($item, $nr = 0)
 {
     $list = new Listing();
     $list->setUnpublished(true);
     $key = \Pimcore\File::getValidFilename($item->getKey());
     if (!$key) {
         throw new \Exception("No item key set.");
     }
     if ($nr) {
         $key = $key . '_' . $nr;
     }
     $parent = $item->getParent();
     if (!$parent) {
         throw new \Exception("You have to set a parent Object to determine a unique Key");
     }
     if (!$item->getId()) {
         $list->setCondition('o_parentId = ? AND `o_key` = ? ', array($parent->getId(), $key));
     } else {
         $list->setCondition('o_parentId = ? AND `o_key` = ? AND o_id != ? ', array($parent->getId(), $key, $item->getId()));
     }
     $check = $list->loadIdList();
     if (!empty($check)) {
         $nr++;
         $key = self::getUniqueKey($item, $nr);
     }
     return $key;
 }
 public function getIdPathPagingInfoAction()
 {
     $path = $this->getParam("path");
     $pathParts = explode("/", $path);
     $id = array_pop($pathParts);
     $limit = $this->getParam("limit");
     if (empty($limit)) {
         $limit = 30;
     }
     $data = array();
     $targetObject = Object::getById($id);
     $object = $targetObject;
     while ($parent = $object->getParent()) {
         $list = new Object\Listing();
         $list->setCondition("o_parentId = ?", $parent->getId());
         $list->setUnpublished(true);
         $total = $list->getTotalCount();
         $info = array("total" => $total);
         if ($total > $limit) {
             $idList = $list->loadIdList();
             $position = array_search($object->getId(), $idList);
             $info["position"] = $position + 1;
             $info["page"] = ceil($info["position"] / $limit);
             $containsPaging = true;
         }
         $data[$parent->getId()] = $info;
         $object = $parent;
     }
     $this->_helper->json($data);
 }
Example #3
0
 /**
  * Get a list of the sibling documents
  *
  * @param array $objectTypes
  * @param bool $unpublished
  * @return array
  */
 public function getSiblings($objectTypes = array(self::OBJECT_TYPE_OBJECT, self::OBJECT_TYPE_FOLDER), $unpublished = false)
 {
     if ($this->o_siblings === null || $this->lastGetSiblingObjectTypes != $objectTypes) {
         $list = new Listing();
         $list->setUnpublished($unpublished);
         // string conversion because parentId could be 0
         $list->addConditionParam("o_parentId = ?", (string) $this->getParentId());
         $list->addConditionParam("o_id != ?", $this->getId());
         $list->setOrderKey("o_key");
         $list->setObjectTypes($objectTypes);
         $list->setOrder("asc");
         $this->o_siblings = $list->load();
     }
     return $this->o_siblings;
 }