translet
This commit is contained in:
		
							
								
								
									
										27
									
								
								Bootstrap.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Bootstrap.php
									
									
									
									
									
										Normal file
									
								
							@@ -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": {
 | 
			
		||||
            "dominion\\cron\\": ""
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "extra": {
 | 
			
		||||
        "bootstrap": "dominion\\cron\\Bootstrap"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,19 +2,29 @@
 | 
			
		||||
 | 
			
		||||
namespace dominion\cron\controllers;
 | 
			
		||||
 | 
			
		||||
use Yii;
 | 
			
		||||
use yii\web\Controller;
 | 
			
		||||
use dominion\cron\models\search\MoleTaskSearch;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Default controller for the `cron` module
 | 
			
		||||
 */
 | 
			
		||||
class DefaultController extends Controller
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Renders the index view for the module
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    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,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								messages/message.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								messages/message.php
									
									
									
									
									
										Normal file
									
								
							@@ -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 [
 | 
			
		||||
    
 | 
			
		||||
];
 | 
			
		||||
							
								
								
									
										4
									
								
								messages/ru-RU/mole.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								messages/ru-RU/mole.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
<?php
 | 
			
		||||
return [
 | 
			
		||||
    "ID" => 'wwww',
 | 
			
		||||
];
 | 
			
		||||
@@ -56,23 +56,23 @@ class MoleTask extends \yii\db\ActiveRecord
 | 
			
		||||
    public function attributeLabels()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'id' => Yii::t('dominion\cron\app', 'ID'),
 | 
			
		||||
            'parentId' => Yii::t('dominion\cron\app', 'Parent ID'),
 | 
			
		||||
            'dateAdd' => Yii::t('dominion\cron\app', 'Date Add'),
 | 
			
		||||
            'dateStart' => Yii::t('dominion\cron\app', 'Date Start'),
 | 
			
		||||
            'dateEnd' => Yii::t('dominion\cron\app', 'Date End'),
 | 
			
		||||
            'module' => Yii::t('dominion\cron\app', 'Module'),
 | 
			
		||||
            'controller' => Yii::t('dominion\cron\app', 'Controller'),
 | 
			
		||||
            'type' => Yii::t('dominion\cron\app', 'Type'),
 | 
			
		||||
            'name' => Yii::t('dominion\cron\app', 'Name'),
 | 
			
		||||
            'params' => Yii::t('dominion\cron\app', 'Params'),
 | 
			
		||||
            'isReady' => Yii::t('dominion\cron\app', 'Is Ready'),
 | 
			
		||||
            'completed' => Yii::t('dominion\cron\app', 'Completed'),
 | 
			
		||||
            'priority' => Yii::t('dominion\cron\app', 'Priority'),
 | 
			
		||||
            'childsTotalCount' => Yii::t('dominion\cron\app', 'Childs Total Count'),
 | 
			
		||||
            'childsCompleted' => Yii::t('dominion\cron\app', 'Childs Completed'),
 | 
			
		||||
            'status' => Yii::t('dominion\cron\app', 'Status'),
 | 
			
		||||
            'project' => Yii::t('dominion\cron\app', 'Project'),
 | 
			
		||||
            'id' => Yii::t('mole', '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'),
 | 
			
		||||
            'module' => Yii::t('mole', 'Module'),
 | 
			
		||||
            'controller' => Yii::t('mole', 'Controller'),
 | 
			
		||||
            'type' => Yii::t('mole', 'Type'),
 | 
			
		||||
            'name' => Yii::t('mole', 'Name'),
 | 
			
		||||
            'params' => Yii::t('mole', 'Params'),
 | 
			
		||||
            'isReady' => Yii::t('mole', 'Is Ready'),
 | 
			
		||||
            'completed' => Yii::t('mole', 'Completed'),
 | 
			
		||||
            'priority' => Yii::t('mole', 'Priority'),
 | 
			
		||||
            'childsTotalCount' => Yii::t('mole', 'Childs Total Count'),
 | 
			
		||||
            'childsCompleted' => Yii::t('mole', 'Childs Completed'),
 | 
			
		||||
            'status' => Yii::t('mole', 'Status'),
 | 
			
		||||
            'project' => Yii::t('mole', 'Project'),*/
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										91
									
								
								models/search/MoleTaskSearch.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								models/search/MoleTaskSearch.php
									
									
									
									
									
										Normal file
									
								
							@@ -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">
 | 
			
		||||
    <h1><?= $this->context->action->uniqueId ?></h1>
 | 
			
		||||
    <p>
 | 
			
		||||
        This is the view content for action "<?= $this->context->action->id ?>".
 | 
			
		||||
        The action belongs to the controller "<?= get_class($this->context) ?>"
 | 
			
		||||
        in the "<?= $this->context->module->id ?>" module.
 | 
			
		||||
    </p>
 | 
			
		||||
    <p>
 | 
			
		||||
        You may customize this page by editing the following file:<br>
 | 
			
		||||
        <code><?= __FILE__ ?></code>
 | 
			
		||||
    </p>
 | 
			
		||||
</div>
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Dektrium project.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Dektrium project <http://github.com/dektrium>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE.md
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user