Esempio n. 1
0
 protected function render_item(&$next_id, $name, $cfg, $parent)
 {
     $menu = '';
     if ($parent == -1) {
         $menu .= Ext::menu_begin($name);
     }
     if (is_array($cfg)) {
         $cur_id = $next_id;
         $cur_menu = '';
         if ($parent != -1) {
             $cur_menu .= Ext::menu_row($next_id, $name, NULL, $parent);
         }
         $next_id++;
         $cur_menu_subitems = '';
         foreach ($cfg as $subname => $subcfg) {
             $cur_menu_subitems .= $this->render_item($next_id, $subname, $subcfg, $cur_id);
         }
         if (!empty($cur_menu_subitems)) {
             $menu .= $cur_menu . $cur_menu_subitems;
         }
     } else {
         if (ACL::is_route_allowed($cfg)) {
             $menu .= Ext::menu_row($next_id, $name, $cfg, $parent);
             if ($this->is_route_active($cfg)) {
                 $this->_active_id = $next_id;
             }
         }
         $next_id++;
     }
     if ($parent == -1) {
         $menu .= Ext::menu_end($this->_active_id);
     }
     return $menu;
 }