list.php
2.04 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
<?php
use thread\widgets\grid\ActionCheckboxColumn;
use thread\widgets\grid\GridViewFilter;
//
use backend\modules\map\models\{
Type, Area
};
use backend\widgets\GridView\gridColumns\ActionColumn;
use backend\widgets\GridView\GridView;
/**
* @var \backend\modules\map\models\Item $model
*/
echo GridView::widget([
'dataProvider' => $model->search(Yii::$app->request->queryParams),
'tableOptions' => ['class' => 'table table-striped table-bordered'],
'filterModel' => $filter,
'columns' => [
[
'attribute' => 'title',
'label' => Yii::t('app', 'Title'),
'value' => 'lang.title',
],
[
'attribute' => 'type_id',
'filter' => GridViewFilter::selectOne($filter, 'type_id', ['0' => '---'] + Type::dropDownList()),
'value' => function ($model) {
return $model['typeItem']['lang']['title'];
},
],
[
'attribute' => 'area_id',
'filter' => GridViewFilter::selectOne($filter, 'area_id', ['0' => '---'] + Area::dropDownList()),
'value' => function ($model) {
return $model['area']['lang']['title'];
},
],
/* [
'attribute' => 'rubric_id',
'label' => Yii::t($this->context->module->name, 'Rubric'),
'value' => 'rubric.lang.title',
'filter' => $model::getRubricDropDownList()
],*/
// [
// 'attribute' => 'type',
// 'value' => function ($model) {
// return ($this->context->module::typeRange()[$model['type']]) ?? '';
// },
// 'filter' => $this->context->module::typeRange()
//
// ],
// 'position',
[
'class' => ActionCheckboxColumn::class,
'attribute' => 'published',
'action' => 'published'
],
[
'class' => ActionColumn::class,
//'deleteLink' => ['id', 'training_id'],
'updateLink' => ['id', 'type']
],
]
]);