adding forgotten files
This commit is contained in:
65
backend/modules/questionnaire/views/user-response/_form.php
Normal file
65
backend/modules/questionnaire/views/user-response/_form.php
Normal 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>
|
@ -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>
|
18
backend/modules/questionnaire/views/user-response/create.php
Normal file
18
backend/modules/questionnaire/views/user-response/create.php
Normal 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>
|
123
backend/modules/questionnaire/views/user-response/index.php
Normal file
123
backend/modules/questionnaire/views/user-response/index.php
Normal 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>
|
19
backend/modules/questionnaire/views/user-response/update.php
Normal file
19
backend/modules/questionnaire/views/user-response/update.php
Normal 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>
|
62
backend/modules/questionnaire/views/user-response/view.php
Normal file
62
backend/modules/questionnaire/views/user-response/view.php
Normal 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>
|
Reference in New Issue
Block a user