doHideUnpublished() public static method

Checks if unpublished documents should be hidden.
public static doHideUnpublished ( ) : boolean
return boolean
コード例 #1
0
ファイル: Dao.php プロジェクト: emanuel-london/pimcore
 protected function getCondition()
 {
     if ($cond = $this->model->getCondition()) {
         if (Document::doHideUnpublished() && !$this->model->getUnpublished()) {
             return " WHERE (" . $cond . ") AND published = 1";
         }
         return " WHERE " . $cond . " ";
     } elseif (Document::doHideUnpublished() && !$this->model->getUnpublished()) {
         return " WHERE published = 1";
     }
     return "";
 }
コード例 #2
0
 protected function updatePathFromInternal()
 {
     if ($this->data['internal']) {
         if ($this->data['internalType'] == 'document') {
             if ($doc = Document::getById($this->data['internalId'])) {
                 if (!Document::doHideUnpublished() || $doc->isPublished()) {
                     $path = $doc->getFullPath();
                     $this->data['path'] = \Toolbox\Tools\GlobalLink::parse($path);
                 }
             }
         } else {
             if ($this->data['internalType'] == 'asset') {
                 if ($asset = Asset::getById($this->data['internalId'])) {
                     $this->data['path'] = $asset->getFullPath();
                 }
             }
         }
     }
 }
コード例 #3
0
 /**
  * Returns teh path of the linked element
  *
  * @return mixed
  */
 public function getFullPath()
 {
     $this->setElement();
     //don't give unpublished elements in frontend
     if (Document::doHideUnpublished() and !Element\Service::isPublished($this->element)) {
         return false;
     }
     if ($this->element instanceof Element\ElementInterface) {
         return $this->element->getFullPath();
     }
     return;
 }
コード例 #4
0
ファイル: Link.php プロジェクト: emanuel-london/pimcore
 /**
  * 
  */
 protected function updatePathFromInternal()
 {
     if ($this->data["internal"]) {
         if ($this->data["internalType"] == "document") {
             if ($doc = Document::getById($this->data["internalId"])) {
                 if (!Document::doHideUnpublished() || $doc->isPublished()) {
                     $this->data["path"] = $doc->getFullPath();
                 } else {
                     $this->data["path"] = "";
                 }
             }
         } elseif ($this->data["internalType"] == "asset") {
             if ($asset = Asset::getById($this->data["internalId"])) {
                 $this->data["path"] = $asset->getFullPath();
             }
         }
     }
 }
コード例 #5
0
ファイル: Link.php プロジェクト: Gerhard13/pimcore
 /**
  * @return string
  */
 public function getHref()
 {
     if ($this->data["internal"]) {
         if ($this->data["internalType"] == "document") {
             if ($doc = Document::getById($this->data["internalId"])) {
                 if (!Document::doHideUnpublished() || $doc->isPublished()) {
                     $this->data["path"] = $doc->getFullPath();
                 } else {
                     $this->data["path"] = "";
                 }
             }
         } else {
             if ($this->data["internalType"] == "asset") {
                 if ($asset = Asset::getById($this->data["internalId"])) {
                     $this->data["path"] = $asset->getFullPath();
                 }
             }
         }
     }
     $url = $this->data["path"];
     if (strlen($this->data["parameters"]) > 0) {
         $url .= "?" . str_replace("?", "", $this->getParameters());
     }
     if (strlen($this->data["anchor"]) > 0) {
         $url .= "#" . str_replace("#", "", $this->getAnchor());
     }
     return $url;
 }
コード例 #6
0
ファイル: Listing.php プロジェクト: pimcore/pimcore
 /**
  * Returns the SQL condition value.
  *
  * @return string
  */
 public function getCondition()
 {
     $condition = parent::getCondition();
     if ($condition) {
         if (Document::doHideUnpublished() && !$this->getUnpublished()) {
             $condition = " (" . $condition . ") AND published = 1";
         }
     } elseif (Document::doHideUnpublished() && !$this->getUnpublished()) {
         $condition = "published = 1";
     }
     return $condition;
 }
コード例 #7
0
ファイル: Link.php プロジェクト: pimcore/pimcore
 /**
  * @param bool $realPath
  */
 protected function updatePathFromInternal($realPath = false)
 {
     $method = "getFullPath";
     if ($realPath) {
         $method = "getRealFullPath";
     }
     if (isset($this->data["internal"]) && $this->data["internal"]) {
         if ($this->data["internalType"] == "document") {
             if ($doc = Document::getById($this->data["internalId"])) {
                 if (!Document::doHideUnpublished() || $doc->isPublished()) {
                     $this->data["path"] = $doc->{$method}();
                 } else {
                     $this->data["path"] = "";
                 }
             }
         } elseif ($this->data["internalType"] == "asset") {
             if ($asset = Asset::getById($this->data["internalId"])) {
                 $this->data["path"] = $asset->{$method}();
             }
         }
     }
 }