Commit 8d993f36 authored by Shakarim Sapa's avatar Shakarim Sapa

- Added the manage of cases schedule

parent ced33c25
<?php
/**
* Created by PhpStorm.
* User: PHOENIX
* Date: 28.04.16
* Time: 20:11
*/
namespace common\modules\cases\controllers;
use common\components\AdminController;
use common\modules\triggers\models\CasesSchedule;
use yii\data\ActiveDataProvider;
class CasesScheduleAdminController extends AdminController {
/**
* @return array|void
*/
public static function actionsTitles(){
return [
'Manage' => 'Расписание рассылок',
];
}
/**
* @return string
*/
public function actionManage(){
$dataProvider = new ActiveDataProvider([
'query' => CasesSchedule::find()
]);
return $this->render(
'manage',
[
'dataProvider' => $dataProvider
]
);
}
}
\ No newline at end of file
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
/** @var $model common\modules\triggers\models\CasesSchedule */
?>
<div class="trigger-trigger-index">
<h1><?= Html::encode($this->title) ?></h1>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
[
'attribute' => 'actual',
'value' => function($model) {
return ($model->actual==1) ? 'Активен' : 'Не активен';
}
],
[
'attribute' => 'sended',
'value' => function($model) {
return ($model->sended==1) ? 'Отправлено' : 'Не отправлено';
}
],
[
'attribute' => 'user_id',
'value' => function($model) {
return $model->user->getFio();
},
'format' => 'raw'
],
[
'attribute' => 'case_id',
'value' => function($model) {
/** @var $model common\modules\triggers\models\CasesSchedule */
return $model->case->url;
}
],
[
'attribute' => 'template_id',
'value' => function($model) {
/** @var $model common\modules\triggers\models\CasesSchedule */
return $model->template->name;
}
],
[
'attribute' => 'sended_date',
'value' => function($model) {
/** @var $model common\modules\triggers\models\CasesSchedule */
if (!is_null($model->sended_date))
return date('Y.m.d H:i:s', strtotime($model->sended_date));
else {
return 'Планируемая дата отправки: '.((!is_null($model->user->delivery_date)) ? date('d.m.Y', strtotime($model->user->delivery_date)) : 'Не указана');
}
}
],
// [
// 'class' => 'yii\grid\ActionColumn',
// 'template' => '{update}{delete}',
// ],
],
]); ?>
</div>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment