Exemplo n.º 1
0
 /**
  * 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;
     }
 }
Exemplo n.º 2
0
 /**
  * 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;
 }