title = 'Ответы пользователей'; $this->params['breadcrumbs'][] = $this->title; ?>
= Html::a('Создать новый ответ пользователя', ['create'], ['class' => 'btn btn-success']) ?>
= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], // 'id', // 'user_id', [ 'attribute' => 'user_questionnaire_id', 'value' => function($model){ return $model->getQuestionnaireTitle(); } ], // 'user_questionnaire_id', [ 'attribute' => 'user_id', 'value' => function($model){ return $model->getUserName(); } ], [ 'attribute' => 'question_id', 'value' => function($model){ return $model->getQuestionBody(); } ], 'response_body', [ 'attribute' => 'Тип вопроса', 'value' => function($model){ return $model->getQuestionType(); } ], [ 'attribute' => 'answer_flag', 'format' => 'raw', 'value' => function ($model) { $answerFlag = $model->answer_flag; $class = 'label label-warning'; $content = 'Not verified'; if ($answerFlag > 0) { $class = 'label label-success'; $answerFlag < 1 ? $content = $answerFlag *100 . '%' : $content = 'True'; } else if ($answerFlag === 0.0) { $class = 'label label-danger'; $content = 'Wrong'; } return Html::tag( 'span', $content, [ 'class' => $class, ] ); }, ], // 'created_at', // 'updated_at', ['class' => 'yii\grid\ActionColumn'], ], ]); ?>