36867 Интеграция с модерацией, реализация cron-task
This commit is contained in:
		
							
								
								
									
										39
									
								
								Module.php
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								Module.php
									
									
									
									
									
								
							@@ -2,31 +2,46 @@
 | 
			
		||||
 | 
			
		||||
namespace dominion\cron;
 | 
			
		||||
 | 
			
		||||
use yii\base\BootstrapInterface;
 | 
			
		||||
use yii\i18n\PhpMessageSource;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * cron module definition class
 | 
			
		||||
 */
 | 
			
		||||
class Module extends \yii\base\Module
 | 
			
		||||
class Module extends \yii\base\Module implements BootstrapInterface
 | 
			
		||||
{
 | 
			
		||||
    public $admins = [];
 | 
			
		||||
    public $project = 'yii';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public $controllerNamespace = 'dominion\cron\controllers';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function init()
 | 
			
		||||
    {
 | 
			
		||||
        parent::init();
 | 
			
		||||
 | 
			
		||||
        // custom initialization code goes here
 | 
			
		||||
    }
 | 
			
		||||
    public function bootstrap($app)
 | 
			
		||||
    {
 | 
			
		||||
        if ($app instanceof \yii\console\Application) {
 | 
			
		||||
        if ($app instanceof \yii\web\Application)
 | 
			
		||||
        {
 | 
			
		||||
            $app->getUrlManager()->addRules([
 | 
			
		||||
                ['class' => 'yii\web\UrlRule', 'pattern' => $this->id, 'route' => $this->id . '/default/index'],
 | 
			
		||||
                ['class' => 'yii\web\UrlRule', 'pattern' => $this->id . '/<id:\w+>', 'route' => $this->id . '/default/view'],
 | 
			
		||||
                ['class' => 'yii\web\UrlRule', 'pattern' => $this->id . '/<controller:[\w\-]+>/<action:[\w\-]+>', 'route' => $this->id . '/<controller>/<action>'],
 | 
			
		||||
                ], false);
 | 
			
		||||
        }
 | 
			
		||||
        elseif ($app instanceof \yii\console\Application)
 | 
			
		||||
        {
 | 
			
		||||
            $app->controllerMap[$this->id] = [
 | 
			
		||||
                'class' => 'dominion\cron\console\MoleController',
 | 
			
		||||
                'module' => $this,
 | 
			
		||||
              //  'module' => $this,
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!isset($app->get('i18n')->translations['mole*']))
 | 
			
		||||
        {
 | 
			
		||||
            $app->get('i18n')->translations['mole*'] = [
 | 
			
		||||
                'class' => PhpMessageSource::className(),
 | 
			
		||||
                'basePath' => __DIR__ . '/messages',
 | 
			
		||||
                'sourceLanguage' => 'en-US'
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,11 +6,13 @@
 | 
			
		||||
 * @license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace dominion\cron\commands;
 | 
			
		||||
namespace dominion\cron\console;
 | 
			
		||||
 | 
			
		||||
use Yii;
 | 
			
		||||
use yii\console\Controller;
 | 
			
		||||
use yii\console\ExitCode;
 | 
			
		||||
use dominion\cron\models\MoleTask;
 | 
			
		||||
use yii\base\InlineAction;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Запуск агента по расписанию
 | 
			
		||||
@@ -20,14 +22,13 @@ use dominion\cron\models\MoleTask;
 | 
			
		||||
 */
 | 
			
		||||
class MoleController extends Controller
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Запуск всех агентов для проекта yii из mole_task
 | 
			
		||||
     * @return int Exit code
 | 
			
		||||
     */
 | 
			
		||||
    public function actionIndex()
 | 
			
		||||
    {
 | 
			
		||||
        $filePatch = __DIR__.'/../runtime/lock.lock';
 | 
			
		||||
        $filePatch = Yii::getAlias('@app/runtime/lock.lock');
 | 
			
		||||
        if(!file_exists($filePatch))
 | 
			
		||||
        {
 | 
			
		||||
            $fp = fopen($filePatch, "w");
 | 
			
		||||
 
 | 
			
		||||
@@ -5,12 +5,33 @@ namespace dominion\cron\controllers;
 | 
			
		||||
use Yii;
 | 
			
		||||
use yii\web\Controller;
 | 
			
		||||
use dominion\cron\models\search\MoleTaskSearch;
 | 
			
		||||
use dominion\cron\models\MoleTask;
 | 
			
		||||
use yii\filters\VerbFilter;
 | 
			
		||||
use yii\web\NotFoundHttpException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Default controller for the `cron` module
 | 
			
		||||
 */
 | 
			
		||||
class DefaultController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    public function behaviors()
 | 
			
		||||
    {
 | 
			
		||||
        if (!Yii::$app->user->getIsGuest() && in_array(Yii::$app->user->id, $this->module->admins))
 | 
			
		||||
        {
 | 
			
		||||
            return [
 | 
			
		||||
                'verbs' => [
 | 
			
		||||
                    'class' => VerbFilter::className(),
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'delete' => ['POST'],
 | 
			
		||||
                    ],
 | 
			
		||||
                ],
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotFoundHttpException(Yii::t('mole', 'access denied'));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Renders the index view for the module
 | 
			
		||||
@@ -27,4 +48,88 @@ class DefaultController extends Controller
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Displays a single MoleTask model.
 | 
			
		||||
     * @param integer $id
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     * @throws NotFoundHttpException if the model cannot be found
 | 
			
		||||
     */
 | 
			
		||||
    public function actionView($id)
 | 
			
		||||
    {
 | 
			
		||||
        $model = $this->findModel($id);
 | 
			
		||||
        return $this->render('view', [
 | 
			
		||||
                'model' => $model,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a new MoleTask model.
 | 
			
		||||
     * If creation is successful, the browser will be redirected to the 'view' page.
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public function actionCreate()
 | 
			
		||||
    {
 | 
			
		||||
        $model = new MoleTask();
 | 
			
		||||
 | 
			
		||||
        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 MoleTask 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 MoleTask 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 MoleTask model based on its primary key value.
 | 
			
		||||
     * If the model is not found, a 404 HTTP exception will be thrown.
 | 
			
		||||
     * @param integer $id
 | 
			
		||||
     * @return MoleTask the loaded model
 | 
			
		||||
     * @throws NotFoundHttpException if the model cannot be found
 | 
			
		||||
     */
 | 
			
		||||
    protected function findModel($id)
 | 
			
		||||
    {
 | 
			
		||||
        if (($model = MoleTask::findOne($id)) !== null)
 | 
			
		||||
        {
 | 
			
		||||
            return $model;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new NotFoundHttpException(Yii::t('mole', 'The requested page does not exist.'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,27 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
var_dump(22222);
 | 
			
		||||
return [
 | 
			
		||||
    'sourcePath' => __DIR__ . '/../',
 | 
			
		||||
    'messagePath' => __DIR__,
 | 
			
		||||
    'languages' => [
 | 
			
		||||
        'ru-RU',
 | 
			
		||||
    ],
 | 
			
		||||
    'translator' => 'Yii::t',
 | 
			
		||||
    'sort' => false,
 | 
			
		||||
    'overwrite' => true,
 | 
			
		||||
    'removeUnused' => false,
 | 
			
		||||
    'only' => ['*.php'],
 | 
			
		||||
    'except' => [
 | 
			
		||||
        '.svn',
 | 
			
		||||
        '.git',
 | 
			
		||||
        '.gitignore',
 | 
			
		||||
        '.gitkeep',
 | 
			
		||||
        '.hgignore',
 | 
			
		||||
        '.hgkeep',
 | 
			
		||||
        '/messages',
 | 
			
		||||
        '/tests',
 | 
			
		||||
        '/vendor',
 | 
			
		||||
    ],
 | 
			
		||||
    'format' => 'php',
 | 
			
		||||
];
 | 
			
		||||
@@ -1,5 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
return [
 | 
			
		||||
    "ID" => 'wwww111',
 | 
			
		||||
    'Task List' => 'Список задач'
 | 
			
		||||
    'Task List' => 'Список задач',
 | 
			
		||||
    'Project' => 'Проект',
 | 
			
		||||
    'Parent ID' => 'Родительский процесс',
 | 
			
		||||
    'Date Add' => 'Дата создания',
 | 
			
		||||
    'Date Start' => 'Дата запуска',
 | 
			
		||||
    'Date End' => 'Дата завершения',
 | 
			
		||||
    'Module' => 'Модуль',
 | 
			
		||||
    'Controller' => 'Контроллер',
 | 
			
		||||
    'Type' => 'Тип',
 | 
			
		||||
    'Name' => 'Название',
 | 
			
		||||
    'Params' => 'Параметры',
 | 
			
		||||
    'Is Ready' => 'Готов',
 | 
			
		||||
    'Completed' => 'Завершен',
 | 
			
		||||
    'Priority' => 'Приоритет',
 | 
			
		||||
   // 'Childs Total Count' => '',
 | 
			
		||||
   // 'Childs Completed' => '',
 | 
			
		||||
    'Status' => 'Статус',
 | 
			
		||||
    'Yes' => 'Да',
 | 
			
		||||
    'No' => 'Нет',
 | 
			
		||||
    'Create Task' => 'Создать задачу',
 | 
			
		||||
    'Save' => 'Сохранить',
 | 
			
		||||
    'Update'=> 'Изменить',
 | 
			
		||||
    'Update Task: {nameAttribute}' => 'Изменить задачу: {nameAttribute}',
 | 
			
		||||
    'Delete' => 'Удалить',
 | 
			
		||||
 ];
 | 
			
		||||
@@ -41,7 +41,7 @@ class MoleTask extends \yii\db\ActiveRecord
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [['parentId', 'isReady', 'childsTotalCount', 'childsCompleted', 'status'], 'required'],
 | 
			
		||||
            //[['parentId', 'isReady', 'childsTotalCount', 'childsCompleted', 'status'], 'required'],
 | 
			
		||||
            [['parentId', 'isReady', 'completed', 'priority', 'childsTotalCount', 'childsCompleted'], 'integer'],
 | 
			
		||||
            [['dateAdd', 'dateStart', 'dateEnd'], 'safe'],
 | 
			
		||||
            [['params'], 'string'],
 | 
			
		||||
@@ -57,7 +57,7 @@ class MoleTask extends \yii\db\ActiveRecord
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'id' => Yii::t('mole', 'ID'),
 | 
			
		||||
           /* 'parentId' => Yii::t('mole', 'Parent ID'),
 | 
			
		||||
            'parentId' => Yii::t('mole', 'Parent ID'),
 | 
			
		||||
            'dateAdd' => Yii::t('mole', 'Date Add'),
 | 
			
		||||
            'dateStart' => Yii::t('mole', 'Date Start'),
 | 
			
		||||
            'dateEnd' => Yii::t('mole', 'Date End'),
 | 
			
		||||
@@ -72,7 +72,23 @@ class MoleTask extends \yii\db\ActiveRecord
 | 
			
		||||
            'childsTotalCount' => Yii::t('mole', 'Childs Total Count'),
 | 
			
		||||
            'childsCompleted' => Yii::t('mole', 'Childs Completed'),
 | 
			
		||||
            'status' => Yii::t('mole', 'Status'),
 | 
			
		||||
            'project' => Yii::t('mole', 'Project'),*/
 | 
			
		||||
            'project' => Yii::t('mole', 'Project'),
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Выбираем все строки с project
 | 
			
		||||
     */
 | 
			
		||||
    public function getAllTask()
 | 
			
		||||
    {
 | 
			
		||||
        return self::find()
 | 
			
		||||
            ->andWhere([
 | 
			
		||||
                'project'=> Yii::$app->getModule('cron')->project,
 | 
			
		||||
                'completed' => 0,
 | 
			
		||||
            ])
 | 
			
		||||
            ->andWhere(['IS', 'dateStart', NULL])
 | 
			
		||||
            ->andWhere(['IS', 'dateEnd', NULL])
 | 
			
		||||
           // ->andWhere(['<=', 'dateAdd', date('Y-m-d H:i:s')])
 | 
			
		||||
            ->all();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ class MoleTaskSearch extends MoleTask
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [['parentId', 'isReady', 'completed', 'priority', 'childsTotalCount', 'childsCompleted'], 'integer'],
 | 
			
		||||
            [['id', 'parentId', 'isReady', 'completed', 'priority', 'childsTotalCount', 'childsCompleted'], 'integer'],
 | 
			
		||||
            [['dateAdd', 'dateStart', 'dateEnd'], 'safe'],
 | 
			
		||||
            [['params'], 'string'],
 | 
			
		||||
            [['module', 'controller', 'type', 'name', 'status'], 'string', 'max' => 255],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								views/default/_form.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								views/default/_form.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use yii\helpers\Html;
 | 
			
		||||
use yii\widgets\ActiveForm;
 | 
			
		||||
 | 
			
		||||
/* @var $this yii\web\View */
 | 
			
		||||
/* @var $model app\models\MailType */
 | 
			
		||||
/* @var $form yii\widgets\ActiveForm */
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<?php $form = ActiveForm::begin(['options' => ['class' => "form-horizontal"]]); ?>
 | 
			
		||||
<?php $template = '{label}<div class="col-sm-10">{input}<span class="help-block m-b-none">{error}</span></div>'; ?>
 | 
			
		||||
 | 
			
		||||
<?= $form->field($model, 'project', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
 | 
			
		||||
<?= $form->field($model, 'name', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
 | 
			
		||||
<?= $form->field($model, 'dateAdd', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
<?= $form->field($model, 'dateStart', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
<?= $form->field($model, 'dateEnd', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
 | 
			
		||||
<?= $form->field($model, 'module', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
 | 
			
		||||
<?= $form->field($model, 'controller', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
<?= $form->field($model, 'params', ['template' => $template, 'labelOptions' => ['class' => 'col-sm-2 control-label']]); ?>
 | 
			
		||||
 | 
			
		||||
<div class="form-group">
 | 
			
		||||
    <div class="col-sm-12 col-sm-offset-2">
 | 
			
		||||
        <?= Html::submitButton(Yii::t('mole', 'Save'), ['class' => 'btn btn-success']) ?>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<?php ActiveForm::end(); ?>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								views/default/create.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								views/default/create.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use yii\helpers\Html;
 | 
			
		||||
 | 
			
		||||
/* @var $this yii\web\View */
 | 
			
		||||
/* @var $model app\models\MailType */
 | 
			
		||||
 | 
			
		||||
$this->title = Yii::t('mole', 'Create Task');
 | 
			
		||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('mole', 'Task List'), 'url' => ['index']];
 | 
			
		||||
$this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
?>
 | 
			
		||||
<div class="wrapper wrapper-content">
 | 
			
		||||
	<div class="row">
 | 
			
		||||
		<div class="col-lg-12">
 | 
			
		||||
			<div class="tabs-container">
 | 
			
		||||
				<div class="tab-content">
 | 
			
		||||
					<div class="tab-pane active">
 | 
			
		||||
						<div class="panel-body">
 | 
			
		||||
							<?=
 | 
			
		||||
							$this->render('_form', [
 | 
			
		||||
								'model' => $model,
 | 
			
		||||
							])
 | 
			
		||||
							?>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -22,8 +22,17 @@ use yii\widgets\Pjax;
 | 
			
		||||
$this->title = Yii::t('mole', 'Task List');
 | 
			
		||||
$this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
?>
 | 
			
		||||
<div class="wrapper wrapper-content project-manager">
 | 
			
		||||
	<div class="ibox-content">
 | 
			
		||||
<div class="wrapper wrapper-content">
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-lg-12">
 | 
			
		||||
            <div class="tabs-container">
 | 
			
		||||
                <div class="tab-content">
 | 
			
		||||
                    <div class="tab-pane active">
 | 
			
		||||
                        <div class="panel-body">
 | 
			
		||||
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <?= Html::a(Yii::t('mole', 'Create Task'), ['create'], ['class' => 'btn btn-success']) ?>
 | 
			
		||||
                            </p>
 | 
			
		||||
 | 
			
		||||
                            <?=
 | 
			
		||||
                            GridView::widget([
 | 
			
		||||
@@ -32,13 +41,46 @@ $this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
                                'layout' => "{items}\n{pager}",
 | 
			
		||||
                                'columns' => [
 | 
			
		||||
                                    'id',
 | 
			
		||||
 | 
			
		||||
                                    'project',
 | 
			
		||||
                                    'name',
 | 
			
		||||
                                    // 'parentId',
 | 
			
		||||
                                    'dateAdd:datetime',
 | 
			
		||||
                                    'dateStart:datetime',
 | 
			
		||||
                                    'dateEnd:datetime',
 | 
			
		||||
                                    //'module',
 | 
			
		||||
                                    'controller',
 | 
			
		||||
                                    // 'type',
 | 
			
		||||
                                    //'params',
 | 
			
		||||
                                    [
 | 
			
		||||
                                        'attribute' => 'isReady',
 | 
			
		||||
                                        'value' => function($model)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            return $model->isReady ? Yii::t('mole', 'Yes') : Yii::t('mole', 'No');
 | 
			
		||||
                                        },
 | 
			
		||||
                                    //   'filter' => [0 => Yii::t('mole', 'No'), 1 => Yii::t('mole', 'Yes')]
 | 
			
		||||
                                    ],
 | 
			
		||||
                                    [
 | 
			
		||||
                                        'attribute' => 'completed',
 | 
			
		||||
                                        'value' => function($model)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            return $model->completed ? Yii::t('mole', 'Yes') : Yii::t('mole', 'No');
 | 
			
		||||
                                        },
 | 
			
		||||
                                    //    'filter' => [0 => Yii::t('mole', 'No'), 1 => Yii::t('mole', 'Yes')]
 | 
			
		||||
                                    ],
 | 
			
		||||
                                    'priority',
 | 
			
		||||
                                    //'childsTotalCount',
 | 
			
		||||
                                    //'childsCompleted',
 | 
			
		||||
                                    // 'status',
 | 
			
		||||
                                    [
 | 
			
		||||
                                        'class' => 'yii\grid\ActionColumn',
 | 
			
		||||
					'template' => '{update}',
 | 
			
		||||
                                    ],
 | 
			
		||||
                                ],
 | 
			
		||||
                            ]);
 | 
			
		||||
                            ?>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								views/default/update.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								views/default/update.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use yii\helpers\Html;
 | 
			
		||||
 | 
			
		||||
/* @var $this yii\web\View */
 | 
			
		||||
/* @var $model app\models\MailType */
 | 
			
		||||
 | 
			
		||||
$this->title = Yii::t('mole', 'Update Task: {nameAttribute}', [
 | 
			
		||||
		'nameAttribute' => $model->name,
 | 
			
		||||
	]);
 | 
			
		||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('mole', 'Task List'), 'url' => ['index']];
 | 
			
		||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
 | 
			
		||||
$this->params['breadcrumbs'][] = Yii::t('mole', 'Update');
 | 
			
		||||
?>
 | 
			
		||||
<div class="wrapper wrapper-content">
 | 
			
		||||
	<div class="row">
 | 
			
		||||
		<div class="col-lg-12">
 | 
			
		||||
			<div class="tabs-container">
 | 
			
		||||
				<div class="tab-content">
 | 
			
		||||
					<div class="tab-pane active">
 | 
			
		||||
						<div class="panel-body">
 | 
			
		||||
 | 
			
		||||
							<?=
 | 
			
		||||
							$this->render('_form', [
 | 
			
		||||
								'model' => $model,
 | 
			
		||||
							])
 | 
			
		||||
							?>
 | 
			
		||||
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										85
									
								
								views/default/view.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								views/default/view.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use yii\helpers\Html;
 | 
			
		||||
use yii\widgets\DetailView;
 | 
			
		||||
use yii\grid\GridView;
 | 
			
		||||
use app\components\Helper;
 | 
			
		||||
 | 
			
		||||
/* @var $this yii\web\View */
 | 
			
		||||
/* @var $model app\models\MailType */
 | 
			
		||||
 | 
			
		||||
$this->title = $model->name;
 | 
			
		||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('mole', 'Task List'), 'url' => ['index']];
 | 
			
		||||
$this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
?>
 | 
			
		||||
<div class="wrapper wrapper-content">
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-lg-12">
 | 
			
		||||
            <div class="tabs-container">
 | 
			
		||||
                <div class="tab-content">
 | 
			
		||||
                    <div class="tab-pane active">
 | 
			
		||||
                        <div class="panel-body">
 | 
			
		||||
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <?= Html::a(Yii::t('mole', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
 | 
			
		||||
                                <?=
 | 
			
		||||
                                Html::a(Yii::t('mole', 'Delete'), ['delete', 'id' => $model->id], [
 | 
			
		||||
                                    'class' => 'btn btn-danger',
 | 
			
		||||
                                    'data' => [
 | 
			
		||||
                                        'confirm' => Yii::t('mole', 'Are you sure you want to delete this item?'),
 | 
			
		||||
                                        'method' => 'post',
 | 
			
		||||
                                    ],
 | 
			
		||||
                                ])
 | 
			
		||||
                                ?>
 | 
			
		||||
                            </p>
 | 
			
		||||
 | 
			
		||||
                            <?=
 | 
			
		||||
                            DetailView::widget([
 | 
			
		||||
                                'model' => $model,
 | 
			
		||||
                                'attributes' => [
 | 
			
		||||
                                    'id',
 | 
			
		||||
                                    'project',
 | 
			
		||||
                                    'name',
 | 
			
		||||
                                    'parentId',
 | 
			
		||||
                                    'dateAdd:datetime',
 | 
			
		||||
                                    'dateStart:datetime',
 | 
			
		||||
                                    'dateEnd:datetime',
 | 
			
		||||
                                    'module',
 | 
			
		||||
                                    'controller',
 | 
			
		||||
                                    'type',
 | 
			
		||||
                                    [
 | 
			
		||||
                                        'attribute' => 'params',
 | 
			
		||||
                                        'value' => function($model)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            return print_r(json_decode($model->params, true), true);
 | 
			
		||||
                                        },
 | 
			
		||||
                                    ],
 | 
			
		||||
                                    [
 | 
			
		||||
                                        'attribute' => 'isReady',
 | 
			
		||||
                                        'value' => function($model)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            return $model->isReady ? Yii::t('mole', 'Yes') : Yii::t('mole', 'No');
 | 
			
		||||
                                        },
 | 
			
		||||
                                    ],
 | 
			
		||||
                                    [
 | 
			
		||||
                                        'attribute' => 'completed',
 | 
			
		||||
                                        'value' => function($model)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            return $model->completed ? Yii::t('mole', 'Yes') : Yii::t('mole', 'No');
 | 
			
		||||
                                        },
 | 
			
		||||
                                    ],
 | 
			
		||||
                                    'priority',
 | 
			
		||||
                                    'status',
 | 
			
		||||
                                ],
 | 
			
		||||
                            ])
 | 
			
		||||
                            ?>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user