Commit 762a49eb by dianc

Merge remote-tracking branch 'origin/development' into development

parents 23fcf85c 5034d186
...@@ -34,19 +34,20 @@ $config = [ ...@@ -34,19 +34,20 @@ $config = [
], ],
], ],
'modules' => [ 'modules' => [
'business' => [
'class' => 'backend\modules\business\Module',
],
'location' => [
'class' => 'backend\modules\location\Module',
],
'i18n' => [ 'i18n' => [
'class' => 'backend\modules\i18n\Module', 'class' => 'backend\modules\i18n\Module',
'defaultRoute' => 'i18n-message/index' 'defaultRoute' => 'i18n-message/index'
], ],
'theme' => [ 'theme' => [
'class' => 'backend\modules\theme\Module', 'class' => 'backend\modules\theme\Module',
],
'business' => [
'class' => 'backend\modules\business\Module',
],
'location' => [
'class' => 'backend\modules\location\Module',
] ]
], ],
'as globalAccess' => [ 'as globalAccess' => [
'class' => '\common\behaviors\GlobalAccessBehavior', 'class' => '\common\behaviors\GlobalAccessBehavior',
......
...@@ -46,7 +46,8 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -46,7 +46,8 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at', // 'created_at',
// 'updated_at', // 'updated_at',
['class' => 'yii\grid\ActionColumn'], ['class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}'],
], ],
]); ?> ]); ?>
</div> </div>
...@@ -8,6 +8,8 @@ use backend\modules\location\models\search\DistrictSearch; ...@@ -8,6 +8,8 @@ use backend\modules\location\models\search\DistrictSearch;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use yii\helpers\ArrayHelper;
use common\models\State;
/** /**
* DistrictController implements the CRUD actions for District model. * DistrictController implements the CRUD actions for District model.
...@@ -64,12 +66,14 @@ class DistrictController extends Controller ...@@ -64,12 +66,14 @@ class DistrictController extends Controller
public function actionCreate() public function actionCreate()
{ {
$model = new District(); $model = new District();
$states = ArrayHelper::map(State::find()->all(), 'id', 'name');
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['view', 'id' => $model->id]);
} else { } else {
return $this->render('create', [ return $this->render('create', [
'model' => $model, 'model' => $model,
'states' => $states,
]); ]);
} }
} }
...@@ -83,12 +87,14 @@ class DistrictController extends Controller ...@@ -83,12 +87,14 @@ class DistrictController extends Controller
public function actionUpdate($id) public function actionUpdate($id)
{ {
$model = $this->findModel($id); $model = $this->findModel($id);
$states = ArrayHelper::map(State::find()->all(), 'id', 'name');
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['view', 'id' => $model->id]);
} else { } else {
return $this->render('update', [ return $this->render('update', [
'model' => $model, 'model' => $model,
'states' => $states,
]); ]);
} }
} }
...@@ -106,6 +112,7 @@ class DistrictController extends Controller ...@@ -106,6 +112,7 @@ class DistrictController extends Controller
return $this->redirect(['index']); return $this->redirect(['index']);
} }
/** /**
* Finds the District model based on its primary key value. * Finds the District model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown. * If the model is not found, a 404 HTTP exception will be thrown.
......
...@@ -2,54 +2,49 @@ ...@@ -2,54 +2,49 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\State;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\District */ /* @var $model common\models\District */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
/* @var $states array */
?> ?>
<div class="district-form"> <div class="district-form">
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<div id="myTabContent" class="tab-content"> <div class="row">
<div class="tab-pane fade in active" id="info"> <div class="col-md-3">
<div class="page-header">
<h3>Info</h3> <?= $form->field($model, 'state_id')->dropDownList($states) ?>
</div>
<div class="row"> </div>
<div class="col-md-6"> </div>
<div class="row">
<?= $form->field($model, 'state_id')->dropDownList(ArrayHelper::map(State::find()->all(), 'id', 'name')) ?> <div class="col-md-3">
</div> <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
<div class="row"> </div>
<div class="col-md-6"> </div>
<div class="row">
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]) ?> <div class="col-md-3">
</div> <?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
<div class="row"> </div>
<div class="col-md-6"> </div>
<div class="row">
<?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]) ?> <div class="col-md-3">
</div> <?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div> </div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
......
<?php <?php
use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\District */ /* @var $model common\models\District */
/* @var $states array */
$this->title = Yii::t('backend', 'Create District'); $this->title = Yii::t('backend', 'Create District');
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend', 'Districts'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => Yii::t('backend', 'Districts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="district-create">
<div class="district-create">
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
'states' => $states
]) ?> ]) ?>
</div> </div>
...@@ -39,7 +39,8 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -39,7 +39,8 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at', // 'created_at',
// 'updated_at', // 'updated_at',
['class' => 'yii\grid\ActionColumn'], ['class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}'],
], ],
]); ?> ]); ?>
</div> </div>
...@@ -4,6 +4,7 @@ use yii\helpers\Html; ...@@ -4,6 +4,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\District */ /* @var $model common\models\District */
/* @var $states array */
$this->title = Yii::t('backend', 'Update {modelClass}: ', [ $this->title = Yii::t('backend', 'Update {modelClass}: ', [
'modelClass' => 'District', 'modelClass' => 'District',
...@@ -18,6 +19,7 @@ $this->params['breadcrumbs'][] = Yii::t('backend', 'Update'); ...@@ -18,6 +19,7 @@ $this->params['breadcrumbs'][] = Yii::t('backend', 'Update');
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
'states' => $states
]) ?> ]) ?>
</div> </div>
...@@ -12,38 +12,34 @@ use yii\widgets\ActiveForm; ...@@ -12,38 +12,34 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<div id="myTabContent" class="tab-content"> <div class="row">
<div class="tab-pane fade in active" id="info"> <div class="col-md-3">
<div class="page-header">
<h3>Info</h3> <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div> </div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div> </div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'status')->dropDownList($model::statuses()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>
...@@ -10,6 +10,7 @@ use yii\grid\GridView; ...@@ -10,6 +10,7 @@ use yii\grid\GridView;
$this->title = Yii::t('backend', 'States'); $this->title = Yii::t('backend', 'States');
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="state-index"> <div class="state-index">
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
...@@ -18,6 +19,7 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -18,6 +19,7 @@ $this->params['breadcrumbs'][] = $this->title;
<p> <p>
<?= Html::a(Yii::t('backend', 'Create State'), ['create'], ['class' => 'btn btn-success']) ?> <?= Html::a(Yii::t('backend', 'Create State'), ['create'], ['class' => 'btn btn-success']) ?>
</p> </p>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,
...@@ -38,7 +40,9 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -38,7 +40,9 @@ $this->params['breadcrumbs'][] = $this->title;
//'created_at', //'created_at',
// 'updated_at', // 'updated_at',
['class' => 'yii\grid\ActionColumn'], ['class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}'],
], ],
]); ?> ]); ?>
</div> </div>
...@@ -48,13 +48,17 @@ $bundle = BackendAsset::register($this); ...@@ -48,13 +48,17 @@ $bundle = BackendAsset::register($this);
</span> </span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li class="header"><?= Yii::t('backend', 'You have {num} log items', ['num' => \backend\models\SystemLog::find()->count()]) ?></li> <li class="header"><?= Yii::t('backend', 'You have {num} log items',
['num' => \backend\models\SystemLog::find()->count()]) ?></li>
<li> <li>
<!-- inner menu: contains the actual data --> <!-- inner menu: contains the actual data -->
<ul class="menu"> <ul class="menu">
<?php foreach (\backend\models\SystemLog::find()->orderBy(['log_time' => SORT_DESC])->limit(5)->all() as $logEntry): ?> <?php foreach (\backend\models\SystemLog::find()->orderBy(['log_time' => SORT_DESC])->limit(5)->all() as $logEntry): ?>
<li> <li>
<a href="<?= Yii::$app->urlManager->createUrl(['/log/view', 'id' => $logEntry->id]) ?>"> <a href="<?= Yii::$app->urlManager->createUrl([
'/log/view',
'id' => $logEntry->id
]) ?>">
<i class="fa fa-warning <?= $logEntry->level == \yii\log\Logger::LEVEL_ERROR ? 'text-red' : 'text-yellow' ?>"></i> <i class="fa fa-warning <?= $logEntry->level == \yii\log\Logger::LEVEL_ERROR ? 'text-red' : 'text-yellow' ?>"></i>
<?= $logEntry->category ?> <?= $logEntry->category ?>
</a> </a>
...@@ -71,7 +75,8 @@ $bundle = BackendAsset::register($this); ...@@ -71,7 +75,8 @@ $bundle = BackendAsset::register($this);
<li class="dropdown user user-menu"> <li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img <img
src="<?= Yii::$app->user->identity->userProfile->getAvatar($this->assetManager->getAssetUrl($bundle, 'img/anonymous.jpg')) ?>" src="<?= Yii::$app->user->identity->userProfile->getAvatar($this->assetManager->getAssetUrl($bundle,
'img/anonymous.jpg')) ?>"
class="user-image"> class="user-image">
<span><?= Yii::$app->user->identity->username ?> <i class="caret"></i></span> <span><?= Yii::$app->user->identity->username ?> <i class="caret"></i></span>
</a> </a>
...@@ -79,24 +84,29 @@ $bundle = BackendAsset::register($this); ...@@ -79,24 +84,29 @@ $bundle = BackendAsset::register($this);
<!-- User image --> <!-- User image -->
<li class="user-header light-blue"> <li class="user-header light-blue">
<img <img
src="<?= Yii::$app->user->identity->userProfile->getAvatar($this->assetManager->getAssetUrl($bundle, 'img/anonymous.jpg')) ?>" src="<?= Yii::$app->user->identity->userProfile->getAvatar($this->assetManager->getAssetUrl($bundle,
'img/anonymous.jpg')) ?>"
class="img-circle" alt="User Image"/> class="img-circle" alt="User Image"/>
<p> <p>
<?= Yii::$app->user->identity->username ?> <?= Yii::$app->user->identity->username ?>
<small> <small>
<?= Yii::t('backend', 'Member since {0, date, short}', Yii::$app->user->identity->created_at) ?> <?= Yii::t('backend', 'Member since {0, date, short}',
Yii::$app->user->identity->created_at) ?>
</small> </small>
</li> </li>
<!-- Menu Footer--> <!-- Menu Footer-->
<li class="user-footer"> <li class="user-footer">
<div class="pull-left"> <div class="pull-left">
<?= Html::a(Yii::t('backend', 'Profile'), ['/sign-in/profile'], ['class' => 'btn btn-default btn-flat']) ?> <?= Html::a(Yii::t('backend', 'Profile'), ['/sign-in/profile'],
['class' => 'btn btn-default btn-flat']) ?>
</div> </div>
<div class="pull-left"> <div class="pull-left">
<?= Html::a(Yii::t('backend', 'Account'), ['/sign-in/account'], ['class' => 'btn btn-default btn-flat']) ?> <?= Html::a(Yii::t('backend', 'Account'), ['/sign-in/account'],
['class' => 'btn btn-default btn-flat']) ?>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<?= Html::a(Yii::t('backend', 'Logout'), ['/sign-in/logout'], ['class' => 'btn btn-default btn-flat', 'data-method' => 'post']) ?> <?= Html::a(Yii::t('backend', 'Logout'), ['/sign-in/logout'],
['class' => 'btn btn-default btn-flat', 'data-method' => 'post']) ?>
</div> </div>
</li> </li>
</ul> </ul>
...@@ -116,11 +126,13 @@ $bundle = BackendAsset::register($this); ...@@ -116,11 +126,13 @@ $bundle = BackendAsset::register($this);
<div class="user-panel"> <div class="user-panel">
<div class="pull-left image"> <div class="pull-left image">
<img <img
src="<?= Yii::$app->user->identity->userProfile->getAvatar($this->assetManager->getAssetUrl($bundle, 'img/anonymous.jpg')) ?>" src="<?= Yii::$app->user->identity->userProfile->getAvatar($this->assetManager->getAssetUrl($bundle,
'img/anonymous.jpg')) ?>"
class="img-circle"/> class="img-circle"/>
</div> </div>
<div class="pull-left info"> <div class="pull-left info">
<p><?= Yii::t('backend', 'Hello, {username}', ['username' => Yii::$app->user->identity->getPublicIdentity()]) ?></p> <p><?= Yii::t('backend', 'Hello, {username}',
['username' => Yii::$app->user->identity->getPublicIdentity()]) ?></p>
<a href="<?= Url::to(['/sign-in/profile']) ?>"> <a href="<?= Url::to(['/sign-in/profile']) ?>">
<i class="fa fa-circle text-success"></i> <i class="fa fa-circle text-success"></i>
<?= Yii::$app->formatter->asDatetime(time()) ?> <?= Yii::$app->formatter->asDatetime(time()) ?>
...@@ -151,25 +163,39 @@ $bundle = BackendAsset::register($this); ...@@ -151,25 +163,39 @@ $bundle = BackendAsset::register($this);
'icon' => '<i class="fa fa-edit"></i>', 'icon' => '<i class="fa fa-edit"></i>',
'options' => ['class' => 'treeview'], 'options' => ['class' => 'treeview'],
'items' => [ 'items' => [
['label' => Yii::t('backend', 'Static pages'), 'url' => ['/page/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], [
['label' => Yii::t('backend', 'Articles'), 'url' => ['/article/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'label' => Yii::t('backend', 'Static pages'),
['label' => Yii::t('backend', 'Article Categories'), 'url' => ['/article-category/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'url' => ['/page/index'],
['label' => Yii::t('backend', 'Text Widgets'), 'url' => ['/widget-text/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'icon' => '<i class="fa fa-angle-double-right"></i>'
['label' => Yii::t('backend', 'Menu Widgets'), 'url' => ['/widget-menu/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], ],
['label' => Yii::t('backend', 'Carousel Widgets'), 'url' => ['/widget-carousel/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], [
'label' => Yii::t('backend', 'Articles'),
'url' => ['/article/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'Article Categories'),
'url' => ['/article-category/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'Text Widgets'),
'url' => ['/widget-text/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'Menu Widgets'),
'url' => ['/widget-menu/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'Carousel Widgets'),
'url' => ['/widget-carousel/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
] ]
], ],
[ [
'label' => Yii::t('backend', 'System'),
'options' => ['class' => 'header']
],
[
'label' => Yii::t('backend', 'Users'),
'icon' => '<i class="fa fa-users"></i>',
'url' => ['/user/index'],
'visible' => Yii::$app->user->can('administrator')
],
[
'label' => Yii::t('backend', 'Category'), 'label' => Yii::t('backend', 'Category'),
'icon' => '<i class="fa fa-sitemap"></i>', 'icon' => '<i class="fa fa-sitemap"></i>',
'url' => ['/theme/category/index'], 'url' => ['/theme/category/index'],
...@@ -182,17 +208,35 @@ $bundle = BackendAsset::register($this); ...@@ -182,17 +208,35 @@ $bundle = BackendAsset::register($this);
'visible' => Yii::$app->user->can('administrator'), 'visible' => Yii::$app->user->can('administrator'),
'options' => ['class' => 'treeview'], 'options' => ['class' => 'treeview'],
'items' => [ 'items' => [
['label' => Yii::t('backend', 'State'), 'url' => ['/location/state'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], [
['label' => Yii::t('backend', 'District'), 'url' => ['/location/district'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'label' => Yii::t('backend', 'State'),
'url' => ['/location/state'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'District'),
'url' => ['/location/district'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
] ]
], ],
[ [
'label' => Yii::t('backend', 'Business'), 'label' => Yii::t('backend', 'Business'),
'icon' => '<i class="fa fa-sitemap"></i>', 'icon' => '<i class="fa fa-suitcase"></i>',
'url' => ['/business/business'], 'url' => ['/business/business'],
'visible' => Yii::$app->user->can('administrator') 'visible' => Yii::$app->user->can('administrator')
], ],
[ [
'label' => Yii::t('backend', 'System'),
'options' => ['class' => 'header']
],
[
'label' => Yii::t('backend', 'Users'),
'icon' => '<i class="fa fa-users"></i>',
'url' => ['/user/index'],
'visible' => Yii::$app->user->can('administrator')
],
[
'label' => Yii::t('backend', 'Other'), 'label' => Yii::t('backend', 'Other'),
'url' => '#', 'url' => '#',
'icon' => '<i class="fa fa-cogs"></i>', 'icon' => '<i class="fa fa-cogs"></i>',
...@@ -204,14 +248,38 @@ $bundle = BackendAsset::register($this); ...@@ -204,14 +248,38 @@ $bundle = BackendAsset::register($this);
'icon' => '<i class="fa fa-flag"></i>', 'icon' => '<i class="fa fa-flag"></i>',
'options' => ['class' => 'treeview'], 'options' => ['class' => 'treeview'],
'items' => [ 'items' => [
['label' => Yii::t('backend', 'i18n Source Message'), 'url' => ['/i18n/i18n-source-message/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], [
['label' => Yii::t('backend', 'i18n Message'), 'url' => ['/i18n/i18n-message/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'label' => Yii::t('backend', 'i18n Source Message'),
'url' => ['/i18n/i18n-source-message/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'i18n Message'),
'url' => ['/i18n/i18n-message/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
] ]
], ],
['label' => Yii::t('backend', 'Key-Value Storage'), 'url' => ['/key-storage/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], [
['label' => Yii::t('backend', 'File Storage'), 'url' => ['/file-storage/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'label' => Yii::t('backend', 'Key-Value Storage'),
['label' => Yii::t('backend', 'Cache'), 'url' => ['/cache/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'url' => ['/key-storage/index'],
['label' => Yii::t('backend', 'File Manager'), 'url' => ['/file-manager/index'], 'icon' => '<i class="fa fa-angle-double-right"></i>'], 'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'File Storage'),
'url' => ['/file-storage/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'Cache'),
'url' => ['/cache/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[
'label' => Yii::t('backend', 'File Manager'),
'url' => ['/file-manager/index'],
'icon' => '<i class="fa fa-angle-double-right"></i>'
],
[ [
'label' => Yii::t('backend', 'System Information'), 'label' => Yii::t('backend', 'System Information'),
'url' => ['/system-information/index'], 'url' => ['/system-information/index'],
...@@ -243,15 +311,19 @@ $bundle = BackendAsset::register($this); ...@@ -243,15 +311,19 @@ $bundle = BackendAsset::register($this);
<?php endif; ?> <?php endif; ?>
</h1> </h1>
<?= Breadcrumbs::widget(['tag' => 'ol', <?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],]) ?> 'tag' => 'ol',
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
</section> </section>
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
<?php if (Yii::$app->session->hasFlash('alert')): ?> <?php if (Yii::$app->session->hasFlash('alert')): ?>
<?= \yii\bootstrap\Alert::widget(['body' => ArrayHelper::getValue(Yii::$app->session->getFlash('alert'), 'body'), <?= \yii\bootstrap\Alert::widget([
'options' => ArrayHelper::getValue(Yii::$app->session->getFlash('alert'), 'options'),]) ?> 'body' => ArrayHelper::getValue(Yii::$app->session->getFlash('alert'), 'body'),
'options' => ArrayHelper::getValue(Yii::$app->session->getFlash('alert'), 'options'),
]) ?>
<?php endif; ?> <?php endif; ?>
<?= $content ?> <?= $content ?>
</section><!-- /.content --> </section><!-- /.content -->
......
...@@ -56,6 +56,7 @@ class District extends \yii\db\ActiveRecord ...@@ -56,6 +56,7 @@ class District extends \yii\db\ActiveRecord
{ {
return [ return [
[['state_id', 'name'], 'required'], [['state_id', 'name'], 'required'],
['name', 'unique', 'targetAttribute' => ['name', 'state_id']],
[['state_id', 'status', 'created_at', 'updated_at'], 'integer'], [['state_id', 'status', 'created_at', 'updated_at'], 'integer'],
[['name', 'slug'], 'string', 'max' => 1024], [['name', 'slug'], 'string', 'max' => 1024],
[['state_id'], 'exist', 'skipOnError' => true, 'targetClass' => State::className(), 'targetAttribute' => ['state_id' => 'id']], [['state_id'], 'exist', 'skipOnError' => true, 'targetClass' => State::className(), 'targetAttribute' => ['state_id' => 'id']],
...@@ -69,7 +70,7 @@ class District extends \yii\db\ActiveRecord ...@@ -69,7 +70,7 @@ class District extends \yii\db\ActiveRecord
{ {
return [ return [
'id' => Yii::t('common', 'ID'), 'id' => Yii::t('common', 'ID'),
'state_id' => Yii::t('common', 'State ID'), 'state_id' => Yii::t('common', 'State'),
'name' => Yii::t('common', 'Name'), 'name' => Yii::t('common', 'Name'),
'slug' => Yii::t('common', 'Slug'), 'slug' => Yii::t('common', 'Slug'),
'status' => Yii::t('common', 'Status'), 'status' => Yii::t('common', 'Status'),
...@@ -110,4 +111,8 @@ class District extends \yii\db\ActiveRecord ...@@ -110,4 +111,8 @@ class District extends \yii\db\ActiveRecord
self::STATUS_IN_ACTIVE => Yii::t('common', 'In Active'), self::STATUS_IN_ACTIVE => Yii::t('common', 'In Active'),
]; ];
} }
public static function statelist(){
}
} }
...@@ -37,7 +37,6 @@ class State extends \yii\db\ActiveRecord ...@@ -37,7 +37,6 @@ class State extends \yii\db\ActiveRecord
[ [
'class' => SluggableBehavior::className(), 'class' => SluggableBehavior::className(),
'attribute' => 'name', 'attribute' => 'name',
'immutable' => true
], ],
[ [
'class' => TimestampBehavior::className(), 'class' => TimestampBehavior::className(),
...@@ -54,6 +53,7 @@ class State extends \yii\db\ActiveRecord ...@@ -54,6 +53,7 @@ class State extends \yii\db\ActiveRecord
{ {
return [ return [
[['name'], 'required'], [['name'], 'required'],
[['name'], 'unique'],
[['status', 'created_at', 'updated_at'], 'integer'], [['status', 'created_at', 'updated_at'], 'integer'],
[['name', 'slug'], 'string', 'max' => 1024], [['name', 'slug'], 'string', 'max' => 1024],
]; ];
...@@ -91,6 +91,10 @@ class State extends \yii\db\ActiveRecord ...@@ -91,6 +91,10 @@ class State extends \yii\db\ActiveRecord
return new \common\models\query\StateQuery(get_called_class()); return new \common\models\query\StateQuery(get_called_class());
} }
/**
* List all status
* @return array
*/
public static function statuses() public static function statuses()
{ {
return [ return [
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace common\models\query; namespace common\models\query;
use common\models\State;
/** /**
* This is the ActiveQuery class for [[\common\models\State]]. * This is the ActiveQuery class for [[\common\models\State]].
* *
...@@ -31,4 +33,9 @@ class StateQuery extends \yii\db\ActiveQuery ...@@ -31,4 +33,9 @@ class StateQuery extends \yii\db\ActiveQuery
{ {
return parent::one($db); return parent::one($db);
} }
public function active()
{
return $this->andWhere(['status' => State::STATUS_ACTIVE]);
}
} }
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