This commit is contained in:
andrey
2022-10-26 13:18:23 +03:00
74 changed files with 9817 additions and 933 deletions

View File

@ -21,7 +21,14 @@ $this->params['breadcrumbs'][] = $this->title;
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 'id',
[
'attribute' => 'img',
'format' => 'raw',
'value' => function ($model) {
return Html::tag('img', null, ['src' => $model->img, 'width' => '100px']);
}
],
'title',
'slug',
'description',

View File

@ -2,24 +2,20 @@
namespace backend\modules\card\controllers;
use common\classes\Debug;
use common\models\AchievementUserCard;
use common\models\AdditionalFields;
use common\models\CardSkill;
use common\Models\ChangeHistory;
use common\models\User;
use common\models\FieldsValue;
use common\models\FieldsValueNew;
use common\models\Status;
use Yii;
use backend\modules\card\models\UserCard;
use backend\modules\card\models\UserCardSearch;
use common\models\AchievementUserCard;
use common\models\CardSkill;
use common\models\FieldsValueNew;
use common\models\User;
use kartik\mpdf\Pdf;
use PhpOffice\PhpWord\PhpWord;
use Yii;
use yii\data\ActiveDataProvider;
use yii\db\Expression;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* UserCardController implements the CRUD actions for UserCard model.
@ -205,4 +201,56 @@ class UserCardController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
public function actionDownloadResume($id, $pdf = false)
{
$model = $this->findModel($id);
if ($pdf) {
self::getResumePdf($model);
}
self::getResumeDocx($model);
}
private function getResumePdf(UserCard $model)
{
$pdf = new Pdf(); // or new Pdf();
$mpdf = $pdf->api; // fetches mpdf api
$mpdf->SetHeader('Resume ' . $model->fio . '||Generated At: ' . date("d/m/Y")); // call methods or set any properties
$mpdf->SetFooter('{PAGENO}');
$mpdf->WriteHtml($model->vc_text); // call mpdf write html
echo $mpdf->Output("Resume - {$model->fio}", 'D'); // call the mpdf api output as needed
}
private function getResumeDocx(UserCard $model)
{
$phpWord = new PhpWord();
$sectionStyle = array(
'orientation' => 'portrait',
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::pixelToTwip(10),
'marginLeft' => 600,
'marginRight' => 600,
'colsNum' => 1,
'pageNumberingStart' => 1,
'borderBottomSize'=>100,
'borderBottomColor'=>'C0C0C0'
);
$section = $phpWord->addSection($sectionStyle);
$text = $model->vc_text;
$fontStyle = array('name'=>'Times New Roman', 'size'=>14, 'color'=>'000000', 'bold'=>FALSE, 'italic'=>FALSE);
$parStyle = array('align'=>'both','spaceBefore'=>10);
$section->addText(htmlspecialchars($text), $fontStyle,$parStyle);
header("Content-Type: application/msword");
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment;filename=Resume - {$model->fio}.docx");
header('Cache-Control: max-age=0');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
ob_clean();
$objWriter->save("php://output");
exit;
}
}

View File

