<?php
/* Report all errors except E_NOTICE */
error_reporting(E_ALL ^ E_NOTICE);

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Menu;
use home\models\Announcement;

/* @var $this yii\web\View */

$noticeNavId = 298;
?>

<div class="navbar navbar-default navtop navbar-fixed-top" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
            <a class="navbar-brand logo" href="index.php"><?= (!empty($configs['web_name'])) ? $configs['web_name'] : '' ?></a> </div>

        <!-- Collect the nav links, forms, and other content for toggling -->

            <ul class="nav navbar-nav navlist">
                <?php
                $mainMenu = home\models\Menu::getMainMenus('home');
                if (!empty($mainMenu)) {
                    foreach ($mainMenu as $nav) {
                        echo "<li class=\"" .''. "\"><a href=\"" . Url::to([$nav['url'], 'nav_id' => $nav['menu_id']]) . "\">" . $nav['name'] . "</a></li>";
                    }
                }

//            echo Menu::widget([
//                'items' => qcbase\models\Menu::getAppNav(),
//                'options' => [
//                    'tag' => "ul class='nav navbar-nav navlist'"
//                ],
//                'activateParents' => true,
//            ]);
                ?>
            </ul>

           <!-- 现文字导航 -->
               <ul class="navbar-nav navbar-right nav-personal">
                    <li><a href="<?= Url::to(['/announcement/index-task', 'nav_id' => $noticeNavId]) ?>" class="notice" title="任务提醒"><i class="icon-tasks"></i><span id="task_amount">(0)</span></a></li>
                       <li><a href="<?= Url::to(['/announcement/index-receivable', 'nav_id' => $noticeNavId]) ?>" class="notice" title="回款提醒"><i class="icon-refresh"></i><span id="receivable_amount">(0)</span></a></li>
                    <li><a href="<?= Url::to(['/announcement/index', 'type' => 999, 'nav_id' => $noticeNavId]) ?>" class="notice" title="系统信息"><i class="icon-bell-alt icon-animated-bell"></i><span id="other_amount">(0)</span></a></li>
                    <li><a href="<?= Url::to(['/message/inbox', 'nav_id' => $noticeNavId]) ?>" class="notice" title="消息提醒"><i class="icon-envelope"></i><span id="message_amount">(0)</span></a></li>
                    <li>
                    <a href="#" class="information" data-toggle="dropdown" title="更多"><img src="<?= Yii::$app->session->get('user_avatar') ?>" > <span><?= \Yii::$app->user->identity->realname ?> <?php
                                $roles = Yii::$app->session->get('user_roles');
                                echo (!empty($roles)) ? '[' . implode(',', $roles) . ']' : '';
                                ?></span></a>
                        <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                        <li> <a  href="javascript:;" class="open-dialog" data-width='450' data-height='150'  data-url="<?= Url::to(['/user-portlet/create']) ?>" data-title='工作台 - 添加组件' data-redirect-url='<?= Yii::$app->getHomeUrl() ?>'> <i class="icon-cog"></i>添加组件</a> </li>
                            <li> <a  href="javascript:;" class="open-dialog" data-height='450'  data-url="<?= Url::to(['/site/info']) ?>" data-title='修改资料'> <i class="icon-cog"></i>修改资料</a> </li>
                            <li> <a href="javascript:;" class="open-dialog" data-height='200' data-width='400' data-url="<?= Url::to(['/site/repwd']) ?>" data-title='修改密码' >  <i class="icon-user"></i>修改密码</a> </li>
                            <li> <a href="<?= Url::to(['/public/logout']) ?>"> <i class="icon-off"></i>退出</a> </li>
                        </ul>
                    </li>
            </ul>

        </div>


<div class="nav-area" style="height:52px;"></div>
