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 ""; }
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(); } } } } }
/** * 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; }
/** * */ 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(); } } } }
/** * @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; }
/** * 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; }
/** * @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}(); } } } }