Example #1
0
 /**
  * @param int $pageID
  * @param CmsPage|null $basePage
  * @return CmsPage|null
  */
 public function getPageByID($pageID, $basePage = null)
 {
     $resPage = $this->db->select($this->stmntPage, array($pageID));
     if (count($resPage) <= 0) {
         return null;
     }
     $pageData = $resPage[0];
     $page = new CmsPage();
     $page->setID($pageData->ID);
     $page->setTitle($pageData->title);
     $page->setDescription($pageData->description);
     $page->setLanguage($pageData->language_codeFK);
     $page->setModifierID($pageData->modifier_ID);
     $page->setModifierName($pageData->modifier_name);
     $page->setLastModified($pageData->last_modified);
     $page->setCreatorID($pageData->creator_ID);
     $page->setCreatorName($pageData->creator_name);
     $page->setCreated($pageData->created);
     $page->setInheritRights($pageData->inhert_rights);
     $page->setRole($pageData->role);
     $page->setErrorCode($pageData->error_code);
     // Set parent page
     $page->setParentPage($pageData->base_page_IDFK !== null ? $this->getPageByID($pageData->base_page_IDFK, $basePage) : null);
     // Set child pages
     //$page->setChildPages($this->getChildPagesByPageId($pageData->ID));
     $pageIdsRecursive = self::getPageIdsRecursive($page);
     // Set rights
     $page->setRights($this->getRightsByPageID($pageIdsRecursive, $pageData->inhert_rights));
     $page->setCacheMode($this->getCacheModeByPageID($pageIdsRecursive));
     $layoutID = $page->hasParentPage() === false ? $pageData->layout_IDFK : $pageData->base_layout_IDFK;
     $page->setLayoutID($layoutID);
     return $page;
 }