Exemplo n.º 1
0
<!DOCTYPE HTML>
<html lang="en-US" ng-app="main">
<?php 
include "_head.php";
?>
<body ng-controller="MainController">
<nav class="navbar navbar-fixed-top navbar-main" role="navigation">
    <div class="container-full">
        <div class="navbar-collapse collapse">
            <?php 
try {
    $menu = $this->mainMenu;
} catch (CdbException $e) {
    $menu = [];
}
MenuTree::formatMenuItems($menu);
$this->widget('zii.widgets.CMenu', array('encodeLabel' => false, 'id' => 'mainmenu', 'activateParents' => true, 'htmlOptions' => array('class' => 'nav navbar-nav'), 'submenuHtmlOptions' => array('class' => 'dropdown-menu', 'role' => 'nav'), 'itemCssClass' => 'dropdown-submenu', 'itemTemplate' => '{menu}', 'items' => $menu));
?>
        </div>
        <!-- ./navbar-collapse -->
    </div>
    <!-- /.container-full -->
</nav>
<?php 
//if (Setting::$mode == "running" && !Yii::app()->user->isGuest) {
//    include("_widget.php");
//}
?>
<div id="content" ng-cloak
     class="<?php 
echo Setting::$mode == "running" && Yii::app()->user->isGuest ? 'no-widget' : '';
Exemplo n.º 2
0
 public static function formatMenuItems(&$list, $recursed = false)
 {
     foreach ($list as $k => $v) {
         if (@$v['icon'] != '') {
             $list[$k]['label'] = '<i class="fa fa-fw ' . $v['icon'] . '"></i> ' . $list[$k]['label'];
         }
         if ($v['label'] == '---') {
             $list[$k]['template'] = '<hr/>';
         }
         if (!isset($v['url'])) {
             $list[$k]['url'] = ['#'];
         } else {
             if (!is_array($v['url'])) {
                 if ($v['url'] == '#') {
                     $list[$k]['url'] = ['#'];
                 } else {
                     if (substr($v['url'], 0, 4) != 'http') {
                         $list[$k]['url'] = [str_replace(["\n", "\r"], "", str_replace('?', '&', $v['url']))];
                     }
                 }
             }
         }
         if (isset($v['items'])) {
             if (!$recursed) {
                 $list[$k]['label'] = ' <span class="caret"></span> ' . $list[$k]['label'];
             }
             MenuTree::formatMenuItems($list[$k]['items'], true);
         } else {
             $list[$k]['itemOptions'] = ['class' => 'no-menu'];
         }
     }
 }