Blame view

backend/views/layouts/main-sidebar.php 12.9 KB
d8c1a2e0   Yarik   Big commit artbox
1
2
3
4
5
6
7
8
  <?php

  use yii\helpers\Url;

  use yii\widgets\Menu;

  ?>

  <aside class="main-sidebar">

      <!-- sidebar: style can be found in sidebar.less -->

      <section class="sidebar">

          <?php

d8c1a2e0   Yarik   Big commit artbox
9
10
11
12
13
14
15
16
17
18
19
20
21
          $items = [

              [

                  'label' => 'Заказы',

                  'url' => ['/orders/index'],

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-shopping-cart"></i> <span>{label}</span></a>',

                  'options' => ['class'=>\Yii::$app->user->can('orders') ? '' :'hide'],

              ],

              [

                  'label' => 'eCommerce',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-barcode"></i> <span>{label}</span></a>',

                  'url' => ['/product/manage'],

                  'active' => preg_match('/^manage.*$/', $this->context->id) ||

                              preg_match('/^category.*$/', $this->context->id) ||

e0205ce9   Alexey Boroda   -Delivery model p...
22
                              preg_match('/^delivery.*$/', $this->context->id) ||

7975da13   Alexey Boroda   -Label model pret...
23
                              preg_match('/^label.*$/', $this->context->id) ||

d8c1a2e0   Yarik   Big commit artbox
24
25
26
27
28
29
30
31
32
33
                              preg_match('/^brand.*$/', $this->context->id) ||

                              preg_match('/^product-unit.*$/', $this->context->id) ||

                              preg_match('/^import.*$/', $this->context->id) ||

                              preg_match('/^tax-group.*$/', $this->context->id) ||

                              preg_match('/^export.*$/', $this->context->id) ? true : false,

                  'options' => ['class'=>\Yii::$app->user->can('product') || \Yii::$app->user->can('category') || \Yii::$app->user->can('brand') || \Yii::$app->user->can('rubrication')  ? '' :'hide'],

                  'items' => [

                      [

                          'label' => 'Товары',

                          'url' => ['/product/manage'],

b7d40aed   Yarik   Another one admin...
34
35
                          'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],

                          'active' => preg_match('/^manage.*$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
36
                      ],

e0205ce9   Alexey Boroda   -Delivery model p...
37
38
39
                      [

                          'label' => 'Доставка',

                          'url' => ['/delivery'],

b7d40aed   Yarik   Another one admin...
40
41
                          'options' => ['class'=>\Yii::$app->user->can('delivery') ? '' :'hide'],

                          'active' => preg_match('/^delivery.*$/', $this->context->id),

e0205ce9   Alexey Boroda   -Delivery model p...
42
                      ],

d8c1a2e0   Yarik   Big commit artbox
43
                      [

7975da13   Alexey Boroda   -Label model pret...
44
45
                          'label' => 'Статус товара',

                          'url' => ['/label'],

b7d40aed   Yarik   Another one admin...
46
47
                          'options' => ['class'=>\Yii::$app->user->can('label') ? '' :'hide'],

                          'active' => preg_match('/^label.*$/', $this->context->id),

7975da13   Alexey Boroda   -Label model pret...
48
49
                      ],

                      [

d8c1a2e0   Yarik   Big commit artbox
50
51
52
                          'label' => 'Категории',

                          'url' => ['/category'],

                          'options' => ['class'=>\Yii::$app->user->can('category') ? '' :'hide'],

99e2f4e7   Yarik   Category to purpo...
53
                          'active' => preg_match('/^category[\/.*]?$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
54
55
56
57
58
                      ],

                      [

                          'label' => 'Бренды',

                          'url' => ['/brand'],

                          'options' => ['class'=>\Yii::$app->user->can('brand') ? '' :'hide'],

b7d40aed   Yarik   Another one admin...
59
                          'active' => preg_match('/^brand.*$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
60
61
62
63
64
                      ],

                      [

                          'label' => 'Единицы измерения',

                          'url' => ['/product/product-unit'],

                          'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],

b7d40aed   Yarik   Another one admin...
65
                          'active' => preg_match('/^product-unit.*$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
66
67
68
69
70
                      ],

                      [

                          'label' => 'Импорт товаров',

                          'url' => ['/product/manage/import'],

                          'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],

b7d40aed   Yarik   Another one admin...
71
                          'active' => preg_match('/^import.*$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
72
73
74
75
76
                      ],

                      [

                          'label' => 'Экспорт товаров',

                          'url' => ['/product/manage/export'],

                          'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],

b7d40aed   Yarik   Another one admin...
77
                          'active' => preg_match('/^export.*$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
78
79
80
81
82
                      ],

                      [

                          'label' => 'Характеристики Товаров',

                          'url' => Url::toRoute(['/rubrication/tax-group', 'level'=> '0']),

                          'options' => ['class'=>\Yii::$app->user->can('rubrication') ? '' :'hide'],

b031c613   Yarik   Admin menu decision
83
                          'active' => preg_match('/^tax-group.*$/', $this->context->id) && (\Yii::$app->request->getQueryParam('level') == 0),

d8c1a2e0   Yarik   Big commit artbox
84
85
86
87
88
                      ],

                      [

                          'label' => 'Характеристики Модификаций',

                          'url' => Url::toRoute(['/rubrication/tax-group', 'level'=> '1']),

                          'options' => ['class'=>\Yii::$app->user->can('rubrication') ? '' :'hide'],

b031c613   Yarik   Admin menu decision
89
                          'active' => preg_match('/^tax-group.*$/', $this->context->id) && (\Yii::$app->request->getQueryParam('level') == 1),

99e2f4e7   Yarik   Category to purpo...
90
91
92
93
94
95
                      ],

                      [

                          'label' => 'Изображения категорий',

                          'url' => Url::toRoute(['/category-to-purpose']),

                          'options' => ['class'=>\Yii::$app->user->can('category-to-purpose') ? '' :'hide'],

                          'active' => preg_match('/^category-to-purpose.*$/', $this->context->id),

d8c1a2e0   Yarik   Big commit artbox
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
                      ]

                  ]

              ],

              [

                  'label' => 'Слайдер/Банеры',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-picture"></i> <span>{label}</span></a>',

                  'options' => ['class'=>\Yii::$app->user->can('banner') || \Yii::$app->user->can('slider') ? '' :'hide'],

                  'active' => preg_match('/^slider.*$/', $this->context->id) || preg_match('/^banner.*$/', $this->context->id) ? true : false,

                  'items' => [

                      [

                          'label' => 'Слайдер',

                          'url' => ['/slider/index'],

                          'options' => ['class'=>\Yii::$app->user->can('slider') ? '' :'hide'],

                      ],

                      [

                          'label' => 'Банер',

                          'url' => ['/banner/index'],

                          'options' => ['class'=>\Yii::$app->user->can('banner') ? '' :'hide'],

                      ],

                  ]

              ],

              [

                  'label' => 'Текстовые страницы',

                   'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-duplicate"></i> <span>{label}</span></a>',

                  'url' => ['/page/index'],

cc658b4c   Yarik   Big commit
121
                  'options' => ['class'=>\Yii::$app->user->can('page') ? '' :'hide'],

d8c1a2e0   Yarik   Big commit artbox
122
123
              ],

              [

36d1807a   Yarik   Big commit.
124
125
126
                  'label' => 'Проекты',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-pencil"></i> <span>{label}</span></a>',

                  'url' => ['/project'],

cc658b4c   Yarik   Big commit
127
                  'options' => ['class'=>\Yii::$app->user->can('project') ? '' :'hide'],

36d1807a   Yarik   Big commit.
128
129
              ],

              [

d8c1a2e0   Yarik   Big commit artbox
130
131
132
133
134
135
                  'label' => 'Статьи',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-pencil"></i> <span>{label}</span></a>',

                  'url' => ['/articles/index'],

                  'options' => ['class'=>\Yii::$app->user->can('articles') ? '' :'hide'],

              ],

              [

cc658b4c   Yarik   Big commit
136
137
138
139
140
141
                  'label' => 'Сертификаты',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-pencil"></i> <span>{label}</span></a>',

                  'url' => ['/certificate'],

                  'options' => ['class'=>\Yii::$app->user->can('certificate') ? '' :'hide'],

              ],

              [

d8c1a2e0   Yarik   Big commit artbox
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
                  'label' => 'Акции',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-piggy-bank"></i> <span>{label}</span></a>',

                  'url' => ['/event/index'],

                  'options' => ['class'=>\Yii::$app->user->can('event') ? '' :'hide'],

              ],

              [

                  'label' => 'SEO',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>',

                  'active' => preg_match('/^seo.*$/', $this->context->id) || preg_match('/^seo-category.*$/', $this->context->id) ? true : false,

                  'options' => ['class'=>\Yii::$app->user->can('seo') || \Yii::$app->user->can('seo-category') ? '' :'hide'],

                  'items' => [

                      [

                          'label' => 'URL',

                          'url' => ['/seo/index'],

                          'options' => ['class'=>\Yii::$app->user->can('seo') ? '' :'hide'],

                      ],

                      [

                          'label' => 'Шаблоны',

                          'url' => ['/seo-category/index'],

                          'options' => ['class'=>\Yii::$app->user->can('seo-category') ? '' :'hide'],

                      ]

                  ]

              ],

  

              [

                  'label' => 'Фон',

                  'url' => ['/bg/index'],

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-picture"></i> <span>{label}</span></a>',

                  'options' => ['class'=>\Yii::$app->user->can('bg')? '' :'hide']

              ],

              [

d8c1a2e0   Yarik   Big commit artbox
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-user"></i> <span>{label}</span></a>',

                  'label' => 'Пользователи',

                  'url' => ['/customer/index'],

                  'options' => ['class'=>\Yii::$app->user->can('customer') ? '' :'hide'],

              ],

              [

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-comment"></i> <span>{label}</span></a>',

                  'label' => 'Комментарии',

                  'url' => ['/artbox-comments'],

                  'options' => ['class'=>\Yii::$app->user->can('artbox-comments') ? '' :'hide'],

              ],

              [

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-comment"></i> <span>{label}</span></a>',

                  'label' => 'Обратная связь',

                  'url' => ['/feedback'],

                  'options' => ['class'=>\Yii::$app->user->can('feedback') ? '' :'hide'],

              ],

              [

                  'label' => 'Настройка ролей',

                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-cog"></i> <span>{label}</span></a>',

                  'active' => preg_match('/^user.*$/', $this->context->id)

                              || preg_match('/^access.*$/', $this->context->id) ? true : false,

                  'options' => ['class'=>\Yii::$app->user->can('user') || \Yii::$app->user->can('user') || \Yii::$app->user->can('permit')  ? '' :'hide'],

                  'items' => [

                      [

                          'label' => 'Администраторы',

                          'url' => ['/user/index'],

                          'options' => ['class'=>\Yii::$app->user->can('user') ? '' :'hide'],

                      ],

                      [

                          'label' => 'управление ролями',

                          'url' => ['/permit/access/role'],

                          'options' => ['class'=>\Yii::$app->user->can('permit') ? '' :'hide'],

                      ],

                      [

                          'label' => 'управление правами доступа',

                          'url' => ['/permit/access/permission'],

                          'options' => ['class'=>\Yii::$app->user->can('permit') ? '' :'hide'],

                      ]

                  ]

              ],

  

  

  

          ];

  

  

          if (Yii::$app->user->isGuest) {

              array_push($items,

                  ['label' => 'Signup', 'url' => ['/admin/site/signup']], ['label' => 'Login', 'url' => ['/admin/site/login']]

              );

          } else {

              array_push($items,

                  [

                      'label' => 'Logout (' . Yii::$app->user->identity->username . ')',

                      'url'=>'/admin/site/logout',

                      'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-log-out"></i> <span>{label}</span></a>',

                  ]

              );

          }

          echo Menu::widget([

              'options' => ['class' => 'sidebar-menu'],

              'submenuTemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n",

d8c1a2e0   Yarik   Big commit artbox
236
237
238
239
240
241
242
243
244
              'items' =>$items,

  

          ]);

          ?>

          <!-- sidebar menu: : style can be found in sidebar.less -->

  

      </section>

      <!-- /.sidebar -->

  </aside>