sidebar.php 10 KB

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