adding forgotten files

This commit is contained in:
iIronside
2021-10-22 17:02:28 +03:00
parent 2882b8767c
commit e362ad45a4
84 changed files with 21267 additions and 0 deletions

View File

@ -0,0 +1,49 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Answer */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="answer-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'question_id')->widget(Select2::class, [
'data' => \yii\helpers\ArrayHelper::map(\common\models\Question::find()->where(['!=', 'question_type_id', '1'])->all(), 'id', 'question_body'),
'pluginOptions' => [
'allowClear' => true
],
]) ?>
<?= $form->field($model, 'answer_body')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'answer_flag')->dropDownList(
$model->flags,
[
'prompt' => 'Выберите'
]
) ?>
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
[
'prompt' => 'Выберите'
]
) ?>
<!-- <?//= $form->field($model, 'created_at')->textInput() ?> -->
<!-- <?//= $form->field($model, 'updated_at')->textInput() ?> -->
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\AnswerSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="answer-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'question_id') ?>
<?= $form->field($model, 'answer_body') ?>
<?= $form->field($model, 'answer_flag') ?>
<?= $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Answer */
$this->title = 'Создание нового ответа';
$this->params['breadcrumbs'][] = ['label' => 'Answers', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="answer-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,66 @@
<?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'],
// 'id',
[
'attribute' => 'question_id',
'value' => function($model){
return $model->getQuestionBody();
}
],
'answer_body',
[
'attribute' => 'answer_flag',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->answer_flag ? 'Correct' : 'Wrong',
[
'class' => 'label label-' . ($model->answer_flag ? 'success' : 'danger'),
]
);
},
],
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
//'created_at',
//'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Answer */
$this->title = $model->answer_body;
$this->params['breadcrumbs'][] = ['label' => 'Answers', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="answer-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,76 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Answer */
$this->title = cut_title($model->answer_body);
$this->params['breadcrumbs'][] = ['label' => 'Answers', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
function cut_title($str)
{
if(strlen($str) > 35){
return mb_substr($str, 0, 35, 'UTF-8') . '...';
}
return $str;
}
?>
<div class="answer-view">
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
[
'attribute' => 'question_id',
'value' => function($model){
return $model->getQuestionBody();
}
],
[
'attribute' => 'answer_flag',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->answer_flag ? 'Correct' : 'Wrong',
[
'class' => 'label label-' . ($model->answer_flag ? 'success' : 'danger'),
]
);
},
],
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -0,0 +1,12 @@
<div class="questionnaire-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionType */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="question-type-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'question_type')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionTypeSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="question-type-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'question_type') ?>
<?= $form->field($model, 'slug') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionType */
$this->title = 'Создание типа вопроса';
$this->params['breadcrumbs'][] = ['label' => 'Question Types', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="question-type-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,34 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\questionnaire\models\QuestionTypeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Типы вопросов';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="question-type-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'],
// 'id',
'question_type',
'slug',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionType */
$this->title = 'Изменить тип вопроса: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Question Types', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="question-type-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionType */
$this->title = $model->question_type;
$this->params['breadcrumbs'][] = ['label' => 'Question Types', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="question-type-view">
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'question_type',
'slug',
],
]) ?>
</div>

View File

@ -0,0 +1,80 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Question */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="question-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'question_type_id')->widget(Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\QuestionType::find()->all(),'id', 'question_type'),
'options' => ['placeholder' => '...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
<?= $form->field($model, 'questionnaire_id')->widget(Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\Questionnaire::find()->all(),'id', 'title'),
'options' => ['placeholder' => '...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
<!-- <?//= $form->field($model, 'question_type_id')->textInput() ?> -->
<!-- <?//= $form->field($model, 'questionnaire_id')->textInput() ?> -->
<?= $form->field($model, 'question_body')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'question_priority')->textInput() ?>
<?= $form->field($model, 'next_question')->textInput() ?>
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
[
'prompt' => 'Выберите'
]
) ?>
<!-- <?//= $form->field($model, 'created_at')->textInput() ?> -->
<!-- <?//= $form->field($model, 'updated_at')->textInput() ?> -->
<?= $form->field($model, 'time_limit')->dropDownList(
[
'' => 'Не ограничено',
'30' => '30 секунд',
'60' => '1 минута',
'90' => '1:30 секунд',
'120' => '2 минуты',
'180' => '3 минуты',
'300' => '5 минут',
'600' => '10 минут',
]
) ?>
<?= $form->field($model, 'score')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="question-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'question_type_id') ?>
<?= $form->field($model, 'questionnaire_id') ?>
<?= $form->field($model, 'question_body') ?>
<?= $form->field($model, 'question_priority') ?>
<?php // echo $form->field($model, 'next_question') ?>
<?php // echo $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'score') ?>
<?php // echo $form->field($model, 'time_limit') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Question */
$this->title = 'Создание вопроса';
$this->params['breadcrumbs'][] = ['label' => 'Questions', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="question-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,73 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\questionnaire\models\QuestionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Список вопросов';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="question-index">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?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'],
// 'id',
'question_body',
[
'attribute' => 'question_type_id',
'value' => function($model){
return $model->getQuestionTitle();
}
],
[
'attribute' => 'questionnaire_id',
'value' => function($model){
return $model->getQuestionnaireTitle();
}
],
'question_priority',
'next_question',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
//'created_at',
//'updated_at',
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
}
],
'score',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Question */
$this->title = 'Изменение вопроса: ' . $model->question_body;
$this->params['breadcrumbs'][] = ['label' => 'Questions', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="question-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,72 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Question */
$this->title = $model->question_body;
$this->params['breadcrumbs'][] = ['label' => 'Questions', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="question-view">
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
[
'attribute' => 'question_type_id',
'value' => function($model){
return $model->getQuestionTitle();
}
],
[
'attribute' => 'questionnaire_id',
'value' => function($model){
return $model->getQuestionnaireTitle();
}
],
'question_body',
'question_priority',
'next_question',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
'created_at',
'updated_at',
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
}
],
'score'
],
]) ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategory */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="questionnaire-category-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<!-- <?//= $form->field($model, 'status')->textInput() ?> -->
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
[
'prompt' => 'Выберите'
]
) ?>
<!-- <?//= $form->field($model, 'created_at')->textInput() ?> -->
<!-- <?//= $form->field($model, 'updated_at')->textInput() ?> -->
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,35 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategorySearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="questionnaire-category-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'title') ?>
<?= $form->field($model, 'status') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,22 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategory */
$this->title = 'Создание категории анкеты';
$this->params['breadcrumbs'][] = ['label' => 'Questionnaire Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="questionnaire-categories-create">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,48 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\questionnaire\models\QuestionnaireCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Категории анкет';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="questionnaire-category-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'],
// 'id',
'title',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
// 'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategory */
$this->title = 'Редактировать категорию анкет: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Questionnaire Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="questionnaire-category-update">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,55 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireCategory */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Questionnaire Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="questionnaire-categories-view">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'title',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -0,0 +1,54 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Questionnaire */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="questionnaire-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'category_id')->widget(Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\QuestionnaireCategory::find()->all(),'id', 'title'),
'options' => ['placeholder' => '...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
[
'prompt' => 'Выберите'
]
) ?>
<?= $form->field($model, 'time_limit')->dropDownList(
[
'' => 'Не ограничено',
'600' => '10 минут',
'900' => '15 минут',
'1200' => '20 минут',
'1800' => '30 минут',
'2700' => '45 минут',
'3600' => '1 час',
]
)
?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionnaireSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="questionnaire-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'category_id') ?>
<?= $form->field($model, 'title') ?>
<?= $form->field($model, 'status') ?>
<?= $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'time_limit') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,22 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Questionnaire */
$this->title = 'Создание анкеты';
$this->params['breadcrumbs'][] = ['label' => 'Questionnaires', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="questionnaire-create">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,64 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\questionnaire\models\QuestionnaireSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Список анкет';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="questionnaire-index">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?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'],
// 'id',
'title',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
[
'attribute' => 'category_id',
'value' => function($model){
return $model->getCategoryTitle();
}
],
// 'created_at',
// 'updated_at',
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
}
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Questionnaire */
$this->title = 'Изменение: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Questionnaires', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="questionnaire-update">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,131 @@
<?php
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Questionnaire */
/* @var $questionDataProvider yii\data\ActiveDataProvider */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Questionnaires', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="questionnaire-view">
<!-- <h1>-->
<!-- <?//= Html::encode($this->title) ?> -->
<!-- </h1>-->
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
[
'attribute' => 'category_id',
'value' => function($model){
return $model->getCategoryTitle();
}
],
'title',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
'created_at',
'updated_at',
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
}
]
],
]) ?>
<div>
<h2>
<?= 'Вопросы анкеты: ' . Html::encode($this->title) ?>
</h2>
</div>
<?php
echo GridView::widget([
'dataProvider' => $questionDataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'question_type_id',
'questionnaire_id',
'question_body',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
// 'created_at',
// 'updated_at',
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
}
],
'score',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}', // {delete}
'buttons' => [
'view' => function ($url,$model) {
return Html::a(
'<span class="glyphicon glyphicon-eye-open"></span>',
['question/view', 'id' => $model['id']]);
},
'update' => function ($url,$model) {
return Html::a(
'<span class="glyphicon glyphicon-pencil"></span>',
['question/update', 'id' => $model['id']]);
},
],
],
],
]);
?>
</div>

