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\AnswerSearch */
|
|
|
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
|
|
|
|
|
|
|
$this->title = 'Ответы на вопросы';
|
|
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
|
|
?>
|
|
|
|
<div class="answer-index">
|
|
|
|
|
|
|
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<?= Html::a('Создать новый ответ', ['create'], ['class' => 'btn btn-success']) ?>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<?= GridView::widget([
|
|
|
|
'dataProvider' => $dataProvider,
|
|
|
|
'filterModel' => $searchModel,
|
|
|
|
'columns' => [
|
|
|
|
['class' => 'yii\grid\SerialColumn'],
|
|
|
|
[
|
2021-10-29 17:06:09 +03:00
|
|
|
'filter' => \yii\helpers\ArrayHelper::map(\common\models\Question::find()->where(['!=', 'question_type_id', '1'])->all(), 'id', 'question_body'),
|
2021-10-22 17:02:28 +03:00
|
|
|
'attribute' => 'question_id',
|
|
|
|
'value' => function($model){
|
|
|
|
return $model->getQuestionBody();
|
|
|
|
}
|
|
|
|
],
|
|
|
|
'answer_body',
|
|
|
|
[
|
|
|
|
'attribute' => 'answer_flag',
|
|
|
|
'format' => 'raw',
|
2021-10-29 17:06:09 +03:00
|
|
|
'filter' => \common\helpers\AnswerHelper::answerFlagsList(),
|
2021-10-22 17:02:28 +03:00
|
|
|
'value' => function ($model) {
|
2021-10-29 17:06:09 +03:00
|
|
|
return \common\helpers\AnswerHelper::statusLabel($model->answer_flag);
|
2021-10-22 17:02:28 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'attribute' => 'status',
|
|
|
|
'format' => 'raw',
|
2021-10-29 17:06:09 +03:00
|
|
|
'filter' => \common\helpers\StatusHelper::statusList(),
|
|
|
|
'value' => function($model){
|
|
|
|
return \common\helpers\StatusHelper::statusLabel($model->status);
|
|
|
|
}
|
2021-10-22 17:02:28 +03:00
|
|
|
],
|
|
|
|
['class' => 'yii\grid\ActionColumn'],
|
|
|
|
],
|
|
|
|
]); ?>
|
|
|
|
</div>
|