Inheritance: extends yii\base\Object
Esempio n. 1
0
 public static function get($title, $type)
 {
     $result = DB::table('global_blocks')->where('title', $title)->where('type', $type)->count();
     if ($result == 0) {
         DB::table('global_blocks')->insert(['title' => $title, 'type' => $type]);
     }
     $block = DB::table('global_blocks')->where('title', $title)->where('type', $type)->first();
     $menus = Menu::all();
     foreach ($menus as $row) {
         $pos = strpos($block->content, $row->tag);
         if ($pos !== false) {
             $navbar = new Nav($row->content, $row->type);
             $block->content = str_replace($row->tag, $navbar->get(), $block->content);
         }
     }
     return $block->content;
 }
Esempio n. 2
0
 /**
  * [Menu Top ]
  * @param  boolean para indicar el tipo de salida, json o array
  * @return [json o array]
  * Nota: el contenido del array interno de contener al menos route y text lo demas es opcional
  * //[route,text,cont(para badge), divider, class, icon  ]
  * Este menu carga el menu del Dashboard
  */
 public static function top($returnArray = false)
 {
     if (\Auth::guest()) {
         // invidados
         $menu = [['route' => '/auth/login', 'text' => trans('user.login'), 'divider' => 1], ['route' => '/auth/register', 'text' => trans('user.register')]];
     } else {
         // logeado
         $menu = Menu::dashboard(true);
         //-- Web Panel(Only for admim) --
         if (\Auth::check() && \Auth::user()->isAdmin()) {
             $menu = array_merge($menu, [['route' => '/wpanel', 'text' => trans('user.wpanel'), 'icon' => 'glyphicon glyphicon-cog', 'divider' => 1]]);
         }
         $menu[] = ['route' => '/auth/logout', 'text' => trans('user.logout'), 'icon' => 'glyphicon glyphicon-log-out'];
     }
     return $returnArray ? $menu : json_encode($menu);
 }
Esempio n. 3
0
echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>

<?php 
$this->beginBody();
?>
    <div class="wrap">
        <?php 
NavBar::begin(['brandLabel' => 'My Company', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => Menu::getItems()]);
NavBar::end();
?>

        <div class="container">
            <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
            <?php 
echo Alert::widget();
?>
            <?php 
echo $content;
?>
        </div>
    </div>
Esempio n. 4
0
?>
" data-action="get.modal"><i class="fa fa-lock fa-fw"></i> 更新密码</a>
            </li>
            <li class="divider"></li>
            <li><a href="<?php 
echo Url::toRoute(['/site/logout']);
?>
" data-pjax="0" data-method="post"><i class="fa fa-sign-out fa-fw"></i> 注销</a>
            </li>
          </ul>
        </li>
      </ul>
      <div class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
          <?php 
$m = new Menu();
$menus = $m->menus($m->acls);
$tabs = array_keys($menus);
$panels = array_values($menus);
$i = 0;
?>
          <table>
            <tr>
              <td class="td-tabs">
                <ul class="nav nav-tabs tabs-left">
                  <?php 
foreach ($tabs as $tab) {
    ?>
                  <li <?php 
    if ($i == 0) {
        ?>