sidebar.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. 'badge' => '<span class="right badge badge-danger">New</span>',
  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' => 'th', 'url' => ['/manager/stats/index'],
  101. 'items' => [
  102. ['label' => 'доска', 'url' => ['/manager/stats/index'], 'iconStyle' => 'far'],
  103. ['label' => 'Авторы', 'url' => ['/manager/stats/authors'], 'iconStyle' => 'far']
  104. ]
  105. ],
  106. ['label' => 'Персоны','icon' => 'user', 'url' => ['/manager/person/'],'badge' => '<span class="right badge badge-danger">New</span>',
  107. ],
  108. ['label' => 'Авторы','icon' => 'user', 'url' => ['/manager/authors/']
  109. ],
  110. ['label' => 'пользователи', 'icon' => 'user', 'url' => ['/user/admin/index'], 'visible' => Yii::$app->user->can('view_manage_users_page'),
  111. 'items' => [
  112. ['label' => 'Список', 'iconStyle' => 'far fa-solid fa-user', 'url' => ['/user/admin/index']],
  113. ['label' => 'Новый', 'iconStyle' => 'far fa-user', 'url' => ['/user/admin/create']]
  114. ]
  115. ],
  116. ['label' => 'Страницы', 'icon' => 'file', 'url' => ['/manager/page'],
  117. ],
  118. ['label' => 'Yii2 PROVIDED', 'header' => true],
  119. ['label' => 'Gii', 'icon' => 'file-code', 'url' => ['/gii'], 'target' => '_blank'],
  120. ['label' => 'Debug', 'icon' => 'bug', 'url' => ['/debug'], 'target' => '_blank'],
  121. ['label' => 'Test', 'icon' => 'bug', 'url' => ['/manager/news/test'], 'target' => '_blank'],
  122. ],
  123. ]);
  124. ?>
  125. </nav>
  126. <!-- /.sidebar-menu -->
  127. </div>
  128. <!-- /.sidebar -->
  129. </aside>
  130. <script>
  131. var url = String(window.location);
  132. $('ul.nav-sidebar a').filter(function() {
  133. // console.log(url+'-'+this.href.indexOf('kd')+':'+url.indexOf("design"));
  134. if( this.href.indexOf('design') >= 0 && ( url.indexOf("kd") >= 0 || url.indexOf("nh") >= 0 || url.indexOf("top-slider") >= 0 ) ) return true;
  135. if( this.href.indexOf('tags') >= 0 && ( url.indexOf("tagsfilter") >= 0 ) ) return true;
  136. return this.href == url;
  137. }).parent().addClass('menu-open');
  138. </script>