Blame view

backend/views/layouts/main-sidebar.php 9.86 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
37
38
                      [

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

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

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

                      ],

                      [

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

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

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

  

1aebc681   Administrator   image size
41
42
43
44
45
46
47
                      ],

                      [

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

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

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

                      ],

                      [

1aebc681   Administrator   image size
48
49
50
51
52
                          'label' => 'Единицы измерения',

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

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

                      ],

                      [

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

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

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

                      ],

c7852657   Karnovsky A   -
57
58
59
60
61
                      [

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

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

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

                      ],

4994ab9e   Eugeny Galkovskiy   150616
62
63
64
65
66
67
68
69
70
71
                      [

                          '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   проапдейтил роли
72
73
74
75
                  ]

              ],

              [

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

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

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

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

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

41ee48ec   Administrator   image size
80
81
                      [

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

090dfe5b   Administrator   image size
82
83
                          'url' => ['/slider/index'],

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

41ee48ec   Administrator   image size
84
85
86
                      ],

                      [

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

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

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

41ee48ec   Administrator   image size
89
                      ],

2ffff539   Administrator   проапдейтил роли
90
91
92
                  ]

              ],

              [

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

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

1aebc681   Administrator   image size
95
96
97
98
99
                  'url' => ['/page/index'],

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

              ],

              [

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

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

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

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

              ],

              [

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

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

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

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

              ],

2ffff539   Administrator   проапдейтил роли
110
111
112
              [

                  'label' => 'SEO',

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

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

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

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

1aebc681   Administrator   image size
116
117
118
119
120
121
122
123
124
125
                      [

                          '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   проапдейтил роли
126
127
                  ]

              ],

4994ab9e   Eugeny Galkovskiy   150616
128
  

1aebc681   Administrator   image size
129
130
131
              [

                  'label' => 'Фон',

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

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

1aebc681   Administrator   image size
133
134
135
136
                  'options' => ['class'=>\Yii::$app->user->can('bg')? '' :'hide']

              ],

              [

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

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

1aebc681   Administrator   image size
138
139
140
141
                  'url' => ['/subscribe/index'],

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

              ],

              [

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

1aebc681   Administrator   image size
143
144
145
146
147
                  'label' => 'Пользователи',

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

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

              ],

              [

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

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

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

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

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

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

1aebc681   Administrator   image size
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
                      [

                          '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   проапдейтил роли
169
170
                  ]

              ],

3f2bc3d0   Administrator   first commit
171
  

d8d0c38c   Administrator   add active menu
172
  

90a6ed1a   Administrator   basket
173
  

2ffff539   Administrator   проапдейтил роли
174
175
176
177
178
179
180
181
182
          ];

  

  

          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
183
184
185
186
187
                  [

                      '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   проапдейтил роли
188
189
190
191
192
193
194
              );

          }

          echo Menu::widget([

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

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

  

              'items' =>$items,

3f2bc3d0   Administrator   first commit
195
196
197
198
199
200
201
202
  

          ]);

          ?>

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

  

      </section>

      <!-- /.sidebar -->

  </aside>