guild/backend/modules/questionnaire/views/question/index.php

58 lines
1.7 KiB
PHP
Raw Normal View History

2021-10-22 17:02:28 +03:00
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\questionnaire\models\QuestionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Список вопросов';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="question-index">
<p>
<?= Html::a('Создать вопрос', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'question_body',
[
'attribute' => 'question_type_id',
'value' => function($model){
return $model->getQuestionTitle();
}
],
[
'attribute' => 'questionnaire_id',
'value' => function($model){
return $model->getQuestionnaireTitle();
}
],
'question_priority',
'next_question',
[
'attribute' => 'status',
'format' => 'raw',
2021-10-29 17:06:09 +03:00
'filter' => \common\helpers\StatusHelper::statusList(),
2021-10-22 17:02:28 +03:00
'value' => function ($model) {
2021-10-29 17:06:09 +03:00
return \common\helpers\StatusHelper::statusLabel($model->status);
2021-10-22 17:02:28 +03:00
},
],
[
'attribute' => 'time_limit',
'value' => function($model){
2021-10-29 17:06:09 +03:00
return \common\helpers\TimeHelper::limitTime($model->time_limit);
2021-10-22 17:02:28 +03:00
}
],
'score',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>