sidebar.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. use yii\helpers\Html;
  3. $profile = Yii::$app->user->identity->profile;
  4. ?>
  5. <aside class="main-sidebar sidebar-dark-primary elevation-4">
  6. <!-- Brand Logo -->
  7. <a href="/manager/" class="brand-link">
  8. <img src="/img/icon-180x180.png" alt="Amitel Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
  9. <span class="brand-text font-weight-light">Amitel admin 3</span>
  10. </a>
  11. <!-- Sidebar -->
  12. <div class="sidebar">
  13. <!-- Sidebar user panel (optional) -->
  14. <div class="user-panel mt-3 pb-3 mb-3 d-flex">
  15. <div class="image">
  16. <?/*=Html::img($profile->getAvatarUrl($profile->gravatar_id), [
  17. 'class' => 'img-circle elevation-2',
  18. 'alt' => $profile->user->username,
  19. ]) */?>
  20. </div>
  21. <div class="info">
  22. <a href="#" class="d-block"><?=$profile->name?></a>
  23. </div>
  24. </div>
  25. <!-- SidebarSearch Form -->
  26. <!-- href be escaped -->
  27. <!-- <div class="form-inline">
  28. <div class="input-group" data-widget="sidebar-search">
  29. <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
  30. <div class="input-group-append">
  31. <button class="btn btn-sidebar">
  32. <i class="fas fa-search fa-fw"></i>
  33. </button>
  34. </div>
  35. </div>
  36. </div> -->
  37. <!-- Sidebar Menu -->
  38. <nav class="mt-2 nav-flat">
  39. <?php
  40. echo \hail812\adminlte\widgets\Menu::widget([
  41. 'options' => ['Class' => 'nav nav-pills nav-sidebar nav-child-indent flex-column'],
  42. 'items' => [
  43. ['label' => 'Login', 'url' => ['site/login'], 'icon' => 'sign-in-alt', 'visible' => Yii::$app->user->isGuest],
  44. [
  45. 'label' => 'Новости',
  46. 'icon' => 'newspaper',
  47. 'url' => ['/manager/news/list'],
  48. // 'badge' => '<span class="right badge badge-info">2</span>',
  49. 'options' => ['class' => 'nav-item menu-open'],
  50. 'items' => [
  51. ['label' => 'День', 'url' => ['/manager/news/list'], 'iconStyle' => 'far'],
  52. ['label' => 'В очереди', 'url' => ['/manager/news/inactive'], 'iconStyle' => 'far', 'iconClassAdded'=>'fa-clock'],
  53. ['label' => 'Создать', 'url' => ['/manager/news/create'], 'iconStyle' => 'fas', 'iconClassAdded'=>'','icon' => 'pen-nib'],
  54. ]
  55. ],
  56. [
  57. 'label' => 'Комментарии',
  58. 'url' => ['/manager/comments/index'],
  59. 'icon' => 'comments',
  60. 'badge' => '<span class="right badge badge-danger">'.\manager\models\Comments::find()->andWhere(['visible'=>"N"])->count().'</span>',
  61. 'items' => [
  62. ['label' => 'Настройки', 'url' => ['/manager/comments/conf'], 'iconStyle' => 'fa', 'iconClassAdded'=>'','icon' => 'wrench'],
  63. ]
  64. ],
  65. [
  66. 'label' => 'Главная стр.',
  67. 'icon' => 'tachometer-alt',
  68. 'url' => ['/manager/design/blocks'],
  69. // 'badge' => '<span class="right badge badge-info">2</span>',
  70. 'items' => [
  71. ['label' => 'Блоки на главной', 'url' => ['/manager/design/blocks'], 'iconStyle' => 'far'],
  72. ['label' => 'Создать Блок', 'url' => ['/manager/design/create'], 'iconStyle' => 'far'],
  73. ['label' => 'КД блок', 'url' => ['/manager/kd'], 'iconStyle' => 'far', 'iconClass' => 'nav-icon far fa-circle text-warning'],
  74. ['label' => 'НЧ блок ', 'url' => ['/manager/nh'], 'iconStyle' => 'far', 'iconClassAdded' => 'text-danger'],
  75. ['label' => 'Слайдер', 'url' => ['/manager/top-slider'], 'iconStyle' => 'far', 'iconClassAdded' => 'text-primary'],
  76. ['label' => 'Сброс кэша главной', 'url' => ['/manager/design/purge'], 'iconStyle' => 'fa', 'iconClassAdded' => 'fa-shower','badge' => '<span class="right badge badge-danger">New</span>'],
  77. ]
  78. ],
  79. ['label' => 'Рубрики', 'icon' => 'th', 'url' => ['/manager/news/topiclist'],
  80. 'items' => [
  81. ['label' => 'Список', 'url' => ['/manager/news/topiclist'], 'iconStyle' => 'far'],
  82. ['label' => 'Создать', 'url' => ['/manager/news/topiccreate'], 'iconStyle' => 'far'],
  83. ['label' => 'Все', 'url' => ['/manager/news/topicall'], 'iconStyle' => 'far'],
  84. ]
  85. ],
  86. ['label' => 'Сюжеты', 'icon' => 'th', 'url' => ['/manager/news/storylist'],
  87. 'items' => [
  88. ['label' => 'Список', 'url' => ['/manager/news/storylist'], 'iconStyle' => 'far'],
  89. ['label' => 'Создать', 'url' => ['/manager/news/storycreate'], 'iconStyle' => 'far']
  90. ]
  91. ],
  92. ['label' => 'Тэги', 'icon' => 'th', 'url' => ['/manager/tags/index'],
  93. 'items' => [
  94. ['label' => 'Список', 'url' => ['/manager/tags/index'], 'iconStyle' => 'far'],
  95. ['label' => 'Создать', 'url' => ['/manager/tags/create'], 'iconStyle' => 'far'],
  96. ['label' => 'Меню', 'url' => ['/manager/tagsfilter/index'], 'iconStyle' => 'far', 'iconClass'=>'nav-icon fas fa-th-list']
  97. ]
  98. ],
  99. ['label' => 'Опросы', 'icon' => 'thumbs-up', 'url' => ['/manager/inquirer/'],
  100. 'badge' => '<span class="right badge badge-danger">New</span>',
  101. 'items' => [
  102. ['label' => 'Список опросов', 'url' => ['/manager/inquirer/index'], 'iconStyle' => 'far'],
  103. ['label' => 'Создать', 'url' => ['/manager/inquirer/create'], 'iconStyle' => 'far'],
  104. ]
  105. ],
  106. ['label' => 'Статистика', 'icon' => 'chart-pie', 'url' => ['/manager/stats/index'],
  107. 'items' => [
  108. ['label' => 'доска', 'url' => ['/manager/stats/index'], 'iconStyle' => 'fas', 'icon'=>'tachometer-alt'],
  109. ['label' => 'Авторы', 'url' => ['/manager/stats/authors'], 'iconStyle' => 'far', 'icon'=>'user-circle'],
  110. ['label' => 'Автор по дням', 'url' => ['/manager/stats/authorsd'], 'iconStyle' => 'far', 'icon'=>'user']
  111. ]
  112. ],
  113. ['label' => 'Персоны','icon' => 'user', 'url' => ['/manager/person/']
  114. ],
  115. ['label' => 'Авторы','icon' => 'user', 'url' => ['/manager/authors/'],'badge' => '<span class="right badge badge-danger">New</span>'
  116. ],
  117. ['label' => 'пользователи', 'icon' => 'user', 'url' => ['/user/admin/index'], 'visible' => Yii::$app->user->can('view_manage_users_page'),
  118. 'items' => [
  119. ['label' => 'Список', 'iconStyle' => 'far fa-solid fa-user', 'url' => ['/user/admin/index']],
  120. ['label' => 'Новый', 'iconStyle' => 'far fa-user', 'url' => ['/user/admin/create']]
  121. ]
  122. ],
  123. ['label' => 'Страницы', 'icon' => 'file', 'url' => ['/manager/page'],
  124. ],
  125. ['label' => 'Yii2 PROVIDED', 'header' => true],
  126. ['label' => 'Gii', 'icon' => 'file-code', 'url' => ['/gii'], 'target' => '_blank'],
  127. ['label' => 'Debug', 'icon' => 'bug', 'url' => ['/debug'], 'target' => '_blank'],
  128. ['label' => 'Test', 'icon' => 'bug', 'url' => ['/manager/news/test'], 'target' => '_blank'],
  129. ],
  130. ]);
  131. ?>
  132. </nav>
  133. <!-- /.sidebar-menu -->
  134. </div>
  135. <!-- /.sidebar -->
  136. </aside>
  137. <script>
  138. var url = String(window.location);
  139. $('ul.nav-sidebar a').filter(function() {
  140. // console.log(url+'-'+this.href.indexOf('kd')+':'+url.indexOf("design"));
  141. if( this.href.indexOf('design') >= 0 && ( url.indexOf("kd") >= 0 || url.indexOf("nh") >= 0 || url.indexOf("top-slider") >= 0 ) ) return true;
  142. if( this.href.indexOf('tags') >= 0 && ( url.indexOf("tagsfilter") >= 0 ) ) return true;
  143. return this.href == url;
  144. }).parent().addClass('menu-open');
  145. </script>