From 21aedefeed0a22c8419daa654fe596d9766226ee Mon Sep 17 00:00:00 2001 From: yarik Date: Sat, 22 Oct 2016 00:35:17 +0300 Subject: [PATCH] Another one admin fix --- backend/controllers/BgController.php | 6 +++++- backend/controllers/SeoCategoryController.php | 20 +++++--------------- backend/controllers/SeoController.php | 6 +++++- backend/controllers/SeoDynamicController.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++--------------- backend/controllers/SubscribeController.php | 136 ---------------------------------------------------------------------------------------------------------------------------------------- backend/views/bg/index.php | 42 +++++++++++++++++++++++------------------- backend/views/bg/update.php | 4 ++-- backend/views/bg/view.php | 49 ++++++++++++++++++++++++++++++------------------- backend/views/certificate/index.php | 50 +++++++++++++++++++++++++++++--------------------- backend/views/certificate/view.php | 52 +++++++++++++++++++++++++++++++++------------------- backend/views/customer/_form.php | 76 ++++++++++++++++++++++++++++++++++++++++++---------------------------------- backend/views/customer/_search.php | 35 ----------------------------------- backend/views/customer/index.php | 43 ++++++++++++++++++++++--------------------- backend/views/customer/update.php | 34 ++++++++++++++++++++++------------ backend/views/customer/view.php | 48 ++++++++++++++++++++++++++++++------------------ backend/views/layouts/main-sidebar.php | 6 ------ backend/views/seo-category/index.php | 83 ++++++++++++++++++++++++++++++++--------------------------------------------------- backend/views/seo-category/update.php | 4 ++-- backend/views/seo-category/view.php | 46 ---------------------------------------------- backend/views/seo-dynamic/create.php | 15 ++++++++++----- backend/views/seo-dynamic/index.php | 44 ++++++++++++++++++++++++++++---------------- backend/views/seo-dynamic/update.php | 26 +++++++++++++++----------- backend/views/seo-dynamic/view.php | 47 +++++++++++++++++++++++++++++++++++++---------- backend/views/seo/index.php | 56 ++++++++++++++++++++++++++++++++++++++------------------ backend/views/seo/update.php | 4 ++-- backend/views/seo/view.php | 51 +++++++++++++++++++++++++++++++++------------------ backend/views/subscribe/_form.php | 25 ------------------------- backend/views/subscribe/_search.php | 33 --------------------------------- backend/views/subscribe/create.php | 21 --------------------- backend/views/subscribe/index.php | 35 ----------------------------------- backend/views/subscribe/update.php | 21 --------------------- backend/views/subscribe/view.php | 38 -------------------------------------- common/models/Bg.php | 4 +++- common/models/BgSearch.php | 27 ++++++++++++++++++++++++--- common/models/SeoCategorySearch.php | 34 ++++++++++++++++++++++++++++------ common/models/SeoDynamicSearch.php | 54 ++++++++++++++++++++++++++++++++++++++++++------------ common/models/SeoSearch.php | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------- common/models/Subscribe.php | 30 ------------------------------ common/models/SubscribeSearch.php | 71 ----------------------------------------------------------------------- 39 files changed, 731 insertions(+), 913 deletions(-) delete mode 100755 backend/controllers/SubscribeController.php delete mode 100755 backend/views/customer/_search.php delete mode 100755 backend/views/seo-category/view.php delete mode 100755 backend/views/subscribe/_form.php delete mode 100755 backend/views/subscribe/_search.php delete mode 100755 backend/views/subscribe/create.php delete mode 100755 backend/views/subscribe/index.php delete mode 100755 backend/views/subscribe/update.php delete mode 100755 backend/views/subscribe/view.php delete mode 100755 common/models/Subscribe.php delete mode 100755 common/models/SubscribeSearch.php diff --git a/backend/controllers/BgController.php b/backend/controllers/BgController.php index fbafd5c..599beee 100755 --- a/backend/controllers/BgController.php +++ b/backend/controllers/BgController.php @@ -154,7 +154,11 @@ */ protected function findModel($id) { - if(( $model = Bg::findOne($id) ) !== NULL) { + if(( $model = Bg::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== NULL + ) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/backend/controllers/SeoCategoryController.php b/backend/controllers/SeoCategoryController.php index 0c390f0..09c7945 100755 --- a/backend/controllers/SeoCategoryController.php +++ b/backend/controllers/SeoCategoryController.php @@ -59,20 +59,6 @@ } /** - * Displays a single SeoCategory model. - * - * @param integer $id - * - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** * Creates a new SeoCategory model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed @@ -151,7 +137,11 @@ */ protected function findModel($id) { - if(( $model = SeoCategory::findOne($id) ) !== NULL) { + if(( $model = SeoCategory::find() + ->where([ 'seo_category_id' => $id ]) + ->with('lang') + ->one() ) !== NULL + ) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/backend/controllers/SeoController.php b/backend/controllers/SeoController.php index 84b137b..d1130d8 100755 --- a/backend/controllers/SeoController.php +++ b/backend/controllers/SeoController.php @@ -151,7 +151,11 @@ */ protected function findModel($id) { - if(( $model = Seo::findOne($id) ) !== NULL) { + if(( $model = Seo::find() + ->where([ 'seo_id' => $id ]) + ->with('lang') + ->one() ) !== NULL + ) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/backend/controllers/SeoDynamicController.php b/backend/controllers/SeoDynamicController.php index 2ce776a..1b10cff 100755 --- a/backend/controllers/SeoDynamicController.php +++ b/backend/controllers/SeoDynamicController.php @@ -2,6 +2,7 @@ namespace backend\controllers; + use common\models\SeoCategory; use Yii; use common\models\SeoDynamic; use common\models\SeoDynamicSearch; @@ -45,42 +46,52 @@ /** * Lists all SeoDynamic models. + * + * @param int $seo_category_id + * * @return mixed */ public function actionIndex($seo_category_id) { + $seo_category = $this->findCategory($seo_category_id); $searchModel = new SeoDynamicSearch(); $dataProvider = $searchModel->search($seo_category_id, Yii::$app->request->queryParams); return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'seo_category_id' => $seo_category_id, + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'seo_category' => $seo_category, ]); } /** * Displays a single SeoDynamic model. * + * @param integer $seo_category_id * @param integer $id * * @return mixed */ public function actionView($seo_category_id, $id) { + $seo_category = $this->findCategory($seo_category_id); return $this->render('view', [ - 'model' => $this->findModel($id), - 'seo_category_id' => $seo_category_id, + 'model' => $this->findModel($id), + 'seo_category' => $seo_category, ]); } /** * Creates a new SeoDynamic model. * If creation is successful, the browser will be redirected to the 'view' page. + * + * @param integer $seo_category_id + * * @return mixed */ public function actionCreate($seo_category_id) { + $seo_category = $this->findCategory($seo_category_id); $model = new SeoDynamic(); $model->generateLangs(); if($model->load(Yii::$app->request->post())) { @@ -89,14 +100,14 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'index', - 'seo_category_id' => $model->seo_category_id, + 'seo_category_id' => $seo_category_id, ]); } } return $this->render('create', [ - 'model' => $model, - 'model_langs' => $model->model_langs, - 'seo_category_id' => $seo_category_id, + 'model' => $model, + 'model_langs' => $model->model_langs, + 'seo_category' => $seo_category, ]); } @@ -104,27 +115,29 @@ * Updates an existing SeoDynamic model. * If update is successful, the browser will be redirected to the 'view' page. * + * @param integer $seo_category_id * @param integer $id * * @return mixed */ public function actionUpdate($seo_category_id, $id) { + $seo_category = $this->findCategory($seo_category_id); $model = $this->findModel($id); - $model_langs = $model->generateLangs(); + $model->generateLangs(); if($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); if($model->save() && $model->transactionStatus) { return $this->redirect([ 'index', - 'seo_category_id' => $model->seo_category_id, + 'seo_category_id' => $seo_category_id, ]); } } return $this->render('update', [ - 'model' => $model, - 'model_langs' => $model_langs, - 'seo_category_id' => $seo_category_id, + 'model' => $model, + 'model_langs' => $model->model_langs, + 'seo_category' => $seo_category, ]); } @@ -132,6 +145,7 @@ * Deletes an existing SeoDynamic model. * If deletion is successful, the browser will be redirected to the 'index' page. * + * @param integer $seo_category_id * @param integer $id * * @return mixed @@ -158,7 +172,24 @@ */ protected function findModel($id) { - if(( $model = SeoDynamic::findOne($id) ) !== NULL) { + if(( $model = SeoDynamic::find() + ->where([ 'seo_dynamic_id' => $id ]) + ->with('lang') + ->one() ) !== NULL + ) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + protected function findCategory($id) + { + if(( $model = SeoCategory::find() + ->where([ 'seo_category_id' => $id ]) + ->with('lang') + ->one() ) !== NULL + ) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/backend/controllers/SubscribeController.php b/backend/controllers/SubscribeController.php deleted file mode 100755 index 211bddf..0000000 --- a/backend/controllers/SubscribeController.php +++ /dev/null @@ -1,136 +0,0 @@ -[ - 'class' => AccessBehavior::className(), - 'rules' => - ['site' => - [ - [ - 'actions' => ['login', 'error'], - 'allow' => true, - ] - ] - ] - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - /** - * Lists all Subscribe models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new SubscribeSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single Subscribe model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Subscribe model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Subscribe(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing Subscribe model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing Subscribe model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Subscribe model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Subscribe the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Subscribe::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/backend/views/bg/index.php b/backend/views/bg/index.php index 5c5994c..baf2d1b 100755 --- a/backend/views/bg/index.php +++ b/backend/views/bg/index.php @@ -1,32 +1,36 @@ title = \Yii::t('app', 'Bgs'); -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\grid\GridView; + + /** + * @var yii\web\View $this + * @var common\models\BgSearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + */ + $this->title = \Yii::t('app', 'Bgs'); + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- render('_search', ['model' => $searchModel]); ?> - +

- 'btn btn-success']) ?> + 'btn btn-success' ]) ?>

$dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], 'id', - 'url', + 'url:url', + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], 'imageUrl:image', - ['class' => 'yii\grid\ActionColumn'], + [ 'class' => 'yii\grid\ActionColumn' ], ], ]); ?>
diff --git a/backend/views/bg/update.php b/backend/views/bg/update.php index 8f919d8..7753c93 100755 --- a/backend/views/bg/update.php +++ b/backend/views/bg/update.php @@ -11,13 +11,13 @@ * @var BgLang[] $model_langs */ - $this->title = \Yii::t('app', 'Update Bg: ') . $model->id; + $this->title = \Yii::t('app', 'Update Bg: ') . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => \Yii::t('app', 'Bgs'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->id, + 'label' => $model->lang->title, 'url' => [ 'view', 'id' => $model->id, diff --git a/backend/views/bg/view.php b/backend/views/bg/view.php index 00c0d06..d528821 100755 --- a/backend/views/bg/view.php +++ b/backend/views/bg/view.php @@ -1,35 +1,46 @@ title = $model->id; -$this->params['breadcrumbs'][] = ['label' => \Yii::t('app', 'Bgs'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + + /** + * @var yii\web\View $this + * @var common\models\Bg $model + */ + $this->title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('app', 'Bgs'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- +

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ + $model->id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->id, + ], [ 'class' => 'btn btn-danger', - 'data' => [ + 'data' => [ 'confirm' => \Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + 'method' => 'post', ], ]) ?>

- + $model, + 'model' => $model, 'attributes' => [ 'id', - 'url', + 'lang.title', + 'url:url', 'imageUrl:image', ], ]) ?> diff --git a/backend/views/certificate/index.php b/backend/views/certificate/index.php index fd3c673..b781a92 100755 --- a/backend/views/certificate/index.php +++ b/backend/views/certificate/index.php @@ -1,34 +1,42 @@ title = 'Certificates'; -$this->params['breadcrumbs'][] = $this->title; + + use common\models\Certificate; + use yii\helpers\Html; + use yii\grid\GridView; + + /** + * @var yii\web\View $this + * @var common\models\CertificateSearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + */ + $this->title = 'Certificates'; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- render('_search', ['model' => $searchModel]); ?> - +

- 'btn btn-success']) ?> + 'btn btn-success' ]) ?>

$dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], 'certificate_id', 'name', - 'link', - - ['class' => 'yii\grid\ActionColumn'], + [ + 'attribute' => 'link', + 'value' => function($model) { + /** + * @var Certificate $model + */ + return Html::a($model->link, $model->getCertificateUrl()); + }, + 'format' => 'html', + ], + [ 'class' => 'yii\grid\ActionColumn' ], ], ]); ?>
diff --git a/backend/views/certificate/view.php b/backend/views/certificate/view.php index e939e98..f3f9cc8 100755 --- a/backend/views/certificate/view.php +++ b/backend/views/certificate/view.php @@ -1,36 +1,50 @@ title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Certificates', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + + /** + * @var yii\web\View $this + * @var common\models\Certificate $model + */ + $this->title = $model->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Certificates', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- +

- $model->certificate_id], ['class' => 'btn btn-primary']) ?> - $model->certificate_id], [ + $model->certificate_id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->certificate_id, + ], [ 'class' => 'btn btn-danger', - 'data' => [ + 'data' => [ 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', + 'method' => 'post', ], ]) ?>

- + $model, + 'model' => $model, 'attributes' => [ 'certificate_id', 'name', - 'link', + [ + 'attribute' => 'link', + 'value' => Html::a($model->link, $model->getCertificateUrl()), + 'format' => 'html', + ], ], ]) ?> diff --git a/backend/views/customer/_form.php b/backend/views/customer/_form.php index 476f0b7..9c6f5f3 100755 --- a/backend/views/customer/_form.php +++ b/backend/views/customer/_form.php @@ -1,44 +1,52 @@
- + - - field($model, 'id')->textInput() ?> - - field($model, 'username')->textInput(['maxlength' => true]) ?> - - field($model, 'password')->passwordInput(['maxlength' => true]) ?> - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'surname')->textInput(['maxlength' => true]) ?> - - field($model, 'phone')->textInput(['maxlength' => true]) ?> - field($model, 'gender')->textInput(['maxlength' => true]) ?> - - field($model, 'birth_day')->textInput() ?> - - field($model, 'birth_month')->textInput() ?> - - field($model, 'birth_year')->textInput() ?> - - field($model, 'body')->textarea(['rows' => 6]) ?> - - field($model, 'group_id')->textInput() ?> - + field($model, 'username') + ->textInput([ 'maxlength' => true ]) ?> + + field($model, 'name') + ->textInput([ 'maxlength' => true ]) ?> + + field($model, 'surname') + ->textInput([ 'maxlength' => true ]) ?> + + field($model, 'phone') + ->textInput([ 'maxlength' => true ]) ?> + + field($model, 'gender') + ->textInput([ 'maxlength' => true ]) ?> + + field($model, 'birth_day') + ->textInput() ?> + + field($model, 'birth_month') + ->textInput() ?> + + field($model, 'birth_year') + ->textInput() ?> + + field($model, 'body') + ->textarea([ 'rows' => 6 ]) ?> + + field($model, 'group_id') + ->textInput() ?> +
- isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> + isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?>
- +
diff --git a/backend/views/customer/_search.php b/backend/views/customer/_search.php deleted file mode 100755 index 48aed17..0000000 --- a/backend/views/customer/_search.php +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/backend/views/customer/index.php b/backend/views/customer/index.php index 5964fe9..7433dd0 100755 --- a/backend/views/customer/index.php +++ b/backend/views/customer/index.php @@ -1,36 +1,37 @@ title = 'Customers'; -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\grid\GridView; + + /** + * @var yii\web\View $this + * @var common\models\CustomerSearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + */ + $this->title = 'Customers'; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- render('_search', ['model' => $searchModel]); ?> - +

