コード例 #1
0
ファイル: Page.php プロジェクト: pansot2/PadCMS-backend
 /**
  * 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;
 }
コード例 #2
0
ファイル: Editor.php プロジェクト: pansot2/PadCMS-backend
 public function show()
 {
     $oEditorViewHelper = new AM_View_Helper_Editor_Page($this->_oPage);
     $oEditorViewHelper->setViewHelper($this->_oView)->show();
     $oFields = $this->_oPage->getFields();
     $aFieldsData = array();
     foreach ($oFields as $oField) {
         /* @var $oField AM_Model_Db_Field */
         $sFieldType = ucfirst(Zend_Filter::filterStatic($oField->getFieldType()->title, 'Word_UnderscoreToCamelCase'));
         $sHelperClass = 'AM_View_Helper_Field_' . $sFieldType;
         $oEditorViewHelper = new $sHelperClass($oField, $this->_oPage);
         /* @var $oEditorViewHelper AM_View_Helper_Field */
         $oEditorViewHelper->setViewHelper($this->getActionController()->view)->show();
         $aFieldsData[] = array('fid' => $oField->id, 'template_title' => $this->_oPage->getTemplate()->title, 'name' => $oField->name, 'descr' => $oField->description, 'type' => $oField->getFieldType()->title, 'min' => $oField->min, 'max' => $oField->max, 'weight' => $oField->weight);
     }
     $aRecord = array('pid' => $this->_oPage->id, 'fields' => $aFieldsData);
     if (isset($this->getActionController()->view->editor)) {
         $aRecord = array_merge($aRecord, $this->getActionController()->view->editor);
     }
     $this->getActionController()->view->editor = $aRecord;
 }
コード例 #3
0
ファイル: Page.php プロジェクト: pansot2/PadCMS-backend
 /**
  * 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;
 }