index.php
2.29 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
<?php
use common\models\Slider;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/**
* @var yii\web\View $this
* @var common\models\SliderSearch $searchModel
* @var yii\data\ActiveDataProvider $dataProvider
*/
$this->title = Yii::t('app', 'Sliders');
$this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="slider-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('app', 'Create Slider'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
'slider_id',
'title',
[
'attribute' => 'status',
'value' => function($model) {
/**
* @var Slider $model
*/
return ( !$model->status ) ? \Yii::t('app', 'Скрыто') : \Yii::t('app', 'Показать');
},
'filter' => [
0 => \Yii::t('app', 'Скрыто'),
1 => \Yii::t('app', 'Показать'),
],
],
[
'label' => \Yii::t('app', 'Slide count'),
'content' => function($model) {
/**
* @var Slider $model
*/
return count($model->sliderImage);
},
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {image} {delete}',
'buttons' => [
'image' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-picture"></span>', Url::toRoute([
'slider-image/index',
'slider_id' => $model->slider_id,
]), [
'title' => \Yii::t('app', "слайды"),
]);
},
],
],
],
]); ?>
</div>