itstructure /
yii2-template-simple
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | use yii\grid\GridView; |
||||||
| 4 | use yii\helpers\{Url, Html}; |
||||||
| 5 | use app\models\QualitySearch; |
||||||
| 6 | |||||||
| 7 | /* @var $searchModel QualitySearch */ |
||||||
| 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
||||||
| 9 | /* @var $this Itstructure\AdminModule\components\AdminView */ |
||||||
| 10 | |||||||
| 11 | $this->title = Yii::t('qualities', 'Qualities'); |
||||||
| 12 | $this->params['breadcrumbs'][] = $this->title; |
||||||
| 13 | ?> |
||||||
| 14 | <div class="qualities-index"> |
||||||
| 15 | |||||||
| 16 | <?php //echo $this->render('_search', ['model' => $searchModel]); ?> |
||||||
| 17 | |||||||
| 18 | <p> |
||||||
| 19 | <?php echo Html::a(Yii::t('qualities', 'Create quality'), [ |
||||||
| 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 | 'icon' => [ |
||||||
| 33 | 'label' => Yii::t('app', 'Icon'), |
||||||
| 34 | 'value' => function($searchModel) { |
||||||
| 35 | /* @var $searchModel QualitySearch */ |
||||||
| 36 | return Html::a( |
||||||
| 37 | Html::tag('i', '', ['class' => empty($searchModel->icon) ? 'fa fa-file fa-2x' : $searchModel->icon]), |
||||||
| 38 | Url::to([$this->params['urlPrefix'].'view', 'id' => $searchModel->id]) |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||||||
| 39 | ); |
||||||
| 40 | }, |
||||||
| 41 | 'format' => 'raw', |
||||||
| 42 | ], |
||||||
| 43 | 'title' => [ |
||||||
| 44 | 'label' => Yii::t('app', 'Title'), |
||||||
| 45 | 'value' => function($searchModel) { |
||||||
| 46 | /* @var $searchModel QualitySearch */ |
||||||
| 47 | return Html::a( |
||||||
| 48 | Html::encode($searchModel->title), |
||||||
| 49 | Url::to([$this->params['urlPrefix'].'view', 'id' => $searchModel->id]) |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 50 | ); |
||||||
| 51 | }, |
||||||
| 52 | 'format' => 'raw', |
||||||
| 53 | ], |
||||||
| 54 | 'about' => [ |
||||||
| 55 | 'label' => Yii::t('qualities', 'Parent about records'), |
||||||
| 56 | 'value' => function ($searchModel) { |
||||||
| 57 | /* @var $searchModel QualitySearch */ |
||||||
| 58 | $aboutRecords = ''; |
||||||
| 59 | foreach ($searchModel->about as $aboutRecord) { |
||||||
| 60 | $aboutRecords .= Html::tag('li', |
||||||
| 61 | Html::a($aboutRecord->title, |
||||||
| 62 | Url::to(['/admin/about/view', 'id' => $aboutRecord->id]), |
||||||
| 63 | [ |
||||||
| 64 | 'target' => '_blank' |
||||||
| 65 | ] |
||||||
| 66 | ) |
||||||
| 67 | ); |
||||||
| 68 | } |
||||||
| 69 | |||||||
| 70 | return empty($aboutRecords) ? '' : Html::tag('ul', $aboutRecords, [ |
||||||
| 71 | 'style' => 'margin-left: 10px; padding-left: 10px;' |
||||||
| 72 | ]); |
||||||
| 73 | }, |
||||||
| 74 | 'format' => 'raw', |
||||||
| 75 | ], |
||||||
| 76 | [ |
||||||
| 77 | 'attribute' => 'created_at', |
||||||
| 78 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||||||
| 79 | 'label' => Yii::t('app', 'Created date'), |
||||||
| 80 | ], |
||||||
| 81 | [ |
||||||
| 82 | 'attribute' => 'updated_at', |
||||||
| 83 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||||||
| 84 | 'label' => Yii::t('app', 'Updated date'), |
||||||
| 85 | ], |
||||||
| 86 | [ |
||||||
| 87 | 'class' => 'yii\grid\ActionColumn', |
||||||
| 88 | 'header' => Yii::t('app', 'Actions'), |
||||||
| 89 | 'template' => '{view} {update} {delete}', |
||||||
| 90 | '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...
|
|||||||
| 91 | return Url::to([ |
||||||
| 92 | $this->params['urlPrefix'].$action, |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 93 | 'id' => $model->id |
||||||
| 94 | ]); |
||||||
| 95 | } |
||||||
| 96 | ], |
||||||
| 97 | ], |
||||||
| 98 | ]); ?> |
||||||
| 99 | </div> |
||||||
| 100 |