View File

@ -0,0 +1,64 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use kartik\depdrop\DepDrop;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserQuestionnaire */
/* @var $form yii\widgets\ActiveForm */
/* @var $modelCategory backend\modules\questionnaire\models\QuestionnaireCategory */
?>
<div class="user-questionnaire-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($modelCategory, 'title')
->dropDownList($modelCategory->getIdTitlesArr(),
[
'id' => 'cat-id',
'prompt' => 'Выберите'
]
);
?>
<?= $form->field($model, 'questionnaire_id')->widget(DepDrop::className(),
[
'options' => ['id' => 'questionnaire-id'],
'pluginOptions' => [
'depends' => ['cat-id'],
'placeholder' => 'Выберите',
'url' => Url::to(['/questionnaire/user-questionnaire/questionnaire'])
]
]
); ?>
<?= $form->field($model, 'user_id')->widget(Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\User::find()->all(),'id', 'username'),
'options' => ['placeholder' => 'Выберите пользователя','class' => 'form-control'],
'pluginOptions' => [
'placeholder' => 'Выберите',
'allowClear' => true
],
]
); ?>
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
[
'prompt' => 'Выберите'
]
) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,41 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserQuestionnaireSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-questionnaire-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'questionnaire_id') ?>
<?= $form->field($model, 'user_id') ?>
<?= $form->field($model, 'uuid') ?>
<?= $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'score') ?>
<?php // echo $form->field($model, 'status') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,20 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserQuestionnaire */
/* @var $modelCategory backend\modules\questionnaire\models\QuestionnaireCategory */
$this->title = 'Назначение анкеты пользователю';
$this->params['breadcrumbs'][] = ['label' => 'User Questionnaires', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-questionnaire-create">
<?= $this->render('_form', [
'model' => $model,
'modelCategory' => $modelCategory,
]) ?>
</div>

View File

@ -0,0 +1,61 @@
<?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">
<?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'],
// 'id',
[
'attribute' => 'questionnaire_id',
'value' => function($model){
return $model->getQuestionnaireTitle();
}
],
[
'attribute' => 'user_id',
'value' => function($model){
return $model->getUserName();
}
],
// 'UUID',
'score',
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
},
],
'created_at',
'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,22 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserQuestionnaire */
/* @var $modelCategory backend\modules\questionnaire\models\QuestionnaireCategory */
$this->title = 'Изменить: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'User Questionnaires', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="user-questionnaire-update">
<?= $this->render('_form', [
'model' => $model,
'modelCategory' => $modelCategory,
]) ?>
</div>

View File

@ -0,0 +1,177 @@
<?php
use yii\bootstrap\Modal;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\web\YiiAsset;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserQuestionnaire */
/* @var $responseDataProvider yii\data\ActiveDataProvider */
$user = $model->getUserName();
$questionnaire = $model->getQuestionnaireTitle();
$this->title = $user . ": " . $questionnaire;
$this->params['breadcrumbs'][] = ['label' => 'User Questionnaires', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
YiiAsset::register($this);
?>
<div class="user-questionnaire-view">
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
[
'attribute' => 'questionnaires_id',
'value' => $questionnaire,
],
[
'attribute' => 'user_id',
'value' => $user,
],
'uuid',
'score',
[
'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',
],
]) ?>
<p>
<?= Html::a('Проверить ответы', ['rate-responses', 'id' => $model->id], [
'class' => 'btn btn-primary',
'data' => [
'confirm' => 'Проверка ответов пользователя: ' . $user . ". Категория: " . $questionnaire,
// 'method' => 'post',
],
]) ?>
<?php
Modal::begin([
'header' => '<h3>Подсчёт балов</h3>',
'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 'Не все ответы проверены.';
}
?>
<?php Modal::end(); ?>
</p>
<div>
<h2>
<?= 'Ответы пользователя' ?>
</h2>
</div>
<?php
echo GridView::widget([
'dataProvider' => $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(
'<span class="glyphicon glyphicon-pencil"></span>',
['user-response/update', 'id' => $model['id']]);
},
],
],
],
]);
?>
</div>

