sidebar.php 9.5 KB

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