adding forgotten files
This commit is contained in:
54
backend/modules/questionnaire/views/questionnaire/_form.php
Normal file
54
backend/modules/questionnaire/views/questionnaire/_form.php
Normal 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>
|
@ -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>
|
22
backend/modules/questionnaire/views/questionnaire/create.php
Normal file
22
backend/modules/questionnaire/views/questionnaire/create.php
Normal 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>
|
64
backend/modules/questionnaire/views/questionnaire/index.php
Normal file
64
backend/modules/questionnaire/views/questionnaire/index.php
Normal 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>
|
23
backend/modules/questionnaire/views/questionnaire/update.php
Normal file
23
backend/modules/questionnaire/views/questionnaire/update.php
Normal 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>
|
131
backend/modules/questionnaire/views/questionnaire/view.php
Normal file
131
backend/modules/questionnaire/views/questionnaire/view.php
Normal 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>
|
Reference in New Issue
Block a user