list.php
1.58 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
<?php
use yii\helpers\Html;
use thread\widgets\grid\ActionCheckboxColumn;
use backend\widgets\GridView\GridView;
use backend\widgets\GridView\gridColumns\ActionColumn;
/**
* @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' => [
[
'format' => 'raw',
'attribute' => 'image_link',
'value' => function ($model) {
return Html::img($model->getImageLink(), ['alt' => ($model->lang) ? $model->lang->title : '', 'style' => 'width:50px;']);
},
],
[
'format' => 'raw',
'attribute' => 'title',
'label' => Yii::t('app', 'Title'),
'value' => function ($model) {
return ($model->lang) ? $model->lang->title : 'Не задано';
},
],
[
'attribute' => 'type_map',
'value' => function ($model) {
return ($this->context->module::typeRange()[$model['type_map']]) ?? '';
},
'filter' => $this->context->module::typeRange()
],
'position',
[
'class' => ActionCheckboxColumn::class,
'attribute' => 'published',
'action' => 'published'
],
[
'class' => ActionColumn::class,
//'deleteLink' => ['id', 'training_id'],
'updateLink' => ['id', 'type_map']
],
]
]);