1 | <?php |
||||||
2 | |||||||
3 | use yii\grid\GridView; |
||||||
4 | use yii\helpers\{Url, Html}; |
||||||
5 | use app\models\HomeSearch; |
||||||
6 | |||||||
7 | /* @var $searchModel HomeSearch */ |
||||||
8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
||||||
9 | /* @var $this Itstructure\AdminModule\components\AdminView */ |
||||||
10 | |||||||
11 | $this->title = Yii::t('home', 'Home page'); |
||||||
12 | $this->params['breadcrumbs'][] = $this->title; |
||||||
13 | ?> |
||||||
14 | <div class="home-index"> |
||||||
15 | |||||||
16 | <?php //echo $this->render('_search', ['model' => $searchModel]); ?> |
||||||
17 | |||||||
18 | <p> |
||||||
19 | <?php echo Html::a(Yii::t('home', 'Create home page'), [ |
||||||
20 | $this->params['urlPrefix'].'create' |
||||||
21 | ], [ |
||||||
22 | 'class' => 'btn btn-success' |
||||||
23 | ]) ?> |
||||||
24 | </p> |
||||||
25 | |||||||
26 | <?php echo GridView::widget([ |
||||||
27 | 'dataProvider' => $dataProvider, |
||||||
28 | //'filterModel' => $searchModel, |
||||||
29 | 'columns' => [ |
||||||
30 | |||||||
31 | 'id', |
||||||
32 | 'title' => [ |
||||||
33 | 'label' => Yii::t('app', 'Title'), |
||||||
34 | 'value' => function($searchModel) { |
||||||
35 | /* @var $searchModel HomeSearch */ |
||||||
36 | return Html::a( |
||||||
37 | Html::encode($searchModel->title), |
||||||
38 | Url::to([$this->params['urlPrefix'].'view', 'id' => $searchModel->id]) |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||||||
39 | ); |
||||||
40 | }, |
||||||
41 | 'format' => 'raw', |
||||||
42 | ], |
||||||
43 | 'description' => [ |
||||||
44 | 'label' => Yii::t('app', 'Description'), |
||||||
45 | 'value' => function($searchModel) { |
||||||
46 | /* @var $searchModel HomeSearch */ |
||||||
47 | return $searchModel->description; |
||||||
48 | }, |
||||||
49 | 'format' => 'raw', |
||||||
50 | ], |
||||||
51 | [ |
||||||
52 | 'attribute' => 'created_at', |
||||||
53 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||||||
54 | 'label' => Yii::t('app', 'Created date'), |
||||||
55 | ], |
||||||
56 | [ |
||||||
57 | 'attribute' => 'updated_at', |
||||||
58 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||||||
59 | 'label' => Yii::t('app', 'Updated date'), |
||||||
60 | ], |
||||||
61 | 'default' => [ |
||||||
62 | 'label' => Yii::t('app', 'Default status'), |
||||||
63 | 'value' => function($searchModel) { |
||||||
64 | /* @var $searchModel HomeSearch */ |
||||||
65 | if ($searchModel->default === 1) { |
||||||
66 | return Html::tag('i', '', [ |
||||||
67 | 'class' => 'fa fa-check-circle', |
||||||
68 | ]); |
||||||
69 | } |
||||||
70 | |||||||
71 | return Html::a(Yii::t('app', 'Set as default'), Url::to([ |
||||||
72 | $this->params['urlPrefix'].'set-default', |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
73 | 'homeId' => $searchModel->id, |
||||||
74 | ]), [ |
||||||
75 | 'title' => Yii::t('app', 'Set as default'), |
||||||
76 | ]); |
||||||
77 | }, |
||||||
78 | 'format' => 'raw', |
||||||
79 | ], |
||||||
80 | [ |
||||||
81 | 'class' => 'yii\grid\ActionColumn', |
||||||
82 | 'header' => Yii::t('app', 'Actions'), |
||||||
83 | 'template' => '{view} {update} {delete}', |
||||||
84 | 'urlCreator'=>function($action, $model, $key, $index){ |
||||||
0 ignored issues
–
show
The parameter
$key is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() The parameter
$index is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
85 | return Url::to([ |
||||||
86 | $this->params['urlPrefix'].$action, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
87 | 'id' => $model->id |
||||||
88 | ]); |
||||||
89 | } |
||||||
90 | ], |
||||||
91 | ], |
||||||
92 | ]); ?> |
||||||
93 | </div> |
||||||
94 |