translet
This commit is contained in:
parent
da78311a5c
commit
6db4e4252b
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace dominion\cron;
|
||||||
|
|
||||||
|
|
||||||
|
use yii\base\BootstrapInterface;
|
||||||
|
use yii\i18n\PhpMessageSource;
|
||||||
|
|
||||||
|
|
||||||
|
class Bootstrap implements BootstrapInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
public function bootstrap($app)
|
||||||
|
{
|
||||||
|
var_dump(22222); die();
|
||||||
|
if (!isset($app->get('i18n')->translations['user*']))
|
||||||
|
{
|
||||||
|
$app->get('i18n')->translations['user*'] = [
|
||||||
|
'class' => PhpMessageSource::className(),
|
||||||
|
'basePath' => __DIR__ . '/messages',
|
||||||
|
'sourceLanguage' => 'ru-RU'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,5 +17,8 @@
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"dominion\\cron\\": ""
|
"dominion\\cron\\": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"bootstrap": "dominion\\cron\\Bootstrap"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,29 @@
|
||||||
|
|
||||||
namespace dominion\cron\controllers;
|
namespace dominion\cron\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
|
use dominion\cron\models\search\MoleTaskSearch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default controller for the `cron` module
|
* Default controller for the `cron` module
|
||||||
*/
|
*/
|
||||||
class DefaultController extends Controller
|
class DefaultController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the index view for the module
|
* Renders the index view for the module
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function actionIndex()
|
public function actionIndex()
|
||||||
{
|
{
|
||||||
return $this->render('index');
|
$searchModel = new MoleTaskSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
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,4 +0,0 @@
|
||||||
<?php
|
|
||||||
return [
|
|
||||||
|
|
||||||
];
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"ID" => 'wwww',
|
||||||
|
];
|
|
@ -56,23 +56,23 @@ class MoleTask extends \yii\db\ActiveRecord
|
||||||
public function attributeLabels()
|
public function attributeLabels()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => Yii::t('dominion\cron\app', 'ID'),
|
'id' => Yii::t('mole', 'ID'),
|
||||||
'parentId' => Yii::t('dominion\cron\app', 'Parent ID'),
|
/* 'parentId' => Yii::t('mole', 'Parent ID'),
|
||||||
'dateAdd' => Yii::t('dominion\cron\app', 'Date Add'),
|
'dateAdd' => Yii::t('mole', 'Date Add'),
|
||||||
'dateStart' => Yii::t('dominion\cron\app', 'Date Start'),
|
'dateStart' => Yii::t('mole', 'Date Start'),
|
||||||
'dateEnd' => Yii::t('dominion\cron\app', 'Date End'),
|
'dateEnd' => Yii::t('mole', 'Date End'),
|
||||||
'module' => Yii::t('dominion\cron\app', 'Module'),
|
'module' => Yii::t('mole', 'Module'),
|
||||||
'controller' => Yii::t('dominion\cron\app', 'Controller'),
|
'controller' => Yii::t('mole', 'Controller'),
|
||||||
'type' => Yii::t('dominion\cron\app', 'Type'),
|
'type' => Yii::t('mole', 'Type'),
|
||||||
'name' => Yii::t('dominion\cron\app', 'Name'),
|
'name' => Yii::t('mole', 'Name'),
|
||||||
'params' => Yii::t('dominion\cron\app', 'Params'),
|
'params' => Yii::t('mole', 'Params'),
|
||||||
'isReady' => Yii::t('dominion\cron\app', 'Is Ready'),
|
'isReady' => Yii::t('mole', 'Is Ready'),
|
||||||
'completed' => Yii::t('dominion\cron\app', 'Completed'),
|
'completed' => Yii::t('mole', 'Completed'),
|
||||||
'priority' => Yii::t('dominion\cron\app', 'Priority'),
|
'priority' => Yii::t('mole', 'Priority'),
|
||||||
'childsTotalCount' => Yii::t('dominion\cron\app', 'Childs Total Count'),
|
'childsTotalCount' => Yii::t('mole', 'Childs Total Count'),
|
||||||
'childsCompleted' => Yii::t('dominion\cron\app', 'Childs Completed'),
|
'childsCompleted' => Yii::t('mole', 'Childs Completed'),
|
||||||
'status' => Yii::t('dominion\cron\app', 'Status'),
|
'status' => Yii::t('mole', 'Status'),
|
||||||
'project' => Yii::t('dominion\cron\app', 'Project'),
|
'project' => Yii::t('mole', 'Project'),*/
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace dominion\cron\models\search;
|
||||||
|
|
||||||
|
use \Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use dominion\cron\models\MoleTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MoleTaskSearch represents the model behind the search form of `app\models\Articles`.
|
||||||
|
*/
|
||||||
|
class MoleTaskSearch extends MoleTask
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['parentId', 'isReady', 'completed', 'priority', 'childsTotalCount', 'childsCompleted'], 'integer'],
|
||||||
|
[['dateAdd', 'dateStart', 'dateEnd'], 'safe'],
|
||||||
|
[['params'], 'string'],
|
||||||
|
[['module', 'controller', 'type', 'name', 'status'], 'string', 'max' => 255],
|
||||||
|
[['project'], 'string', 'max' => 50],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 = MoleTask::find();
|
||||||
|
// add conditions that should always apply here
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
'sort' => [
|
||||||
|
'defaultOrder' => [
|
||||||
|
'id' => SORT_DESC
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'parentId' => $this->parentId,
|
||||||
|
'isReady' => $this->isReady,
|
||||||
|
'completed' => $this->completed,
|
||||||
|
'priority' => $this->priority,
|
||||||
|
'childsTotalCount' => $this->childsTotalCount,
|
||||||
|
'childsCompleted' => $this->childsCompleted,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'params', $this->params])
|
||||||
|
->andFilterWhere(['like', 'controller', $this->controller])
|
||||||
|
->andFilterWhere(['like', 'module', $this->module])
|
||||||
|
->andFilterWhere(['like', 'type', $this->type])
|
||||||
|
->andFilterWhere(['like', 'name', $this->name])
|
||||||
|
->andFilterWhere(['like', 'status', $this->status])
|
||||||
|
->andFilterWhere(['like', 'project', $this->project]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,47 @@
|
||||||
<div class="cron-default-index">
|
<?php
|
||||||
<h1><?= $this->context->action->uniqueId ?></h1>
|
/*
|
||||||
<p>
|
* This file is part of the Dektrium project.
|
||||||
This is the view content for action "<?= $this->context->action->id ?>".
|
*
|
||||||
The action belongs to the controller "<?= get_class($this->context) ?>"
|
* (c) Dektrium project <http://github.com/dektrium>
|
||||||
in the "<?= $this->context->module->id ?>" module.
|
*
|
||||||
</p>
|
* For the full copyright and license information, please view the LICENSE.md
|
||||||
<p>
|
* file that was distributed with this source code.
|
||||||
You may customize this page by editing the following file:<br>
|
*/
|
||||||
<code><?= __FILE__ ?></code>
|
|
||||||
</p>
|
use yii\grid\GridView;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
use yii\web\View;
|
||||||
|
use yii\widgets\Pjax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \yii\web\View $this
|
||||||
|
* @var \yii\data\ActiveDataProvider $dataProvider
|
||||||
|
* @var \dektrium\user\models\UserSearch $searchModel
|
||||||
|
*/
|
||||||
|
$this->title = Yii::t('app', 'User List');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Manage users'), 'url' => ['']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="wrapper wrapper-content project-manager">
|
||||||
|
<div class="ibox-content">
|
||||||
|
|
||||||
|
<?=
|
||||||
|
GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'filterModel' => $searchModel,
|
||||||
|
'layout' => "{items}\n{pager}",
|
||||||
|
'columns' => [
|
||||||
|
[
|
||||||
|
'attribute' => 'id',
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{update}',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue