コード例 #1
0
ファイル: Content.php プロジェクト: laiello/digitalus-cms
 public function __construct()
 {
     $mdlPage = new Model_Page();
     $mdlContentNode = new Model_PageNode();
     $select = $mdlPage->select();
     $select->where("namespace = 'content'");
     $pages = $mdlPage->fetchAll($select);
     if ($pages->count() > 0) {
         foreach ($pages as $page) {
             $contentNodes = $mdlContentNode->fetchContentObject($page->id);
             if (isset($contentNodes->content)) {
                 //if the page does not have content it doesnt belong in the index (eg blocks)
                 $title = $mdlPage->getPageTitle($page->id);
                 $link = Digitalus_Toolbox_Page::getUrl($page);
                 $link = strtolower($link);
                 $contentNodes = $mdlContentNode->fetchContentObject($page->id);
                 if (isset($contentNodes->teaser)) {
                     $teaser = $contentNodes->teaser;
                 } else {
                     $teaser = Digitalus_Toolbox_String::truncateText($contentNodes->content);
                 }
                 $content = $contentNodes->content;
                 $this->_addPage($link, $title, $teaser, $content);
             }
         }
     }
 }
コード例 #2
0
ファイル: Item.php プロジェクト: ngukho/ducbui-cms
 /**
  * Constructor
  *
  * @param   object  $item   A Zend_Db_Table_Row object
  */
 public function __construct(Zend_Db_Table_Row $item)
 {
     $this->_innerItem = $item;
     $this->label = Digitalus_Toolbox_Page::getLabel($item);
     $this->link = Digitalus_Toolbox_Page::getUrl($item);
     $this->id = $this->_innerItem->id;
     if ($item->show_on_menu) {
         $this->visible = true;
     } else {
         $this->visible = false;
     }
     $page = new Model_Page();
     if ($page->hasChildren($item)) {
         $this->hasSubmenu = true;
     } else {
         $this->hasSubmenu = false;
     }
 }
コード例 #3
0
ファイル: Item.php プロジェクト: laiello/digitalus-cms
 /**
  * Get Page data as array
  *
  * @return  array  Returns an array of the page data, otherwise an empty array
  */
 protected function _getPageAsArray($item = null)
 {
     if (empty($item)) {
         $item = $this->getItem();
     }
     $baseUrl = $this->view->baseUrl();
     $mdlMenu = new Model_Menu();
     $page = array('active' => $this->isActive(false), 'class' => 'menuItem', 'id' => $item->id, 'label' => Digitalus_Toolbox_Page::getLabel($item), 'name' => $item->name, 'resource' => strtolower(Digitalus_Toolbox_String::replaceEmptySpace($item->name)), 'title' => Digitalus_Toolbox_Page::getLabel($item), 'uri' => $baseUrl . '/' . Digitalus_Toolbox_String::replaceEmptySpace(Digitalus_Toolbox_Page::getUrl($item)), 'visible' => $this->isVisible($item));
     $subPages = array();
     if ($mdlMenu->hasChildren($this->id)) {
         $children = $mdlMenu->getChildren($this->id);
         foreach ($children as $child) {
             $subPages[] = new Digitalus_Menu_Item(null, $child);
         }
         $page['pages'] = $subPages;
     }
     return $page;
 }