sidebar.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. ['label' => 'Заги фоток', 'url' => ['/manager/news/phototitle'], 'iconStyle' => 'fas', 'iconClassAdded'=>'','icon' => 'far fa-image', 'badge' => '<span class="right badge badge-danger">New</span>'],
  59. ['label' => 'Пустые заги фоток', 'url' => ['/manager/news/searchtitlenull'], 'iconStyle' => 'fas', 'iconClassAdded'=>'','icon' => 'far fa-image', 'badge' => '<span class="right badge badge-danger">New</span>'],
  60. ]
  61. ],
  62. [
  63. 'label' => 'Комментарии',
  64. 'url' => ['/manager/comments/index'],
  65. 'icon' => 'comments',
  66. 'badge' => '<span class="right badge badge-danger">'.\manager\models\Comments::find()->andWhere(['visible'=>"N"])->count().'</span>',
  67. 'items' => [
  68. ['label' => 'Настройки', 'url' => ['/manager/comments/conf'], 'iconStyle' => 'fa', 'iconClassAdded'=>'','icon' => 'wrench'],
  69. ['label' => 'Фильтры', 'url' => ['/manager/comments-filter'], 'iconStyle' => 'fa', 'iconClassAdded'=>'','icon' => 'wrench',],
  70. ]
  71. ],
  72. [
  73. 'label' => 'Главная стр.',
  74. 'icon' => 'tachometer-alt',
  75. 'url' => ['/manager/design/blocks'],
  76. // 'badge' => '<span class="right badge badge-info">2</span>',
  77. 'items' => [
  78. ['label' => 'Блоки на главной', 'url' => ['/manager/design/blocks'], 'iconStyle' => 'far'],
  79. ['label' => 'Создать Блок', 'url' => ['/manager/design/create'], 'iconStyle' => 'far'],
  80. ['label' => 'КД блок', 'url' => ['/manager/kd'], 'iconStyle' => 'far', 'iconClass' => 'nav-icon far fa-circle text-warning'],
  81. ['label' => 'НЧ блок ', 'url' => ['/manager/nh'], 'iconStyle' => 'far', 'iconClassAdded' => 'text-danger'],
  82. ['label' => 'Слайдер', 'url' => ['/manager/top-slider'], 'iconStyle' => 'far', 'iconClassAdded' => 'text-primary'],
  83. ['label' => 'Сброс кэша главной', 'url' => ['/manager/design/purge'], 'iconStyle' => 'fa', 'iconClassAdded' => 'fa-shower'],
  84. ]
  85. ],
  86. ['label' => 'Рубрики', 'icon' => 'th', 'url' => ['/manager/news/topiclist'],
  87. 'items' => [
  88. ['label' => 'Список', 'url' => ['/manager/news/topiclist'], 'iconStyle' => 'far'],
  89. ['label' => 'Создать', 'url' => ['/manager/news/topiccreate'], 'iconStyle' => 'far'],
  90. ['label' => 'Все', 'url' => ['/manager/news/topicall'], 'iconStyle' => 'far'],
  91. ]
  92. ],
  93. ['label' => 'Сюжеты', 'icon' => 'th', 'url' => ['/manager/news/storylist'],
  94. 'items' => [
  95. ['label' => 'Список', 'url' => ['/manager/news/storylist'], 'iconStyle' => 'far'],
  96. ['label' => 'Создать', 'url' => ['/manager/news/storycreate'], 'iconStyle' => 'far']
  97. ]
  98. ],
  99. ['label' => 'Тэги', 'icon' => 'th', 'url' => ['/manager/tags/index'],
  100. 'items' => [
  101. ['label' => 'Список', 'url' => ['/manager/tags/index'], 'iconStyle' => 'far'],
  102. ['label' => 'Создать', 'url' => ['/manager/tags/create'], 'iconStyle' => 'far'],
  103. ['label' => 'Меню', 'url' => ['/manager/tagsfilter/index'], 'iconStyle' => 'far', 'iconClass'=>'nav-icon fas fa-th-list']
  104. ]
  105. ],
  106. ['label' => 'Опросы', 'icon' => 'thumbs-up', 'url' => ['/manager/inquirer/'],
  107. 'items' => [
  108. ['label' => 'Список опросов', 'url' => ['/manager/inquirer/index'], 'iconStyle' => 'far'],
  109. ['label' => 'Создать', 'url' => ['/manager/inquirer/create'], 'iconStyle' => 'far'],
  110. ]
  111. ],
  112. ['label' => 'Статистика', 'icon' => 'chart-pie', 'url' => ['/manager/stats/index'],
  113. 'badge' => '<span class="right badge badge-danger">New</span>',
  114. 'items' => [
  115. ['label' => 'доска', 'url' => ['/manager/stats/index'], 'iconStyle' => 'fas', 'icon'=>'tachometer-alt'],
  116. ['label' => 'Авторы', 'url' => ['/manager/stats/authors'], 'iconStyle' => 'far', 'icon'=>'user-circle'],
  117. ['label' => 'Автор по дням', 'url' => ['/manager/stats/authorsd'], 'iconStyle' => 'far', 'icon'=>'user'],
  118. ['label' => 'Аналитика за месяц', 'url' => ['/manager/analytics'], 'iconStyle' => 'fas', 'icon'=>'chart-pie', 'badge' => '<span class="right badge badge-danger">New</span>',],
  119. ['label' => 'Аналитика контента', 'url' => ['/manager/analytics/rate/'], 'iconStyle' => 'fas', 'icon'=>'chart-pie', 'badge' => '<span class="right badge badge-danger">New</span>',],
  120. ]
  121. ],
  122. ['label' => 'Персоны','icon' => 'user', 'url' => ['/manager/person/']
  123. ],
  124. ['label' => 'Авторы','icon' => 'user', 'url' => ['/manager/authors/'],
  125. ],
  126. ['label' => 'пользователи', 'icon' => 'user', 'url' => ['/user/admin/index'], 'visible' => Yii::$app->user->can('view_manage_users_page'),
  127. 'items' => [
  128. ['label' => 'Список', 'iconStyle' => 'far fa-solid fa-user', 'url' => ['/user/admin/index']],
  129. ['label' => 'Новый', 'iconStyle' => 'far fa-user', 'url' => ['/user/admin/create']]
  130. ]
  131. ],
  132. ['label' => 'Страницы', 'icon' => 'file', 'url' => ['/manager/page'],
  133. ],
  134. ['label' => 'Tilda', 'icon' => 'fas fa-copy', 'url' => ['/manager/tilda/view'],
  135. 'items' => [
  136. ['label' => 'Экспорт', 'icon' => 'fas fa-copy', 'url' => ['/manager/tilda/index']],
  137. ['label' => 'Проекты на сайте', 'icon' => 'fas fa-book', 'url' => ['/manager/tilda/view']],
  138. ]
  139. ],
  140. ['label' => 'Документы', 'icon' => 'fas fa-book', 'url' => ['/manager/docs'],
  141. ],
  142. ['label' => 'Старые фоторепы', 'icon' => 'far fa-image', 'url' => ['/manager/report-topic'],
  143. ],
  144. ['label' => 'Yii2 PROVIDED', 'header' => true, 'visible' => YII_ENV_DEV],
  145. ['label' => 'Gii', 'icon' => 'file-code', 'url' => ['/gii'], 'target' => '_blank', 'visible' => YII_ENV_DEV],
  146. ['label' => 'Debug', 'icon' => 'bug', 'url' => ['/debug'], 'target' => '_blank', 'visible' => YII_ENV_DEV],
  147. ['label' => 'Test', 'icon' => 'bug', 'url' => ['/manager/news/test'], 'target' => '_blank', 'visible' => YII_ENV_DEV],
  148. ],
  149. ]);
  150. ?>
  151. </nav>
  152. <!-- /.sidebar-menu -->
  153. </div>
  154. <!-- /.sidebar -->
  155. </aside>
  156. <script>
  157. var url = String(window.location);
  158. $('ul.nav-sidebar a').filter(function() {
  159. // console.log(url+'-'+this.href.indexOf('kd')+':'+url.indexOf("design"));
  160. if( this.href.indexOf('design') >= 0 && ( url.indexOf("kd") >= 0 || url.indexOf("nh") >= 0 || url.indexOf("top-slider") >= 0 ) ) return true;
  161. if( this.href.indexOf('tags') >= 0 && ( url.indexOf("tagsfilter") >= 0 ) ) return true;
  162. if( this.href.indexOf('comments') >= 0 && ( url.indexOf("comments-filter") >= 0 ) ) return true;
  163. if( this.href.indexOf('stats') >= 0 && ( url.indexOf("analytics") >= 0 ) ) return true;
  164. return this.href == url;
  165. }).parent().addClass('menu-open');
  166. </script>