- 'btn btn-success']) ?> + 'btn btn-success' ]) ?>

$dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + 'id', 'username', 'name', 'surname', - 'phone', - - ['class' => 'yii\grid\ActionColumn'], + 'phone', + 'email', + + [ 'class' => 'yii\grid\ActionColumn' ], ], ]); ?>
diff --git a/backend/views/customer/update.php b/backend/views/customer/update.php index 360c058..ced6e53 100755 --- a/backend/views/customer/update.php +++ b/backend/views/customer/update.php @@ -1,19 +1,29 @@ title = 'Update Customer: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update'; + + use yii\helpers\Html; + + /** + * @var yii\web\View $this + * @var common\models\Customer $model + */ + $this->title = 'Update Customer: ' . $model->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Customers', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->name, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Update'; ?>
- +

title) ?>

- + render('_form', [ 'model' => $model, ]) ?> diff --git a/backend/views/customer/view.php b/backend/views/customer/view.php index a954025..4c2622e 100755 --- a/backend/views/customer/view.php +++ b/backend/views/customer/view.php @@ -1,32 +1,42 @@ title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + + /** + * @var yii\web\View $this + * @var common\models\Customer $model + */ + $this->title = $model->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Customers', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- +

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ + $model->id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->id, + ], [ 'class' => 'btn btn-danger', - 'data' => [ + 'data' => [ 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', + 'method' => 'post', ], ]) ?>

- + $model, + 'model' => $model, 'attributes' => [ 'id', 'username', @@ -39,6 +49,8 @@ $this->params['breadcrumbs'][] = $this->title; 'birth_year', 'body:ntext', 'group_id', + 'email', + 'created_at:date', ], ]) ?> diff --git a/backend/views/layouts/main-sidebar.php b/backend/views/layouts/main-sidebar.php index 3879424..07155e4 100755 --- a/backend/views/layouts/main-sidebar.php +++ b/backend/views/layouts/main-sidebar.php @@ -164,12 +164,6 @@ use yii\widgets\Menu; 'options' => ['class'=>\Yii::$app->user->can('bg')? '' :'hide'] ], [ - 'label' => 'Подписка', - 'template'=>' {label}', - 'url' => ['/subscribe/index'], - 'options' => ['class'=>\Yii::$app->user->can('subscribe') ? '' :'hide'], - ], - [ 'template'=>' {label}', 'label' => 'Пользователи', 'url' => ['/customer/index'], diff --git a/backend/views/seo-category/index.php b/backend/views/seo-category/index.php index c4dd174..25115de 100755 --- a/backend/views/seo-category/index.php +++ b/backend/views/seo-category/index.php @@ -1,68 +1,49 @@ title = Yii::t('app', 'Seo Categories'); -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\grid\GridView; + use yii\helpers\Url; + + /** + * @var yii\web\View $this + * @var common\models\SeoCategorySearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + */ + $this->title = Yii::t('app', 'Seo Categories'); + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- render('_search', ['model' => $searchModel]); ?> - +

- 'btn btn-success']) ?> + 'btn btn-success' ]) ?>

$dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], 'seo_category_id', 'controller', + [ + 'attribute' => 'name', + 'value' => 'lang.name', + ], 'status', [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{update} {image} {delete}', - 'buttons' => [ - 'update' => function ($url, $model) - { - return Html::a ( - '', - Url::toRoute(['seo-category/update', 'id' => $model->seo_category_id]), - [ - 'title' => "Редактировать", - ] - ); - }, - 'image' => function ($url, $model) - { - return Html::a ( - '', - Url::toRoute(['seo-dynamic/index', 'seo_category_id' => $model->seo_category_id]), - [ - 'title' => "слайды", - ] - ); - }, - 'delete' => function ($url, $model) - { - return Html::a ( - '', - Url::toRoute(['seo-category/delete', 'id' => $model->seo_category_id]), - [ - 'title' => "Удалить", - ] - ); + 'class' => 'yii\grid\ActionColumn', + 'template' => '{update} {image} {delete}', + 'buttons' => [ + 'image' => function($url, $model) { + return Html::a('', Url::toRoute([ + 'seo-dynamic/index', + 'seo_category_id' => $model->seo_category_id, + ]), [ + 'title' => \Yii::t('app', 'слайды'), + ]); }, ], - 'contentOptions' => ['style' => 'width: 70px;'], ], ], ]); ?> diff --git a/backend/views/seo-category/update.php b/backend/views/seo-category/update.php index 5a8ccc9..fe6d98b 100755 --- a/backend/views/seo-category/update.php +++ b/backend/views/seo-category/update.php @@ -13,13 +13,13 @@ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Seo Category', - ]) . $model->seo_category_id; + ]) . $model->lang->name; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seo Categories'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->seo_category_id, + 'label' => $model->lang->name, 'url' => [ 'view', 'id' => $model->seo_category_id, diff --git a/backend/views/seo-category/view.php b/backend/views/seo-category/view.php deleted file mode 100755 index 3411d25..0000000 --- a/backend/views/seo-category/view.php +++ /dev/null @@ -1,46 +0,0 @@ -title = $model->seo_category_id; - $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('app', 'Seo Categories'), - 'url' => [ 'index' ], - ]; - $this->params[ 'breadcrumbs' ][] = $this->title; -?> -
- -

title) ?>

- -

- $model->seo_category_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - $model->seo_category_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', - ], - ]) ?> -

- - $model, - 'attributes' => [ - 'seo_category_id', - 'controller', - 'status', - ], - ]) ?> - -
diff --git a/backend/views/seo-dynamic/create.php b/backend/views/seo-dynamic/create.php index 278c923..26e9ebd 100755 --- a/backend/views/seo-dynamic/create.php +++ b/backend/views/seo-dynamic/create.php @@ -1,5 +1,6 @@ title = Yii::t('app', 'Create Seo Dynamic'); $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('app', 'Seo Dynamics'), - 'url' => Url::toRoute([ + 'label' => Yii::t('app', 'Seo Categories'), + 'url' => [ '/seo-category/index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $seo_category->lang->name, + 'url' => [ 'index', - 'seo_category_id' => $seo_category_id, - ]), + 'seo_category_id' => $seo_category->seo_category_id, + ], ]; $this->params[ 'breadcrumbs' ][] = $this->title; ?> diff --git a/backend/views/seo-dynamic/index.php b/backend/views/seo-dynamic/index.php index d546768..d0f6cb6 100755 --- a/backend/views/seo-dynamic/index.php +++ b/backend/views/seo-dynamic/index.php @@ -1,25 +1,33 @@ title = Yii::t('app', 'Seo Dynamics'); + /** + * @var yii\web\View $this + * @var common\models\SeoDynamicSearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + * @var SeoCategory $seo_category + */ + $this->title = Yii::t('app', 'Seo Dynamics for {seo_category}', [ + 'seo_category' => $seo_category->lang->name, + ]); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('app', 'Seo Categories'), + 'url' => [ '/seo-category/index' ], + ]; $this->params[ 'breadcrumbs' ][] = $this->title; ?>

title) ?>

- render('_search', ['model' => $searchModel]); ?>

$seo_category_id, + 'seo_category_id' => $seo_category->seo_category_id, ]), [ 'class' => 'btn btn-success' ]) ?>

[ [ 'class' => 'yii\grid\SerialColumn' ], 'seo_dynamic_id', - 'seo_category_id', + [ + 'attribute' => 'name', + 'value' => 'lang.name', + ], 'action', 'fields', + 'param', 'status', [ 'class' => 'yii\grid\ActionColumn', 'buttons' => [ 'view' => function($url, $model) { - return Html::a('', Url::toRoute([ + return Html::a('', [ 'view', 'seo_category_id' => $model->seo_category_id, 'id' => $model->seo_dynamic_id, - ]), [ - 'title' => "Просмотр", - ]); + ], [ + 'title' => \Yii::t('app', 'Просмотр'), + ]); }, 'update' => function($url, $model) { - return Html::a('', Url::toRoute([ + return Html::a('', [ 'update', 'seo_category_id' => $model->seo_category_id, 'id' => $model->seo_dynamic_id, - ]), [ - 'title' => "Редактировать", - ]); + ], [ + 'title' => \Yii::t('app', 'Редактировать'), + ]); }, 'delete' => function($url, $model) { diff --git a/backend/views/seo-dynamic/update.php b/backend/views/seo-dynamic/update.php index 10eeb11..93e2365 100755 --- a/backend/views/seo-dynamic/update.php +++ b/backend/views/seo-dynamic/update.php @@ -1,35 +1,39 @@ title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Seo Dynamic', - ]) . $model->seo_dynamic_id; + ]) . $model->lang->name; $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('app', 'Seo Dynamics'), - 'url' => Url::toRoute([ + 'label' => Yii::t('app', 'Seo Categories'), + 'url' => [ '/seo-category/index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $seo_category->lang->name, + 'url' => [ 'index', - 'seo_category_id' => $seo_category_id, - ]), + 'seo_category_id' => $seo_category->seo_category_id, + ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->seo_dynamic_id, - 'url' => Url::toRoute([ + 'label' => $model->lang->name, + 'url' => [ 'view', - 'seo_category_id' => $seo_category_id, + 'seo_category_id' => $seo_category->seo_category_id, 'id' => $model->seo_dynamic_id, - ]), + ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); ?> diff --git a/backend/views/seo-dynamic/view.php b/backend/views/seo-dynamic/view.php index 6505c0d..ec774c0 100755 --- a/backend/views/seo-dynamic/view.php +++ b/backend/views/seo-dynamic/view.php @@ -1,15 +1,25 @@ title = $model->seo_dynamic_id; + /** + * @var yii\web\View $this + * @var common\models\SeoDynamic $model + * @var SeoCategory $seo_category + */ + $this->title = $model->lang->name; $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('app', 'Seo Dynamics'), - 'url' => [ 'index' ], + 'label' => Yii::t('app', 'Seo Categories'), + 'url' => [ '/seo-category/index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $seo_category->lang->name, + 'url' => [ + 'index', + 'seo_category_id' => $seo_category->seo_category_id, + ], ]; $this->params[ 'breadcrumbs' ][] = $this->title; ?> @@ -20,11 +30,13 @@

$model->seo_dynamic_id, + 'id' => $model->seo_dynamic_id, + 'seo_category_id' => $seo_category->seo_category_id, ], [ 'class' => 'btn btn-primary' ]) ?> $model->seo_dynamic_id, + 'id' => $model->seo_dynamic_id, + 'seo_category_id' => $seo_category->seo_category_id, ], [ 'class' => 'btn btn-danger', 'data' => [ @@ -35,13 +47,28 @@

$model, + 'model' => $model, 'attributes' => [ 'seo_dynamic_id', - 'seo_category_id', + [ + 'label' => \Yii::t('app', 'Seo Category'), + 'value' => Html::a($seo_category->lang->name, [ + 'index', + 'seo_category_id' => $seo_category->seo_category_id, + ]), + 'format' => 'html', + ], + 'lang.name', 'action', 'fields', + 'param', 'status', + 'lang.title', + 'lang.h1', + 'lang.key', + 'lang.meta', + 'lang.description', + 'lang.seo_text', ], ]) ?> diff --git a/backend/views/seo/index.php b/backend/views/seo/index.php index efe65d6..1c541b6 100755 --- a/backend/views/seo/index.php +++ b/backend/views/seo/index.php @@ -1,31 +1,51 @@ title = Yii::t('app', 'Seo'); -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\grid\GridView; + + /** + * @var yii\web\View $this + * @var common\models\SeoSearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + */ + $this->title = Yii::t('app', 'Seo'); + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- render('_search', ['model' => $searchModel]); ?> - +

- 'btn btn-success']) ?> + 'btn btn-success' ]) ?>

$dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], 'seo_id', 'url', - ['class' => 'yii\grid\ActionColumn'], + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + [ + 'attribute' => 'description', + 'value' => 'lang.description', + ], + [ + 'attribute' => 'h1', + 'value' => 'lang.h1', + ], + [ + 'attribute' => 'meta', + 'value' => 'lang.meta', + ], + [ + 'attribute' => 'seo_text', + 'value' => 'lang.seo_text', + ], + [ 'class' => 'yii\grid\ActionColumn' ], ], ]); ?>
diff --git a/backend/views/seo/update.php b/backend/views/seo/update.php index f916983..83c8c89 100755 --- a/backend/views/seo/update.php +++ b/backend/views/seo/update.php @@ -13,13 +13,13 @@ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Seo', - ]) . $model->title; + ]) . $model->url; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seos'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->seo_id, + 'label' => $model->url, 'url' => [ 'view', 'id' => $model->seo_id, diff --git a/backend/views/seo/view.php b/backend/views/seo/view.php index 47f01af..e30c4a7 100755 --- a/backend/views/seo/view.php +++ b/backend/views/seo/view.php @@ -1,35 +1,50 @@ title = $model->seo_id; -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + + /** + * @var yii\web\View $this + * @var common\models\Seo $model + */ + $this->title = $model->url; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('app', 'Seos'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- +

- $model->seo_id], ['class' => 'btn btn-primary']) ?> - $model->seo_id], [ + $model->seo_id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->seo_id, + ], [ 'class' => 'btn btn-danger', - 'data' => [ + 'data' => [ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + 'method' => 'post', ], ]) ?>

