2021-10-22 17:02:28 +03:00
|
|
|
<?php
|
|
|
|
|
2021-11-08 12:41:39 +03:00
|
|
|
use backend\modules\questionnaire\models\Questionnaire;
|
|
|
|
use backend\modules\questionnaire\models\QuestionType;
|
|
|
|
use common\helpers\StatusHelper;
|
|
|
|
use common\helpers\TimeHelper;
|
2021-10-22 17:02:28 +03:00
|
|
|
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',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => QuestionType::find()->select(['question_type', 'id'])->indexBy('id')->column(),
|
|
|
|
'value' => 'questionType.question_type'
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'questionnaire_id',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
|
|
|
|
'value' => 'questionnaire.title',
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
'question_priority',
|
|
|
|
'next_question',
|
|
|
|
[
|
|
|
|
'attribute' => 'status',
|
|
|
|
'format' => 'raw',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => StatusHelper::statusList(),
|
2021-10-22 17:02:28 +03:00
|
|
|
'value' => function ($model) {
|
2021-11-08 12:41:39 +03:00
|
|
|
return StatusHelper::statusLabel($model->status);
|
2021-10-22 17:02:28 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'time_limit',
|
2021-11-02 17:29:15 +03:00
|
|
|
'format' => 'raw',
|
2021-10-22 17:02:28 +03:00
|
|
|
'value' => function($model){
|
2021-11-08 12:41:39 +03:00
|
|
|
return TimeHelper::limitTime($model->time_limit);
|
2021-10-22 17:02:28 +03:00
|
|
|
}
|
|
|
|
],
|
|
|
|
'score',
|
|
|
|
['class' => 'yii\grid\ActionColumn'],
|
|
|
|
],
|
|
|
|
]); ?>
|
|
|
|
</div>
|