Beispiel #1
0
 /**
  * Prepares data for view
  */
 public function show()
 {
     $aPageInfo = array();
     $aPageInfo['template_title'] = $this->_oPage->getTemplate()->title;
     $aPageInfo['template_description'] = $this->_oPage->getTemplate()->description;
     $aPageInfo['canDelete'] = $this->_oPage->canDelete();
     $aPageInfo['tocItem'] = $this->_oPage->toc;
     $aPageInfo['tocList'] = $this->_getTocList();
     $aPageInfo['tags'] = $this->_getTags();
     if ($this->_oPage->getIssue()->getApplication()->type != AM_Model_Db_ApplicationType::TYPE_RUE98WE) {
         $aPageInfo['canChangeTemplate'] = $this->_oPage->template == AM_Model_Db_Template::TPL_COVER_PAGE ? false : true;
     } else {
         $aPageInfo['canChangeTemplate'] = true;
     }
     $aPageInfo = array_merge($aPageInfo, $this->_oPage->toArray());
     if ($this->_oPage->getOrientation() == AM_Model_Db_Issue::ORIENTATION_HORIZONTAL || $this->_oPage->getIssue()->static_pdf_mode == AM_Model_Db_Issue::HORISONTAL_MODE_NONE || empty($this->_oPage->getIssue()->static_pdf_mode)) {
         $aPageInfo['showPdfPage'] = false;
     } else {
         $aPageInfo['showPdfPage'] = true;
     }
     $sName = $this->getName();
     if (isset($this->oView->{$sName})) {
         $aPageInfo = array_merge($aPageInfo, $this->oView->{$sName});
     }
     $this->oView->{$sName} = $aPageInfo;
 }
Beispiel #2
0
 /**
  * Returns an array with pages data for view
  *
  * @param AM_Model_Db_Page $oPage
  * @return array
  */
 public static function parsePage(AM_Model_Db_Page $oPage)
 {
     $aPage = $oPage->toArray();
     $aPage['tpl_title'] = $oPage->getTemplate()->description;
     $aPage['has_left'] = $oPage->hasConnection(AM_Model_Db_Page::LINK_LEFT);
     $aPage['has_right'] = $oPage->hasConnection(AM_Model_Db_Page::LINK_RIGHT);
     $aPage['has_top'] = $oPage->hasConnection(AM_Model_Db_Page::LINK_TOP);
     $aPage['has_bottom'] = $oPage->hasConnection(AM_Model_Db_Page::LINK_BOTTOM);
     //Restrict user to add left and right childs in pages which have bottom or top parent
     $aPage['tpl']['has_left'] = $oPage->getLinkType() != AM_Model_Db_Page::LINK_RIGHT && !is_null($oPage->getLinkType()) ? 0 : $oPage->getTemplate()->has_left_connector;
     $aPage['tpl']['has_right'] = $oPage->getLinkType() != AM_Model_Db_Page::LINK_RIGHT && !is_null($oPage->getLinkType()) ? 0 : $oPage->getTemplate()->has_right_connector;
     $aPage['tpl']['has_top'] = $oPage->getTemplate()->has_top_connector;
     $aPage['tpl']['has_bottom'] = $oPage->getTemplate()->has_bottom_connector;
     $oPageRoot = $oPage->getParent();
     if (!is_null($oPageRoot)) {
         $sLinkType = $oPage->reverseLinkType($oPage->getLinkType());
         $aPage[$sLinkType] = $oPageRoot->id;
         $aPage['jumper_' . $sLinkType] = $oPage->getLinkType();
         //The direction of the arrow in the pages tree
     }
     foreach ($oPage->getChilds() as $oPageChild) {
         $sLinkType = $oPageChild->getLinkType();
         $aPage[$sLinkType] = $oPageChild->id;
         $aPage['jumper_' . $sLinkType] = $sLinkType;
         //The direction of the arrow in the pages tree
     }
     $aPage['link_type'] = $oPage->getLinkType();
     $aPage['thumbnailUri'] = $oPage->getPageBackgroundUri();
     return $aPage;
 }