示例#1
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\Widget::run()
  */
 public function run()
 {
     $output = '';
     $html = $this->getHtml();
     $config = Cfg::getApp('navbar');
     foreach ($config as $menus) {
         $main = array_shift($menus);
         if (!is_array($main)) {
             continue;
         }
         // 主菜单
         if (!$menus) {
             $output .= $html->tag('li', $this->getAttributes($main, false), $this->a($main)) . "\n";
             continue;
         }
         // 主菜单外开始标签
         $output .= $html->openTag('li', $this->getAttributes($main, true)) . "\n";
         $output .= $this->a($main, true) . "\n";
         // 下拉子菜单外开始标签
         $output .= $html->openTag('ul', array('class' => 'dropdown-menu')) . "\n";
         // 下拉子菜单列表
         $total = count($menus);
         $curr = 0;
         foreach ($menus as $menu) {
             $output .= $html->tag('li', array(), $this->a($menu)) . "\n";
             if (++$curr < $total) {
                 $output .= $html->tag('li', array('class' => 'divider'), '') . "\n";
             }
         }
         // 下拉子菜单外结束标签
         $output .= $html->closeTag('ul') . "\n";
         // 主菜单外结束标签
         $output .= $html->closeTag('li') . "\n";
     }
     $this->assign('is_login', Identity::isLogin());
     $this->assign('user_id', Identity::getUserId());
     $this->assign('login_name', Identity::getLoginName());
     $this->assign('user_name', Identity::getNickname());
     $this->assign('app_names', Identity::getAppNames());
     $this->assign('menus', $output);
     $this->assign('logout', $this->getView()->CFG_SYSTEM_GLOBAL_LOGOUT);
     $this->display();
 }