Пример #1
0
 /**
  * Convenience method
  * call $this->renderMenu() in the view to access 
  * the helper
  *
  * @access public
  * @return string
  */
 public function renderSubMenu()
 {
     $navigation = App_Backoffice_Navigation::getInstance()->getNavigation();
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     //Extract the submenu we have to show
     foreach ($navigation as $tab) {
         if (isset($tab['main']['active']) && $tab['main']['active']) {
             $pages = $tab['pages'];
             break;
         }
     }
     $menu = array();
     if (!empty($pages)) {
         foreach ($pages as $page) {
             if (isset($page['action'])) {
                 $url = $baseUrl . '/' . $page['controller'] . '/' . $page['action'];
             } else {
                 $url = $baseUrl . '/' . $page['controller'];
             }
             if (isset($page['active']) && $page['active']) {
                 $li = sprintf($this->_linkSelectedTemplate, $url, $page['label']);
             } else {
                 $li = sprintf($this->_linkTemplate, $url, $page['label']);
             }
             $menu[] = $li;
         }
     }
     $xhtml = '<ul class="prefix_1 clearfix">' . PHP_EOL . implode(PHP_EOL, $menu) . PHP_EOL . '</ul>';
     return $xhtml;
 }
Пример #2
0
 /**
  * Convenience method
  * call $this->renderMenu() in the view to access 
  * the helper
  *
  * @access public
  * @return string
  */
 public function renderMenu()
 {
     $navigation = App_Backoffice_Navigation::getInstance()->getNavigation();
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $menu = array();
     foreach ($navigation as $tab) {
         $tab = $tab['main'];
         if (isset($tab['action'])) {
             $url = $baseUrl . '/' . $tab['controller'] . '/' . $tab['action'];
         } else {
             $url = $baseUrl . '/' . $tab['controller'];
         }
         if (isset($tab['active']) && $tab['active']) {
             $li = sprintf($this->_linkSelectedTemplate, $url, $tab['label']);
         } else {
             $li = sprintf($this->_linkTemplate, $url, $tab['label']);
         }
         $menu[] = $li;
     }
     $xhtml = '<ul id="nav" class="prefix_1">' . PHP_EOL . implode(PHP_EOL, $menu) . PHP_EOL . '</ul>';
     return $xhtml;
 }