2021-10-22 17:02:28 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use backend\modules\questionnaire\models\Questionnaire;
|
2021-11-08 12:41:39 +03:00
|
|
|
use backend\modules\questionnaire\models\UserQuestionnaire;
|
|
|
|
use common\helpers\AnswerHelper;
|
|
|
|
use common\models\User;
|
2021-10-22 17:02:28 +03:00
|
|
|
use kartik\depdrop\DepDrop;
|
2021-11-08 12:41:39 +03:00
|
|
|
use yii\helpers\ArrayHelper;
|
2021-10-22 17:02:28 +03:00
|
|
|
use yii\helpers\Html;
|
|
|
|
use yii\grid\GridView;
|
|
|
|
use yii\helpers\Url;
|
|
|
|
use yii\widgets\ActiveForm;
|
|
|
|
|
|
|
|
/* @var $this yii\web\View */
|
|
|
|
/* @var $searchModel backend\modules\questionnaire\models\UserResponseSearch */
|
|
|
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
|
|
|
/* @var $model backend\modules\questionnaire\models\UserResponse */
|
|
|
|
/* @var $questionnaire backend\modules\questionnaire\models\Questionnaire */
|
|
|
|
|
|
|
|
$this->title = 'Ответы пользователей';
|
|
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
|
|
?>
|
|
|
|
<div class="user-responses-index">
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<?= Html::a('Создать новый ответ пользователя', ['create'], ['class' => 'btn btn-success']) ?>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<?= GridView::widget([
|
|
|
|
'dataProvider' => $dataProvider,
|
|
|
|
'filterModel' => $searchModel,
|
|
|
|
'columns' => [
|
|
|
|
['class' => 'yii\grid\SerialColumn'],
|
|
|
|
[
|
|
|
|
'attribute' => 'user_questionnaire_id',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
|
2021-10-22 17:02:28 +03:00
|
|
|
'value' => function($model){
|
|
|
|
return $model->getQuestionnaireTitle();
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'user_id',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => User::find()->select(['username', 'id'])->indexBy('id')->column(),
|
|
|
|
'value' => 'user.username',
|
|
|
|
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'question_id',
|
2021-11-08 12:41:39 +03:00
|
|
|
'value' => 'question.question_body',
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
'response_body',
|
|
|
|
[
|
|
|
|
'attribute' => 'Тип вопроса',
|
|
|
|
'value' => function($model){
|
|
|
|
return $model->getQuestionType();
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'answer_flag',
|
2021-11-08 12:41:39 +03:00
|
|
|
'filter' => AnswerHelper::answerFlagsList(),
|
2021-10-22 17:02:28 +03:00
|
|
|
'format' => 'raw',
|
|
|
|
'value' => function ($model) {
|
2021-11-08 12:41:39 +03:00
|
|
|
return AnswerHelper::answerFlagLable($model->answer_flag);
|
2021-10-22 17:02:28 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
['class' => 'yii\grid\ActionColumn'],
|
|
|
|
],
|
|
|
|
]); ?>
|
|
|
|
</div>
|