59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
use app\models\Parameter;
|
|
use yii\helpers\Html;
|
|
use yii\bootstrap5\ActiveForm;
|
|
use yii\grid\GridView;
|
|
|
|
/** @var yii\web\View $this */
|
|
|
|
$this->title = 'params list';
|
|
|
|
|
|
?>
|
|
<h1>Parameters</h1>
|
|
|
|
<?php $searchForm = ActiveForm::begin([
|
|
'action' => '/list/index',
|
|
'method' => 'get',
|
|
]); ?>
|
|
|
|
<?= Html::submitButton('Run search', [ 'class' => 'btn btn-l btn-success w-100' ]) ?>
|
|
<p class="small">Set your search query in the grid view</p>
|
|
|
|
<?php ActiveForm::end(); ?>
|
|
|
|
<?= GridView::widget([
|
|
'dataProvider' => $provider,
|
|
'filterModel' => $searchModel,
|
|
'columns' => [
|
|
'id', 'title', 'type',
|
|
[
|
|
'label' => 'Icon',
|
|
'value' => function (Parameter $model) {
|
|
if ($model->icon) {
|
|
$url = '/api/image?sha256=' . $model->getRelatedRecords()['icon']->sha256;
|
|
return Html::a(Html::img($url, [ 'width' => 150, 'height' => 150 ]), $url, [ 'alt' => 'icon', 'target' => '_blank' ]);
|
|
}
|
|
},
|
|
'format' => 'raw',
|
|
],
|
|
[
|
|
'label' => 'Gray Icon',
|
|
'value' => function (Parameter $model) {
|
|
if ($model->iconGray) {
|
|
$url = '/api/image?sha256=' . $model->getRelatedRecords()['iconGray']->sha256;
|
|
return Html::a(Html::img($url, [ 'width' => 150, 'height' => 150 ]), $url, [ 'alt' => 'grayscale icon', 'target' => '_blank' ]);
|
|
}
|
|
},
|
|
'format' => 'raw',
|
|
],
|
|
[
|
|
'label' => 'Edit',
|
|
'value' => function (Parameter $model) {
|
|
return Html::a('Edit', '/list/edit?id=' . $model->id);
|
|
},
|
|
'format' => 'raw',
|
|
],
|
|
]
|
|
]); ?>
|