Blame view

backend/views/layouts/main-sidebar.php 10.1 KB
3f2bc3d0   Administrator   first commit
1
2
3
4
5
6
  <?php

  use yii\widgets\Menu;

  ?>

  <aside class="main-sidebar">

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

      <section class="sidebar">

2ffff539   Administrator   проапдейтил роли
7
          <?php

4994ab9e   Eugeny Galkovskiy   150616
8
9
  //print_r($this->context->id);

  //        die();

2ffff539   Administrator   проапдейтил роли
10
11
  

          $items = [

1aebc681   Administrator   image size
12
13
14
15
16
17
              [

                  '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'],

              ],

2ffff539   Administrator   проапдейтил роли
18
19
20
21
              [

                  'label' => 'eCommerce',

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

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

4994ab9e   Eugeny Galkovskiy   150616
22
23
24
25
26
27
28
                  'active' => preg_match('/^manage.*$/', $this->context->id) ||

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

                              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,

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

2ffff539   Administrator   проапдейтил роли
30
                  'items' => [

1aebc681   Administrator   image size
31
32
33
34
35
36
                      [

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

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

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

                      ],

                      [

a0be9a4d   Karnovsky A   30062016
37
38
39
40
41
                          'label' => 'Модификации',

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

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

                      ],

                      [

1aebc681   Administrator   image size
42
43
                          'label' => 'Категории',

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

4994ab9e   Eugeny Galkovskiy   150616
44
45
                          'options' => ['class'=>\Yii::$app->user->can('category') ? '' :'hide'],

  

1aebc681   Administrator   image size
46
47
48
49
50
51
52
                      ],

                      [

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

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

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

                      ],

                      [

1aebc681   Administrator   image size
53
54
55
56
57
                          'label' => 'Единицы измерения',

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

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

                      ],

                      [

8724ec1f   Karnovsky A   -
58
59
                          'label' => 'Импорт товаров',

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

1aebc681   Administrator   image size
60
61
                          'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],

                      ],

c7852657   Karnovsky A   -
62
63
64
65
66
                      [

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

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

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

                      ],

4994ab9e   Eugeny Galkovskiy   150616
67
68
69
70
71
72
73
74
75
76
                      [

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

                          'url' => ['/rubrication/tax-group'],

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

                      ],

                      [

                          'label' => 'Зависимости',

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

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

                      ]

2ffff539   Administrator   проапдейтил роли
77
78
79
80
                  ]

              ],

              [

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

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

090dfe5b   Administrator   image size
82
                  'options' => ['class'=>\Yii::$app->user->can('banner') || \Yii::$app->user->can('slider') ? '' :'hide'],

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

2ffff539   Administrator   проапдейтил роли
84
                  'items' => [

41ee48ec   Administrator   image size
85
86
                      [

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

090dfe5b   Administrator   image size
87
88
                          'url' => ['/slider/index'],

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

41ee48ec   Administrator   image size
89
90
91
                      ],

                      [

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

090dfe5b   Administrator   image size
92
93
                          'url' => ['/banner/index'],

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

41ee48ec   Administrator   image size
94
                      ],

2ffff539   Administrator   проапдейтил роли
95
96
97
                  ]

              ],

              [

1aebc681   Administrator   image size
98
                  'label' => 'Текстовые страницы',

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

1aebc681   Administrator   image size
100
101
102
103
104
                  'url' => ['/page/index'],

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

              ],

              [

                  'label' => 'Статьи',

7459c206   Administrator   image size
105
                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-pencil"></i> <span>{label}</span></a>',

1aebc681   Administrator   image size
106
107
108
109
110
                  'url' => ['/articles/index'],

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

              ],

              [

                  'label' => 'Акции',

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

1aebc681   Administrator   image size
112
113
114
                  'url' => ['/event/index'],

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

              ],

2ffff539   Administrator   проапдейтил роли
115
116
117
              [

                  'label' => 'SEO',

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

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

090dfe5b   Administrator   image size
119
                  'options' => ['class'=>\Yii::$app->user->can('seo') || \Yii::$app->user->can('seo-category') ? '' :'hide'],

2ffff539   Administrator   проапдейтил роли
120
                  'items' => [

1aebc681   Administrator   image size
121
122
123
124
125
126
127
128
129
130
                      [

                          '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'],

                      ]

2ffff539   Administrator   проапдейтил роли
131
132
                  ]

              ],

4994ab9e   Eugeny Galkovskiy   150616
133
  

1aebc681   Administrator   image size
134
135
136
              [

                  'label' => 'Фон',

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

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

1aebc681   Administrator   image size
138
139
140
141
                  'options' => ['class'=>\Yii::$app->user->can('bg')? '' :'hide']

              ],

              [

                  'label' => 'Подписка',

e277725b   Administrator   image size
142
                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-envelope"></i> <span>{label}</span></a>',

1aebc681   Administrator   image size
143
144
145
146
                  'url' => ['/subscribe/index'],

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

              ],

              [

e277725b   Administrator   image size
147
                  'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-user"></i> <span>{label}</span></a>',

1aebc681   Administrator   image size
148
149
150
151
152
                  'label' => 'Пользователи',

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

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

              ],

              [

2ffff539   Administrator   проапдейтил роли
153
                  'label' => 'Настройка ролей',

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

4994ab9e   Eugeny Galkovskiy   150616
155
156
                  'active' => preg_match('/^user.*$/', $this->context->id)

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

3008d9ae   Administrator   image size
157
                  'options' => ['class'=>\Yii::$app->user->can('user') || \Yii::$app->user->can('user') || \Yii::$app->user->can('permit')  ? '' :'hide'],

2ffff539   Administrator   проапдейтил роли
158
                  'items' => [

1aebc681   Administrator   image size
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
                      [

                          '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'],

                      ]

2ffff539   Administrator   проапдейтил роли
174
175
                  ]

              ],

3f2bc3d0   Administrator   first commit
176
  

d8d0c38c   Administrator   add active menu
177
  

90a6ed1a   Administrator   basket
178
  

2ffff539   Administrator   проапдейтил роли
179
180
181
182
183
184
185
186
187
          ];

  

  

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

              array_push($items,

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

              );

          } else {

              array_push($items,

e277725b   Administrator   image size
188
189
190
191
192
                  [

                      '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>',

                  ]

2ffff539   Administrator   проапдейтил роли
193
194
195
196
197
198
199
              );

          }

          echo Menu::widget([

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

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

  

              'items' =>$items,

3f2bc3d0   Administrator   first commit
200
201
202
203
204
205
206
207
  

          ]);

          ?>

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

  

      </section>

      <!-- /.sidebar -->

  </aside>