add module test task
This commit is contained in:
38
backend/modules/test/views/test-task/_form.php
Normal file
38
backend/modules/test/views/test-task/_form.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use common\helpers\StatusHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\test\models\TestTask */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="test-task-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textarea(['rows' => 4]) ?>
|
||||
|
||||
<?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'level')->dropDownList(
|
||||
backend\modules\test\models\TestTask::getLevelList(),
|
||||
['prompt' => '...']
|
||||
) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->dropDownList(
|
||||
StatusHelper::statusList(),
|
||||
[
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
35
backend/modules/test/views/test-task/_search.php
Normal file
35
backend/modules/test/views/test-task/_search.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\test\models\TestTaskSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="test-task-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'description') ?>
|
||||
|
||||
<?= $form->field($model, 'link') ?>
|
||||
|
||||
<?= $form->field($model, 'level') ?>
|
||||
|
||||
<?= $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>
|
18
backend/modules/test/views/test-task/create.php
Normal file
18
backend/modules/test/views/test-task/create.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\test\models\TestTask */
|
||||
|
||||
$this->title = 'Добавить тестовое задание';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Test Tasks', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="test-task-create">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
57
backend/modules/test/views/test-task/index.php
Normal file
57
backend/modules/test/views/test-task/index.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\test\models\TestTask;
|
||||
use common\helpers\StatusHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\test\models\TestTaskSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Тестовые задания';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="test-task-index">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Создать', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
// 'id',
|
||||
'description',
|
||||
[
|
||||
'attribute' => 'link',
|
||||
'value' => function ($model) {
|
||||
return Html::a(Html::encode($model->link), Url::to($model->link));
|
||||
},
|
||||
'format' => 'raw',
|
||||
],
|
||||
[
|
||||
'attribute' => 'level',
|
||||
'format' => 'raw',
|
||||
'filter' => TestTask::getLevelList(),
|
||||
'value' => function($model){
|
||||
return TestTask::getLevelLabel($model->level);
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'format' => 'raw',
|
||||
'filter' => StatusHelper::statusList(),
|
||||
'value' => function($model){
|
||||
return StatusHelper::statusLabel($model->status);
|
||||
}
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
19
backend/modules/test/views/test-task/update.php
Normal file
19
backend/modules/test/views/test-task/update.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\test\models\TestTask */
|
||||
|
||||
$this->title = 'Изменить тестовое задание';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Test Tasks', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="test-task-update">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
70
backend/modules/test/views/test-task/view.php
Normal file
70
backend/modules/test/views/test-task/view.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\test\models\TestTask;
|
||||
use common\helpers\StatusHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\test\models\TestTask */
|
||||
|
||||
$this->title = cut_title($model->description);
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Test Tasks', '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="test-task-view">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index', 'id' => $model->id], ['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',
|
||||
'description',
|
||||
[
|
||||
'attribute' => 'link',
|
||||
'value' => function ($model) {
|
||||
return Html::a(Html::encode($model->link), Url::to($model->link));
|
||||
},
|
||||
'format' => 'raw',
|
||||
],
|
||||
[
|
||||
'attribute' => 'level',
|
||||
'format' => 'raw',
|
||||
'filter' => TestTask::getLevelList(),
|
||||
'value' => function($model){
|
||||
return TestTask::getLevelLabel($model->level);
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'format' => 'raw',
|
||||
'filter' => StatusHelper::statusList(),
|
||||
'value' => function($model){
|
||||
return StatusHelper::statusLabel($model->status);
|
||||
}
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user