1 | <?php |
||||||
2 | |||||||
3 | use yii\grid\GridView; |
||||||
4 | use yii\helpers\{Url, Html}; |
||||||
5 | use app\models\ContactSearch; |
||||||
6 | |||||||
7 | /* @var $searchModel ContactSearch */ |
||||||
8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
||||||
9 | /* @var $this Itstructure\AdminModule\components\AdminView */ |
||||||
10 | |||||||
11 | $this->title = Yii::t('contacts', 'Contacts'); |
||||||
12 | $this->params['breadcrumbs'][] = $this->title; |
||||||
13 | ?> |
||||||
14 | <div class="contact-index"> |
||||||
15 | |||||||
16 | <?php //echo $this->render('_search', ['model' => $searchModel]); ?> |
||||||
17 | |||||||
18 | <p> |
||||||
19 | <?php echo Html::a(Yii::t('contacts', 'Create contact'), [ |
||||||
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 ContactSearch */ |
||||||
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 | [ |
||||||
44 | 'attribute' => 'created_at', |
||||||
45 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||||||
46 | 'label' => Yii::t('app', 'Created date'), |
||||||
47 | ], |
||||||
48 | [ |
||||||
49 | 'attribute' => 'updated_at', |
||||||
50 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||||||
51 | 'label' => Yii::t('app', 'Updated date'), |
||||||
52 | ], |
||||||
53 | 'default' => [ |
||||||
54 | 'label' => Yii::t('app', 'Default status'), |
||||||
55 | 'value' => function($searchModel) { |
||||||
56 | /* @var $searchModel ContactSearch */ |
||||||
57 | if ($searchModel->default === 1) { |
||||||
58 | return Html::tag('i', '', [ |
||||||
59 | 'class' => 'fa fa-check-circle', |
||||||
60 | ]); |
||||||
61 | } |
||||||
62 | |||||||
63 | return Html::a(Yii::t('app', 'Set as default'), Url::to([ |
||||||
64 | $this->params['urlPrefix'].'set-default', |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
65 | 'contactId' => $searchModel->id, |
||||||
66 | ]), [ |
||||||
67 | 'title' => Yii::t('app', 'Set as default'), |
||||||
68 | ]); |
||||||
69 | }, |
||||||
70 | 'format' => 'raw', |
||||||
71 | ], |
||||||
72 | [ |
||||||
73 | 'class' => 'yii\grid\ActionColumn', |
||||||
74 | 'header' => Yii::t('app', 'Actions'), |
||||||
75 | 'template' => '{view} {update} {delete}', |
||||||
76 | 'urlCreator'=>function($action, $searchModel, $key, $index){ |
||||||
0 ignored issues
–
show
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. ![]() 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. ![]() |
|||||||
77 | return Url::to([ |
||||||
78 | $this->params['urlPrefix'].$action, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
79 | 'id' => $searchModel->id |
||||||
80 | ]); |
||||||
81 | } |
||||||
82 | ], |
||||||
83 | ], |
||||||
84 | ]); ?> |
||||||
85 | </div> |
||||||
86 |