index.php
2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?
use yii\helpers\Html;
use yii\grid\GridView;
$this->title = 'Каталог';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1>Каталог</h1>
<?= Html::a('Создать', ['/admin/catalog/save'], ['class'=>'btn btn-success']) ?>
<?
echo GridView::widget([
'dataProvider' =>$dataCatalog,
'columns' => [
[
'attribute' => 'id',
'value'=>'id',
'contentOptions'=>['style'=>'width: 70px;']
],
[
'attribute' => 'name',
'value'=>function($data){
return ($data->parent_id==0) ? $data->name : Html::a($data->name, ['/admin/products/index','catID'=>$data->id]);
},
'format'=>'raw',
//'contentOptions'=>['style'=>'max-width: 300px;']
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete} {fasovka} {type} {brends}',
'buttons' => [
'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['/admin/catalog/save','id'=>$model->id],
[
'title' => "Редактировать",
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['/admin/catalog/delete','id'=>$model->id],
[
'title' => "Удалить",
'data-confirm' => 'Желаете удалить запись?',
]);
},
'fasovka' => function ($url, $model) {
return Html::a($model->catFasovka, ['/admin/fasovka/index','catID'=>$model->id],
[
'title' => $model->catFasovka,
]);
},
'type' => function ($url, $model) {
return Html::a($model->catType, ['/admin/type/index','catID'=>$model->id],
[
'title' => $model->catType,
]);
},
'brends' => function ($url, $model) {
return Html::a($model->catBrends, ['/admin/brends/index','catID'=>$model->id],
[
'title' => $model->catBrends,
]);
}
],
'contentOptions'=>['style'=>'width: 320px;']
],
],
]) ?>