guild/backend/modules/questionnaire/views/user-questionnaire/index.php

59 lines
1.8 KiB
PHP
Raw Normal View History

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\UserQuestionnaireSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Анкеты пользователей';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-questionnaire-index">
<p>
<?= Html::a('Назначить анкету пользователю', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'questionnaire_id',
'value' => function($model){
return $model->getQuestionnaireTitle();
}
],
[
'attribute' => 'user_id',
'value' => function($model){
return $model->getUserName();
}
],
'score',
[
'attribute' => 'percent_correct_answers',
'value' => function($model) {
$percent = $model->percent_correct_answers * 100;
return $percent . '%';
}
],
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(),
2021-10-22 17:02:28 +03:00
'value' => function ($model) {
2021-10-29 17:06:09 +03:00
return \common\helpers\StatusHelper::statusLabel($model->status);
2021-10-22 17:02:28 +03:00
},
],
'created_at',
'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>