- + $model, + 'model' => $model, 'attributes' => [ 'seo_id', 'url', + 'lang.title', + 'lang.description', + 'lang.h1', + 'lang.meta', + 'lang.seo_text', ], ]) ?> diff --git a/backend/views/subscribe/_form.php b/backend/views/subscribe/_form.php deleted file mode 100755 index 36ef492..0000000 --- a/backend/views/subscribe/_form.php +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/backend/views/subscribe/_search.php b/backend/views/subscribe/_search.php deleted file mode 100755 index e2aaf8a..0000000 --- a/backend/views/subscribe/_search.php +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/backend/views/subscribe/create.php b/backend/views/subscribe/create.php deleted file mode 100755 index 3f6f09f..0000000 --- a/backend/views/subscribe/create.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Create Subscribe'; -$this->params['breadcrumbs'][] = ['label' => 'Subscribes', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> - diff --git a/backend/views/subscribe/index.php b/backend/views/subscribe/index.php deleted file mode 100755 index 68e32f3..0000000 --- a/backend/views/subscribe/index.php +++ /dev/null @@ -1,35 +0,0 @@ -title = 'Subscribes'; -$this->params['breadcrumbs'][] = $this->title; -?> - diff --git a/backend/views/subscribe/update.php b/backend/views/subscribe/update.php deleted file mode 100755 index 2137e89..0000000 --- a/backend/views/subscribe/update.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Update Subscribe: ' . $model->id; -$this->params['breadcrumbs'][] = ['label' => 'Subscribes', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update'; -?> - diff --git a/backend/views/subscribe/view.php b/backend/views/subscribe/view.php deleted file mode 100755 index 7c96baa..0000000 --- a/backend/views/subscribe/view.php +++ /dev/null @@ -1,38 +0,0 @@ -title = $model->id; -$this->params['breadcrumbs'][] = ['label' => 'Subscribes', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> - diff --git a/common/models/Bg.php b/common/models/Bg.php index 248dab8..1966aaa 100755 --- a/common/models/Bg.php +++ b/common/models/Bg.php @@ -11,7 +11,9 @@ /** * Class Bg - * @property int $id + * @property int $id + * @property string $url + * @property string $image * @todo Write docs * * From language behavior * * @property BgLang $lang diff --git a/common/models/BgSearch.php b/common/models/BgSearch.php index 2558885..3a7d654 100755 --- a/common/models/BgSearch.php +++ b/common/models/BgSearch.php @@ -11,6 +11,8 @@ class BgSearch extends Bg { + public $title; + /** * @inheritdoc */ @@ -22,7 +24,10 @@ 'integer', ], [ - [ 'url' ], + [ + 'url', + 'title', + ], 'safe', ], ]; @@ -51,12 +56,23 @@ */ public function search($params) { - $query = Bg::find(); + $query = Bg::find() + ->joinWith('lang'); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'url', + 'title' => [ + 'asc' => [ 'bg_lang.title' => SORT_ASC ], + 'desc' => [ 'bg_lang.title' => SORT_DESC ], + ], + ], + ], ]); $this->load($params); @@ -76,7 +92,12 @@ 'like', 'url', $this->url, - ]); + ]) + ->andFilterWhere([ + 'ilike', + 'bg_lang.title', + $this->title, + ]); return $dataProvider; } diff --git a/common/models/SeoCategorySearch.php b/common/models/SeoCategorySearch.php index 2c5ae57..7ca58ee 100755 --- a/common/models/SeoCategorySearch.php +++ b/common/models/SeoCategorySearch.php @@ -12,6 +12,8 @@ class SeoCategorySearch extends SeoCategory { + public $name; + public function behaviors() { return []; @@ -31,7 +33,10 @@ 'integer', ], [ - [ 'controller' ], + [ + 'controller', + 'name', + ], 'safe', ], ]; @@ -55,12 +60,24 @@ */ public function search($params) { - $query = SeoCategory::find(); + $query = SeoCategory::find() + ->joinWith('lang'); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'seo_category_id', + 'controller', + 'status', + 'name' => [ + 'asc' => [ 'seo_category_lang' => SORT_ASC ], + 'desc' => [ 'seo_category_lang' => SORT_DESC ], + ], + ], + ], ]); $this->load($params); @@ -78,10 +95,15 @@ ]); $query->andFilterWhere([ - 'like', - 'controller', - $this->controller, - ]); + 'like', + 'controller', + $this->controller, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_category_lang.name', + $this->name, + ]); return $dataProvider; } diff --git a/common/models/SeoDynamicSearch.php b/common/models/SeoDynamicSearch.php index feffc02..07a1e3c 100755 --- a/common/models/SeoDynamicSearch.php +++ b/common/models/SeoDynamicSearch.php @@ -12,6 +12,8 @@ class SeoDynamicSearch extends SeoDynamic { + public $name; + public function behaviors() { return []; @@ -26,7 +28,6 @@ [ [ 'seo_dynamic_id', - 'seo_category_id', 'status', ], 'integer', @@ -35,6 +36,8 @@ [ 'action', 'fields', + 'name', + 'param', ], 'safe', ], @@ -53,18 +56,33 @@ /** * Creates data provider instance with search query applied * - * @param array $params + * @param integer $seo_category_id + * @param array $params * * @return ActiveDataProvider */ public function search($seo_category_id, $params) { - $query = SeoDynamic::find(); + $query = SeoDynamic::find() + ->joinWith('lang'); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'seo_dynamic_id', + 'action', + 'fields', + 'status', + 'param', + 'name' => [ + 'asc' => [ 'seo_dynamic_lang.name' => SORT_ASC ], + 'desc' => [ 'seo_dynamic_lang.name' => SORT_DESC ], + ], + ], + ], ]); $this->load($params); @@ -76,21 +94,33 @@ } // grid filtering conditions - $query->andFilterWhere([ - 'seo_dynamic_id' => $this->seo_dynamic_id, + $query->andWhere([ 'seo_category_id' => $seo_category_id, - 'status' => $this->status, - ]); + ]) + ->andFilterWhere([ + 'seo_dynamic_id' => $this->seo_dynamic_id, + 'status' => $this->status, + ]); $query->andFilterWhere([ - 'like', - 'action', - $this->action, - ]) + 'ilike', + 'action', + $this->action, + ]) ->andFilterWhere([ - 'like', + 'ilike', 'fields', $this->fields, + ]) + ->andFilterWhere([ + 'ilike', + 'param', + $this->param, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_dynamic_lang.name', + $this->name, ]); return $dataProvider; diff --git a/common/models/SeoSearch.php b/common/models/SeoSearch.php index 33d8fa6..2a1d5c9 100755 --- a/common/models/SeoSearch.php +++ b/common/models/SeoSearch.php @@ -1,73 +1,152 @@ $query, - ]); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); + + public $title; + + public $description; + + public $h1; + + public $meta; + + public $seo_text; + + public function behaviors() + { + return []; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ 'seo_id' ], + 'integer', + ], + [ + [ + 'url', + 'title', + 'description', + 'h1', + 'meta', + 'seo_text', + ], + 'safe', + ], + ]; + } + + /** + * @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 = Seo::find() + ->joinWith('lang'); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'seo_id', + 'url', + 'title' => [ + 'asc' => [ 'seo_lang.title' => SORT_ASC ], + 'desc' => [ 'seo_lang.title' => SORT_DESC ], + ], + 'description' => [ + 'asc' => [ 'seo_lang.description' => SORT_ASC ], + 'desc' => [ 'seo_lang.description' => SORT_DESC ], + ], + 'h1' => [ + 'asc' => [ 'seo_lang.h1' => SORT_ASC ], + 'desc' => [ 'seo_lang.h1' => SORT_DESC ], + ], + 'meta' => [ + 'asc' => [ 'seo_lang.meta' => SORT_ASC ], + 'desc' => [ 'seo_lang.meta' => SORT_DESC ], + ], + 'seo_text' => [ + 'asc' => [ 'seo_lang.seo_text' => SORT_ASC ], + 'desc' => [ 'seo_lang.seo_text' => SORT_DESC ], + ], + ], + ], + ]); + + $this->load($params); + + 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; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'seo_id' => $this->seo_id, + ]); + + $query->andFilterWhere([ + 'like', + 'url', + $this->url, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_lang.title', + $this->title, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_lang.description', + $this->description, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_lang.h1', + $this->h1, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_lang.meta', + $this->meta, + ]) + ->andFilterWhere([ + 'ilike', + 'seo_lang.seo_text', + $this->seo_text, + ]); + return $dataProvider; } - - // grid filtering conditions - $query->andFilterWhere([ - 'seo_id' => $this->seo_id, - ]); - - $query->andFilterWhere(['like', 'url', $this->url]); - - return $dataProvider; } -} diff --git a/common/models/Subscribe.php b/common/models/Subscribe.php deleted file mode 100755 index d0b026e..0000000 --- a/common/models/Subscribe.php +++ /dev/null @@ -1,30 +0,0 @@ -where('email = :email', [':email' => $this->email]) - ->exists()) - $this->addError('email', Yii::t('app', 'emailis')); - } - -} \ No newline at end of file diff --git a/common/models/SubscribeSearch.php b/common/models/SubscribeSearch.php deleted file mode 100755 index 4aeca70..0000000 --- a/common/models/SubscribeSearch.php +++ /dev/null @@ -1,71 +0,0 @@ - $query, - ]); - - $this->load($params); - - 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; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'sale' => $this->sale, - 'sand' => $this->sand, - ]); - - $query->andFilterWhere(['like', 'email', $this->email]); - - return $dataProvider; - } -} -- libgit2 0.21.4