From d9b4a7e9e49ab588c8baaa25a74db8014c245139 Mon Sep 17 00:00:00 2001 From: andryeyev Date: Fri, 4 Dec 2015 10:53:54 +0200 Subject: [PATCH] + каталог в админке (мин. версия) --- backend/controllers/CatalogController.php | 7 ++----- backend/models/SearchCatalog.php | 10 ++++++---- backend/views/layouts/left.php | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/backend/controllers/CatalogController.php b/backend/controllers/CatalogController.php index f848427..3910d8a 100644 --- a/backend/controllers/CatalogController.php +++ b/backend/controllers/CatalogController.php @@ -87,14 +87,11 @@ class CatalogController extends Controller $model_lang = CatalogLang::find() ->where(['catalog' => $id, 'lang_id' => 1]) ->one(); -//die(); + if ($model->load(Yii::$app->request->post())) { - - //var_dump($model->title);die(); - echo $model_lang->title = $model->title; + $model_lang->title = $model->title; - //var_dump($model->save());die(); $model->save(); $model_lang->save(); diff --git a/backend/models/SearchCatalog.php b/backend/models/SearchCatalog.php index 3721f44..baac514 100644 --- a/backend/models/SearchCatalog.php +++ b/backend/models/SearchCatalog.php @@ -90,11 +90,13 @@ class SearchCatalog extends Catalog ->andFilterWhere(['like', 'options', $this->options]); // + поиск по title - $query->joinWith(['relationTable' => function ($q) + if (! empty ($this->title)) { - //$q->where("catalog_i18n.title LIKE '%". $this->title . "%'"); - $q->where(['like', 'catalog_i18n.title', $this->title]); - }]); + $query->joinWith(['relationTable' => function ($q) + { + $q->where(['like', 'catalog_i18n.title', $this->title]); + }]); + } return $dataProvider; } diff --git a/backend/views/layouts/left.php b/backend/views/layouts/left.php index e7d06ef..01c5ffd 100644 --- a/backend/views/layouts/left.php +++ b/backend/views/layouts/left.php @@ -31,7 +31,7 @@ 'options' => ['class' => 'sidebar-menu'], 'items' => [ ['label' => 'Страница', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']], - ['label' => 'Термин', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin_lang/']], + ['label' => 'Каталог', 'icon' => 'fa fa-file-code-o', 'url' => ['/catalog/']], ['label' => 'Меню', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']], ['label' => 'Заявки', 'icon' => 'fa fa-file-code-o', 'url' => ['/site/requests/']], ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']], -- libgit2 0.21.4