Esempio n. 1
0
 public static function getMenu($roleId, $parentId = NULL)
 {
     $output = [];
     foreach (Menu::find()->where(["parent_id" => $parentId])->all() as $menu) {
         $obj = ["label" => $menu->name, "icon" => $menu->icon, "url" => SidebarMenu::getUrl($menu), "visible" => SidebarMenu::roleHasAccess($roleId, $menu->id)];
         if (count($menu->menus) != 0) {
             $obj["items"] = SidebarMenu::getMenu($roleId, $menu->id);
         }
         $output[] = $obj;
     }
     return $output;
 }
Esempio n. 2
0
                <p><?php 
echo Yii::$app->user->identity->name;
?>
</p>

                <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
            </div>
        </div>

        <!-- search form -->
        <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search..."/>
              <span class="input-group-btn">
                <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
            </div>
        </form>
        <!-- /.search form -->
        <?php 
$items = \app\components\SidebarMenu::getMenu(Yii::$app->user->identity->role_id);
?>
        <?php 
echo dmstr\widgets\Menu::widget(['options' => ['class' => 'sidebar-menu'], 'items' => $items]);
?>

    </section>

</aside>