@ -1,7 +1,8 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
@ -100,6 +101,11 @@ $this->params['breadcrumbs'][] = $this->title;
],
]) ?>
<p>
<?= Html::a('Resume pdf', ['download-resume', 'id' => $model->id, 'pdf' => true], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Resume docx', ['download-resume', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
</p>
<h2>Навыки</h2>
<?php foreach ($skills as $skill) : ?>
<span class="btn btn-default btn-sm"><?= $skill['skill']->name; ?></span>

View File

@ -2,6 +2,8 @@
namespace backend\modules\document\controllers;
use PhpOffice\PhpWord\Exception\CopyFileException;
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
use Yii;
use backend\modules\document\models\Document;
use backend\modules\document\models\DocumentSearch;
@ -10,7 +12,8 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\services\DocumentService;
use common\services\DocumentFileService;
use yii\web\Response;
/**
* DocumentController implements the CRUD actions for Document model.
@ -142,10 +145,15 @@ class DocumentController extends Controller
}
public function actionCreateDocument($id)
/**
* @throws CopyFileException
* @throws NotFoundHttpException
* @throws CreateTemporaryFileException
*/
public function actionCreateDocument($id): Response
{
if(!empty($this->findModel($id)->template->template_file_name)){
$documentService = new DocumentService($id);
$documentService = new DocumentFileService($id);
$documentService->setFields();
$documentService->downloadDocument();
}

View File

@ -33,11 +33,11 @@ $this->params['breadcrumbs'][] = $this->title;
'id',
[
'attribute' => 'field_id',
'value' => ArrayHelper::getValue($model, 'field.title') // AnswerHelper::answerFlagLabel($model->answer_flag),
'value' => ArrayHelper::getValue($model, 'field.title')
],
[
'attribute' => 'document_id',
'value' => ArrayHelper::getValue($model, 'document.title') // AnswerHelper::answerFlagLabel($model->answer_flag),
'value' => ArrayHelper::getValue($model, 'document.title')
],
'value',
],

View File

@ -4,7 +4,7 @@ namespace backend\modules\questionnaire\controllers;
use backend\modules\questionnaire\models\Questionnaire;
use backend\modules\questionnaire\models\QuestionnaireCategory;
use common\helpers\ScoreCalculatorHelper;
use common\services\ScoreCalculatorService;
use Yii;
use backend\modules\questionnaire\models\UserQuestionnaire;
use backend\modules\questionnaire\models\UserQuestionnaireSearch;
@ -169,7 +169,7 @@ class UserQuestionnaireController extends Controller
public function actionRateResponses($id)
{
$user_questionnaire = $this->findModel($id);
ScoreCalculatorHelper::rateResponses($user_questionnaire);
ScoreCalculatorService::rateResponses($user_questionnaire);
return $this->actionView($id);
}
@ -177,7 +177,7 @@ class UserQuestionnaireController extends Controller
public function actionCalculateScore($id)
{
$user_questionnaire = $this->findModel($id);
ScoreCalculatorHelper::calculateScore($user_questionnaire);
ScoreCalculatorService::calculateScore($user_questionnaire);
return $this->actionView($id);
}

View File

@ -4,7 +4,6 @@ namespace backend\modules\questionnaire\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\questionnaire\models\UserQuestionnaire;
/**
* UserQuestionnaireSearch represents the model behind the search form of `backend\modules\questionnaire\models\UserQuestionnaire`.
@ -18,7 +17,7 @@ class UserQuestionnaireSearch extends UserQuestionnaire
{
return [
[['id', 'questionnaire_id', 'user_id', 'score', 'status'], 'integer'],
[['uuid', 'created_at', 'updated_at'], 'safe'],
[['uuid', 'created_at', 'updated_at', 'testing_date'], 'safe'],
[['percent_correct_answers'], 'number'],
];
}
@ -67,6 +66,7 @@ class UserQuestionnaireSearch extends UserQuestionnaire
'score' => $this->score,
'status' => $this->status,
'percent_correct_answers' => $this->percent_correct_answers,
'testing_date' => $this->testing_date,
]);
$query->andFilterWhere(['like', 'uuid', $this->uuid]);

View File

@ -47,7 +47,7 @@ $this->params['breadcrumbs'][] = $this->title;
'format' => 'raw',
'filter' => AnswerHelper::answerFlagsList(),
'value' => function ($model) {
return AnswerHelper::answerFlagLabel($model->answer_flag);
return AnswerHelper:: answerFlagLabel($model->answer_flag);
},
],
[

View File

@ -33,6 +33,8 @@ use yii\widgets\ActiveForm;
<?php // echo $form->field($model, 'percent_correct_answers') ?>
<?php // echo $form->field($model, 'testing_date') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

View File

@ -1,8 +1,7 @@
<?php
use common\helpers\StatusHelper;
use common\helpers\UserQuestionnaireStatusHelper;
use common\models\User;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\grid\GridView;
use backend\modules\questionnaire\models\Questionnaire;
@ -46,13 +45,14 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'status',
'format' => 'raw',
'filter' => StatusHelper::statusList(),
'filter' => UserQuestionnaireStatusHelper::statusList(),
'value' => function ($model) {
return StatusHelper::statusLabel($model->status);
return UserQuestionnaireStatusHelper::statusLabel($model->status);
},
],
'created_at',
'updated_at',
'testing_date',
['class' => 'yii\grid\ActionColumn'],
],

View File

@ -1,8 +1,8 @@
<?php
use common\helpers\ScoreCalculatorHelper;
use common\services\ScoreCalculatorService;
use common\helpers\AnswerHelper;
use common\helpers\StatusHelper;
use common\helpers\UserQuestionnaireStatusHelper;
use yii\bootstrap\Modal;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
@ -23,20 +23,8 @@ $this->params['breadcrumbs'][] = ['label' => 'User Questionnaires', 'url' => ['i
$this->params['breadcrumbs'][] = $this->title;
YiiAsset::register($this);
?>
<?php
//$this->registerJs(
// '$("document").ready(function(){
// $("#new_note").on("pjax:end", function() {
// $.pjax.reload({container:"#user_responses"}); //Reload GridView
// });
// });'
//);
?>
<div class="user-questionnaire-view">
<!-- --><?php //var_dump($model->setPercentCorrectAnswers(4)); die();?>
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
@ -73,10 +61,11 @@ YiiAsset::register($this);
[
'attribute' => 'status',
'format' => 'raw',
'value' => StatusHelper::statusLabel($model->status),
'value' => UserQuestionnaireStatusHelper::statusLabel($model->status),
],
'created_at',
'updated_at',
'testing_date',
],
]) ?>
@ -97,7 +86,7 @@ YiiAsset::register($this);
'class' => 'btn btn-success',
],
]);
if(ScoreCalculatorHelper::checkAnswerFlagsForNull($model))
if(ScoreCalculatorService::checkAnswerFlagsForNull($model))
{
echo 'Ответы проверены. Посчитать баллы?';
echo Html::a('Посчитать баллы', ['calculate-score', 'id' => $model->id], [
@ -140,7 +129,7 @@ YiiAsset::register($this);
'attribute' => 'answer_flag',
'format' => 'raw',
'value' => function ($model) {
return AnswerHelper::answerStatusLabel($model->answer_flag);
return AnswerHelper::userResponseLabel($model->answer_flag);
},
],
@ -168,5 +157,4 @@ YiiAsset::register($this);
]);
?>
<?php Pjax::end(); ?>
</div>

View File

@ -38,12 +38,19 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'response_body')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'answer_flag')->dropDownList(
AnswerHelper::answerFlagsList(),
[
'prompt' => 'Выберите'
]
) ?>
<?= $form->field($model, 'answer_flag')->dropDownList([
'0.0' => 'Ошибочный',
'0.1' => '10%',
'0.2' => '20%',
'0.3' => '30%',
'0.4' => '40%',
'0.5' => '50%',
'0.6' => '60%',
'0.7' => '70%',
'0.8' => '80%',
'0.9' => '90%',
'1' => '100%',
]); ?>
<?= $form->field($model, 'user_questionnaire_uuid')->textInput(['maxlength' => true]) ?>

View File

@ -20,13 +20,6 @@ $this->params['breadcrumbs'][] = $this->title;
<?= Html::a('Новый ответ пользователя', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?php
//echo $this->render('_search_by_questionnaire', [
// 'model' => $searchModel,
// ])
?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
@ -50,7 +43,7 @@ $this->params['breadcrumbs'][] = $this->title;
'format' => 'raw',
'filter' => AnswerHelper::answerFlagsList(),
'value' => function ($model) {
return AnswerHelper::answerStatusLabel($model->answer_flag);
return AnswerHelper::userResponseLabel($model->answer_flag);
},
],
[

View File

@ -44,7 +44,7 @@ YiiAsset::register($this);
[
'attribute' => 'answer_flag',
'format' => 'raw',
'value' => AnswerHelper::answerFlagLabel($model->answer_flag),
'value' => AnswerHelper::userResponseLabel($model->answer_flag),
],
'user_questionnaire_uuid',
],

View File

@ -12,6 +12,14 @@ echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'format' => 'raw',
'attribute' => 'user_card_id',
'value' => function ($model) {
return Html::a(Reports::getFio($model) . ' ' . Html::tag('i', null, ['class' => 'far fa-calendar-alt']),
\yii\helpers\Url::base(true) . '/reports/reports/calendar?user_id=' . $model['user_card_id'], ['data-pjax' => 0]);
},
],
[
'attribute' => 'today',
'format' => 'raw',
@ -30,14 +38,6 @@ echo GridView::widget([
],
'difficulties',
'tomorrow',
[
'format' => 'raw',
'attribute' => 'user_card_id',
'value' => function ($model) {
return Html::a(Reports::getFio($model) . ' ' . Html::tag('i', null, ['class' => 'far fa-calendar-alt']),
\yii\helpers\Url::base(true) . '/reports/reports/calendar?user_id=' . $model['user_card_id'], ['data-pjax' => 0]);
},
],
[
'class' => 'yii\grid\ActionColumn',
'urlCreator' => function ($action, $model, $key, $index) {

View File

@ -0,0 +1,24 @@
<?php
namespace backend\modules\test;
/**
* test module definition class
*/
class Test extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'backend\modules\test\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace backend\modules\test\controllers;
use Yii;
use backend\modules\test\models\TestTask;
use backend\modules\test\models\TestTaskSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* TestTaskController implements the CRUD actions for TestTask model.
*/
class TestTaskController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all TestTask models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TestTaskSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single TestTask model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new TestTask model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new TestTask();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing TestTask model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing TestTask model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the TestTask model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return TestTask the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = TestTask::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace backend\modules\test\models;
class TestTask extends \common\models\TestTask
{
}

View File

@ -0,0 +1,71 @@
<?php
namespace backend\modules\test\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\test\models\TestTask;
/**
* TestTaskSearch represents the model behind the search form of `backend\modules\test\models\TestTask`.
*/
class TestTaskSearch extends TestTask
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'level', 'status'], 'integer'],
[['description', 'link'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = TestTask::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'level' => $this->level,
'status' => $this->status,
]);
$query->andFilterWhere(['like', 'description', $this->description])
->andFilterWhere(['like', 'link', $this->link]);
return $dataProvider;
}
}

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>