You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.8 KiB
74 lines
2.8 KiB
<?php |
|
|
|
use yii\grid\ActionColumn; |
|
use yii\helpers\Html; |
|
use yii\grid\GridView; |
|
use common\modules\languages\entities\Language; |
|
use common\modules\languages\helpers\LanguageHelper; |
|
|
|
/* @var $this yii\web\View */ |
|
/* @var $searchModel \common\modules\languages\forms\search\LanguageSearch */ |
|
/* @var $dataProvider yii\data\ActiveDataProvider */ |
|
|
|
$this->title = Yii::t('languages', 'Languages'); |
|
$this->params['breadcrumbs'][] = $this->title; |
|
?> |
|
<div class="language-index"> |
|
|
|
<p> |
|
<?= Html::a(Yii::t('languages','Create Language'), ['create'], ['class' => 'btn btn-success']) ?> |
|
</p> |
|
|
|
<div class="box"> |
|
<div class="box-body"> |
|
<?= GridView::widget([ |
|
'dataProvider' => $dataProvider, |
|
'filterModel' => $searchModel, |
|
'columns' => [ |
|
[ |
|
'attribute' => 'default', |
|
'format' => 'raw', |
|
'value' => function(Language $language) { |
|
return Html::a(LanguageHelper::defaultLabel($language->default), ['set-default', 'id' => $language->id], [ |
|
'data' => [ |
|
'confirm' => Yii::t('languages', 'Are you sure you want to set this language as default?'), |
|
'method' => 'post', |
|
], |
|
]); |
|
}, |
|
'options' => ['style' => 'width: 150px;'], |
|
'contentOptions' => ['class' => 'text-center'], |
|
], |
|
[ |
|
'attribute' => 'title', |
|
'value' => function (Language $model) { |
|
return Html::a(Html::encode($model->title), ['view', 'id' => $model->id]); |
|
}, |
|
'format' => 'raw', |
|
], |
|
'name', |
|
[ |
|
'attribute' => 'status', |
|
'filter' => LanguageHelper::statusList(), |
|
'format' => 'raw', |
|
'value' => function(Language $language) { |
|
return LanguageHelper::statusLabel($language->status); |
|
}, |
|
'options' => ['style' => 'width: 150px;'], |
|
'contentOptions' => ['class' => 'text-center'], |
|
], |
|
[ |
|
'class' => ActionColumn::class, |
|
'visibleButtons' => [ |
|
'delete' => function ($model, $key, $index) { |
|
return $model->default === 1 ? false : true; |
|
} |
|
], |
|
'options' => ['style' => 'width: 100px;'], |
|
'contentOptions' => ['class' => 'text-center'], |
|
], |
|
], |
|
]); ?> |
|
</div> |
|
</div> |
|
</div>
|
|
|