Commit d9b4a7e9e49ab588c8baaa25a74db8014c245139

Authored by andryeyev
1 parent 0769f724

+ каталог в админке (мин. версия)

backend/controllers/CatalogController.php
@@ -87,14 +87,11 @@ class CatalogController extends Controller @@ -87,14 +87,11 @@ class CatalogController extends Controller
87 $model_lang = CatalogLang::find() 87 $model_lang = CatalogLang::find()
88 ->where(['catalog' => $id, 'lang_id' => 1]) 88 ->where(['catalog' => $id, 'lang_id' => 1])
89 ->one(); 89 ->one();
90 -//die(); 90 +
91 if ($model->load(Yii::$app->request->post())) 91 if ($model->load(Yii::$app->request->post()))
92 { 92 {
93 -  
94 - //var_dump($model->title);die();  
95 - echo $model_lang->title = $model->title; 93 + $model_lang->title = $model->title;
96 94
97 - //var_dump($model->save());die();  
98 $model->save(); 95 $model->save();
99 $model_lang->save(); 96 $model_lang->save();
100 97
backend/models/SearchCatalog.php
@@ -90,11 +90,13 @@ class SearchCatalog extends Catalog @@ -90,11 +90,13 @@ class SearchCatalog extends Catalog
90 ->andFilterWhere(['like', 'options', $this->options]); 90 ->andFilterWhere(['like', 'options', $this->options]);
91 91
92 // + поиск по title 92 // + поиск по title
93 - $query->joinWith(['relationTable' => function ($q) 93 + if (! empty ($this->title))
94 { 94 {
95 - //$q->where("catalog_i18n.title LIKE '%". $this->title . "%'");  
96 - $q->where(['like', 'catalog_i18n.title', $this->title]);  
97 - }]); 95 + $query->joinWith(['relationTable' => function ($q)
  96 + {
  97 + $q->where(['like', 'catalog_i18n.title', $this->title]);
  98 + }]);
  99 + }
98 100
99 return $dataProvider; 101 return $dataProvider;
100 } 102 }
backend/views/layouts/left.php
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 'options' => ['class' => 'sidebar-menu'], 31 'options' => ['class' => 'sidebar-menu'],
32 'items' => [ 32 'items' => [
33 ['label' => 'Страница', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']], 33 ['label' => 'Страница', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']],
34 - ['label' => 'Термин', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin_lang/']], 34 + ['label' => 'Каталог', 'icon' => 'fa fa-file-code-o', 'url' => ['/catalog/']],
35 ['label' => 'Меню', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']], 35 ['label' => 'Меню', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']],
36 ['label' => 'Заявки', 'icon' => 'fa fa-file-code-o', 'url' => ['/site/requests/']], 36 ['label' => 'Заявки', 'icon' => 'fa fa-file-code-o', 'url' => ['/site/requests/']],
37 ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']], 37 ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']],