-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainMenu.php
36 lines (27 loc) · 1007 Bytes
/
MainMenu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace yiioctopus\adminview;
use Yii;
use yii\bootstrap\Html;
class MainMenu extends \yii\bootstrap\Nav
{
/**
* Initializes the widget.
*/
public function init()
{
echo Html::beginTag('div',['class' => 'sidebar-nav']);
$Html = [];
foreach($this->items as $val)
{
$Html[] = Html::tag('li',Html::a($val['label'].Html::tag('i','',['class'=>'fa fa-collapse']),'javascript:void(0);',['data-target'=>'.'.$val['target'],'class'=>'nav-header collapsed','data-toggle'=>'collapse']));
$li = [];
foreach($val['items'] as $value)
{
$li[] = Html::tag('li',Html::a(Html::tag('span','',['class'=>'fa fa-caret-right']).' '.$value['label'],$value['url']),empty(array_diff($value['url'],$this->options['active']))?['class'=>'active']:[]);
}
$Html[] = Html::tag('ul',implode('',$li),['class'=>$val['target'].' nav nav-list collapse']);
}
echo Html::tag('ul',implode('',$Html));
echo Html::endTag('div');
}
}