1 | <?php |
||||||
2 | |||||||
3 | use yii\helpers\{Html, Url}; |
||||||
4 | use yii\grid\GridView; |
||||||
5 | use Itstructure\AdminModule\Module; |
||||||
6 | use Itstructure\AdminModule\models\Language; |
||||||
7 | |||||||
8 | /* @var $this Itstructure\AdminModule\components\AdminView */ |
||||||
9 | /* @var $searchModel Itstructure\AdminModule\models\LanguageSearch */ |
||||||
10 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
||||||
11 | |||||||
12 | $this->title = Module::t('languages', 'Languages'); |
||||||
13 | $this->params['breadcrumbs'][] = $this->title; |
||||||
14 | ?> |
||||||
15 | <div class="language-index"> |
||||||
16 | |||||||
17 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
||||||
18 | |||||||
19 | <p> |
||||||
20 | <?php echo Html::a(Module::t('main', 'Create'), [ |
||||||
21 | $this->params['urlPrefix'].'create' |
||||||
22 | ], [ |
||||||
23 | 'class' => 'btn btn-success' |
||||||
24 | ]) ?> |
||||||
25 | </p> |
||||||
26 | <?php echo GridView::widget([ |
||||||
27 | 'dataProvider' => $dataProvider, |
||||||
28 | 'columns' => [ |
||||||
29 | 'name' => [ |
||||||
30 | 'label' => Module::t('languages', 'Language name'), |
||||||
31 | 'value' => function($searchModel) { |
||||||
32 | return Html::a($searchModel->name, |
||||||
33 | Url::to([ |
||||||
34 | $this->params['urlPrefix'].'view', |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||||||
35 | 'id' => $searchModel->id |
||||||
36 | ]) |
||||||
37 | ); |
||||||
38 | }, |
||||||
39 | 'format' => 'raw', |
||||||
40 | ], |
||||||
41 | 'shortName' => [ |
||||||
42 | 'label' => Module::t('languages', 'Short name'), |
||||||
43 | 'value' => function($searchModel) { |
||||||
44 | return $searchModel->shortName; |
||||||
45 | }, |
||||||
46 | 'format' => 'raw', |
||||||
47 | ], |
||||||
48 | [ |
||||||
49 | 'attribute' => 'default', |
||||||
50 | 'label' => Module::t('main', 'Default'), |
||||||
51 | 'format' => 'raw', |
||||||
52 | 'value' => function(Language $model) { |
||||||
53 | if ($model->default === 1) { |
||||||
54 | return Html::tag('i', '', [ |
||||||
55 | 'class' => 'fa fa-check-circle', |
||||||
56 | ]); |
||||||
57 | } |
||||||
58 | |||||||
59 | return Html::a(Module::t('languages', 'Set this language as default'), Url::to([ |
||||||
60 | $this->params['urlPrefix'].'set-default', |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
61 | 'languageId' => $model->id, |
||||||
62 | ]), [ |
||||||
63 | 'title' => Module::t('languages', 'Set this language as default'), |
||||||
64 | ]); |
||||||
65 | }, |
||||||
66 | ], |
||||||
67 | [ |
||||||
68 | 'attribute' => 'created_at', |
||||||
69 | 'label' => Module::t('main', 'Created date'), |
||||||
70 | 'format' => ['date', 'dd.MM.Y H:m:s'], |
||||||
71 | ], |
||||||
72 | [ |
||||||
73 | 'attribute' => 'updated_at', |
||||||
74 | 'label' => Module::t('main', 'Updated date'), |
||||||
75 | 'format' => ['date', 'dd.MM.Y H:m:s'], |
||||||
76 | ], |
||||||
77 | [ |
||||||
78 | 'class' => 'yii\grid\ActionColumn', |
||||||
79 | 'header' => Module::t('main', 'Actions'), |
||||||
80 | 'template' => '{setDefault} {view} {update} {delete}', |
||||||
81 | 'visibleButtons' => [ |
||||||
82 | 'setDefault' => function($model, $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.
Loading history...
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.
Loading history...
|
|||||||
83 | return $model->default !== 1; |
||||||
84 | }, |
||||||
85 | ], |
||||||
86 | 'urlCreator'=>function($action, $model, $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.
Loading history...
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.
Loading history...
|
|||||||
87 | return Url::to([ |
||||||
88 | $this->params['urlPrefix'].$action, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
89 | 'id' => $model->id |
||||||
90 | ]); |
||||||
91 | } |
||||||
92 | ], |
||||||
93 | ], |
||||||
94 | ]); ?> |
||||||
95 | </div> |
||||||
96 |