getUserName(); $questionnaire = $model->getQuestionnaireTitle(); $this->title = $user . ": " . $questionnaire; $this->params['breadcrumbs'][] = ['label' => 'User Questionnaires', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; YiiAsset::register($this); ?>
setPercentCorrectAnswers(4)); die();?>

'btn btn-primary']) ?> $model->id], ['class' => 'btn btn-primary']) ?> $model->id], [ 'class' => 'btn btn-danger', 'data' => [ 'confirm' => 'Are you sure you want to delete this item?', 'method' => 'post', ], ]) ?>

$model, 'attributes' => [ 'id', [ 'attribute' => 'questionnaires_id', 'value' => $questionnaire, ], [ 'attribute' => 'user_id', 'value' => $user, ], 'uuid', 'score', [ 'attribute' => 'percent_correct_answers', 'value' => function($model) { $percent = $model->percent_correct_answers * 100; return $percent . '%'; } ], [ 'attribute' => 'status', 'format' => 'raw', 'value' => function($model) { return Html::tag( 'span', $model->status ? 'Active' : 'Not Active', [ 'class' => 'label label-' . ($model->status ? 'success' : 'danger'), ] ); }, ], 'created_at', 'updated_at', ], ]) ?>

$model->id], [ 'class' => 'btn btn-primary', 'data' => [ 'confirm' => 'Проверка ответов пользователя: ' . $user . ". Категория: " . $questionnaire, // 'method' => 'post', ], ]) ?> '

Подсчёт балов

', 'toggleButton' => [ 'label' => 'Посчитать баллы', 'tag' => 'button', 'class' => 'btn btn-success', ], ]); if($model->checkAnswerFlagsForNull()) { echo 'Ответы проверены. Посчитать баллы?'; echo Html::a('Посчитать баллы', ['calculate-score', 'id' => $model->id], [ 'class' => 'btn btn-primary' ]); } else { echo 'Не все ответы проверены.'; } ?>

$responseDataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'response_body', [ 'attribute' => 'question_id', 'value' => function($model){ return $model->getQuestionBody(); } ], [ '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', 'template' => '{update}', // {delete} 'buttons' => [ 'update' => function ($url,$model) { return Html::a( '', ['user-response/update', 'id' => $model['id']]); }, ], ], ], ]); ?>