/** * loadPage * @author Cornelius Hansjakob <*****@*****.**> * @version 1.0 */ public function loadPage($blnLoadByParentId = false, $blnLoadGlobalTreeStartPage = true) { try { $this->getModel(); $objPageData = $blnLoadByParentId == true ? $this->objModel->loadByParentId($this->intParentId, $this->intTypeId, true) : $this->objModel->loadByIdAndVersion($this->strPageId, $this->intPageVersion); if (count($objPageData) > 0) { $objPage = $objPageData->current(); $this->setPageId($objPage->relationId); $this->setPageVersion($objPage->version); $this->setElementId($objPage->id); $this->setTemplateFile($objPage->filename); $this->setTemplateId($objPage->idTemplates); $this->setPublisherName($objPage->publisher); $this->setPublishDate($objPage->published); $this->setCreatorName($objPage->creator); $this->setCreateDate($objPage->created); $this->setChangeUserName($objPage->changeUser); $this->setChangeDate($objPage->changed); if (isset($objPage->idPageTypes)) { $this->setTypeId($objPage->idPageTypes); } if (isset($objPage->idGlobalTypes)) { $this->setTypeId($objPage->idGlobalTypes); } if (isset($objPage->linkId)) { $this->setElementLinkId($objPage->linkId); } $this->setIsStartElement($objPage->isStartElement); $this->setShowInNavigation($objPage->showInNavigation); $this->setStatus($objPage->idStatus); $this->setParentId($objPage->idParent); $this->setParentTypeId($objPage->idParentTypes); /** * navigation parent properties */ if ($this->intNavParentId === null) { $this->setNavParentId($objPage->idParent); $this->setNavParentTypeId($objPage->idParentTypes); } $this->objGenericData = new GenericData(); $this->objGenericData->Setup()->setRootLevelId($this->intRootLevelId); $this->objGenericData->Setup()->setRootLevelGroupId($this->intRootLevelGroupId); $this->objGenericData->Setup()->setFormId($objPage->genericFormId); $this->objGenericData->Setup()->setFormVersion($objPage->version); $this->objGenericData->Setup()->setFormTypeId($objPage->idGenericFormTypes); $this->objGenericData->Setup()->setTemplateId($objPage->idTemplates); $this->objGenericData->Setup()->setElementId($objPage->id); $this->objGenericData->Setup()->setElementLinkId($this->getElementLinkId()); $this->objGenericData->Setup()->setActionType($this->core->sysConfig->generic->actions->edit); $this->objGenericData->Setup()->setFormLanguageId($this->core->sysConfig->languages->default->id); $this->objGenericData->Setup()->setLanguageId($this->intLanguageId); $this->objGenericData->Setup()->setParentId($this->getParentId()); $this->objGenericData->Setup()->setParentTypeId($this->getParentTypeId()); $this->objGenericData->Setup()->setModelSubPath($this->getModelSubPath()); $this->objGenericData->loadData(); if ($this->objGenericData->Setup()->getLanguageFallbackId() > 0 && $this->objGenericData->Setup()->getLanguageFallbackId() != $this->getLanguageId()) { $this->objFallbackPage = clone $this; $this->setLanguageId($this->objGenericData->Setup()->getLanguageFallbackId()); $this->loadPage(); } else { if ($this->objFallbackPage instanceof Page) { $this->objGenericData->Setup()->setLanguageFallbackId($this->objFallbackPage->getLanguageId()); } /** * page type based fallbacks */ if (isset($objPage->idPageTypes)) { switch ($objPage->idPageTypes) { case $this->core->sysConfig->page_types->external->id: if (filter_var($this->getFieldValue('external'), FILTER_VALIDATE_URL)) { header('Location: ' . $this->getFieldValue('external')); } else { if (filter_var('http://' . $this->getFieldValue('external'), FILTER_VALIDATE_URL)) { header('Location: http://' . $this->getFieldValue('external')); } else { header('Location: http://' . $_SERVER['HTTP_HOST']); } } exit; case $this->core->sysConfig->page_types->link->id: header('Location: http://' . $_SERVER['HTTP_HOST'] . $this->getField('internal_link')->strLinkedPageUrl); exit; case $this->core->sysConfig->page_types->product_tree->id: case $this->core->sysConfig->page_types->press_area->id: case $this->core->sysConfig->page_types->courses->id: case $this->core->sysConfig->page_types->events->id: if ($blnLoadGlobalTreeStartPage == true) { $this->objParentPage = clone $this; $this->setType('global'); $this->setModelSubPath('global/models/'); $this->setParentId($this->getFieldValue('entry_point')); $this->setNavParentId($this->getFieldValue('entry_point')); $this->setParentTypeId($this->core->sysConfig->parent_types->folder); $this->objModel = null; $this->loadPage(true); } break; } } if ($this->objBaseUrl instanceof Zend_Db_Table_Row_Abstract) { $this->objParentPage = new Page(); $this->objParentPage->setRootLevelId($this->intRootLevelId); $this->objParentPage->setRootLevelTitle($this->strRootLevelTitle); $this->objParentPage->setPageId($this->objBaseUrl->relationId); $this->objParentPage->setPageVersion($this->objBaseUrl->version); $this->objParentPage->setLanguageId($this->objBaseUrl->idLanguages); $this->objParentPage->setType('page'); $this->objParentPage->setModelSubPath('cms/models/'); $this->objParentPage->loadPage(false, false); $this->objParentPage->setChildPage($this); } } } else { throw new Exception('Not able to load page, because no page found in database!'); } } catch (Exception $exc) { $this->core->logger->err($exc); } }