View File

@ -0,0 +1,65 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserResponse */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-response-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'answer_flag')->dropDownList(
[
'' => 'Не задано',
'0.1' => '10%',
'0.2' => '20%',
'0.3' => '30%',
'0.5' => '50%',
'0.7' => '70%',
'0.8' => '80%',
'0.85' => '85%',
'0.9' => '90%',
'1' => '100%',
]
) ?>
<?= $form->field($model, 'user_id')->widget(Select2::class, [
'data' => \yii\helpers\ArrayHelper::map(\common\models\User::find()->all(),'id', 'username'),
'options' => ['placeholder' => '...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]); ?>
<?= $form->field($model, 'question_id')->widget(Select2::class,[
'data' => \yii\helpers\ArrayHelper::map(\common\models\Question::find()
// ->where('question_type_id != :question_type_id', ['question_type_id' => 1])
->all(), 'id', 'question_body'),
'pluginOptions' => [
'allowClear' => true // 'id != :id', ['id'=>1]
],
])?>
<?= $form->field($model, 'user_questionnaire_id')->widget(Select2::class,[
'data' => \yii\helpers\ArrayHelper::map(\common\models\UserQuestionnaire::find()->all(), 'id', 'id'),
'options' => ['placeholder' => '...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
])?>
<?= $form->field($model, 'response_body')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,41 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserResponseSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-response-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'user_id') ?>
<?= $form->field($model, 'question_id') ?>
<?= $form->field($model, 'response_body') ?>
<?= $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'answer_flag') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'user_questionnaire_id') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserResponse */
$this->title = 'Создать ответ пользователя';
$this->params['breadcrumbs'][] = ['label' => 'User Responses', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-response-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,123 @@
<?php
use backend\modules\questionnaire\models\Questionnaire;
use kartik\depdrop\DepDrop;
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">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Создать новый ответ пользователя', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<!-- --><?php //$form = ActiveForm::begin(); ?>
<!-- <?//= $form->field($model, 'user_id')->dropDownList(\yii\helpers\ArrayHelper::map(
// \common\models\User::find()->all(), 'id', 'username'),
// [
// 'id'=>'user-id',
// 'prompt' => 'Выберите пользователя'
// ]
// ) ?>
-->
<!-- <?//= $form->field($questionnaire, 'title')->widget(DepDrop::classname(), [
// 'options'=>['id'=>'questionnaire-id'],
// 'pluginOptions'=>[
// 'depends'=>['user-id'],
// 'placeholder'=>'Выберите...',
// 'url' => Url::to(['/questionnaire/user-response/questionnaire'])
// ]
// ]);?>
-->
<!-- --><?php //ActiveForm::end(); ?>
<?= 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'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserResponse */
$this->title = 'Изменение ответа: ' . $model->response_body;
$this->params['breadcrumbs'][] = ['label' => 'User Responses', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="user-response-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,62 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\UserResponse */
/* @var $responseDataProvider yii\data\ActiveDataProvider */
$this->title =cut_title($model->response_body);
$this->params['breadcrumbs'][] = ['label' => 'User Responses', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
function cut_title($str)
{
if(strlen($str) > 40){
return mb_substr($str, 0, 40, 'UTF-8') . '...';
}
return $str;
}
?>
<div class="user-response-view">
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
[
'attribute' => 'Пользователь',
'value' => function($model){
return $model->getUserName();
}
],
[
'attribute' => 'Вопрос',
'value' => function($model){
return $model->getQuestionBody();
}
],
'response_body',
'created_at',
'updated_at',
'answer_flag',
'user_questionnaires_uuid',
],
]) ?>
</div>