add answer, time, status helpers

This commit is contained in:
iIronside
2021-10-29 17:06:09 +03:00
parent 34c2998844
commit 7b8847e1e1
42 changed files with 2505 additions and 570 deletions

View File

@ -33,10 +33,6 @@ use yii\widgets\ActiveForm;
]
); ?>
<!-- <?//= $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() ?>
@ -44,16 +40,12 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'next_question')->textInput() ?>
<?= $form->field($model, 'status')->dropDownList(
$model->statuses,
\common\helpers\StatusHelper::statusList(),
[
'prompt' => 'Выберите'
]
) ?>
<!-- <?//= $form->field($model, 'created_at')->textInput() ?> -->
<!-- <?//= $form->field($model, 'updated_at')->textInput() ?> -->
<?= $form->field($model, 'time_limit')->dropDownList(
[
'' => 'Не ограничено',

View File

@ -1,7 +1,5 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Question */

View File

@ -12,12 +12,6 @@ $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>
@ -27,8 +21,6 @@ $this->params['breadcrumbs'][] = $this->title;
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 'id',
'question_body',
[
'attribute' => 'question_type_id',
@ -47,26 +39,18 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'status',
'format' => 'raw',
'filter' => \common\helpers\StatusHelper::statusList(),
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
return \common\helpers\StatusHelper::statusLabel($model->status);
},
],
//'created_at',
//'updated_at',
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
return \common\helpers\TimeHelper::limitTime($model->time_limit);
}
],
'score',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>

View File

@ -1,7 +1,5 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\Question */

View File

@ -19,7 +19,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'confirm' => 'Вы уверены, что хотите удалить этот элемент?',
'method' => 'post',
],
]) ?>
@ -47,14 +47,9 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'status',
'format' => 'raw',
'filter' => \common\helpers\StatusHelper::statusList(),
'value' => function ($model) {
return \yii\helpers\Html::tag(
'span',
$model->status ? 'Active' : 'Not Active',
[
'class' => 'label label-' . ($model->status ? 'success' : 'danger'),
]
);
return \common\helpers\StatusHelper::statusLabel($model->status);
},
],
'created_at',
@ -62,7 +57,7 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'time_limit',
'value' => function($model){
return $model->limitTime;
return \common\helpers\TimeHelper::limitTime($model->time_limit);
}
],
'score'