Commit 93c267f7eb898589ee414a9be24cc69927999935
1 parent
d55d2fe0
Multilanguage big commit.
Showing
150 changed files
with
2858 additions
and
3266 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 150 files are displayed.
backend/controllers/ArticlesController.php
... | ... | @@ -86,17 +86,7 @@ |
86 | 86 | $model_langs = $model->generateLangs(); |
87 | 87 | if($model->load(Yii::$app->request->post())) { |
88 | 88 | $model->loadLangs(\Yii::$app->request, $model_langs); |
89 | - if(( $image = UploadedFile::getInstance($model, 'image') )) { | |
90 | - $model->image = $image->name; | |
91 | - } | |
92 | - $imgDir = Yii::getAlias('@storage/articles/'); | |
93 | - if(!is_dir($imgDir)) { | |
94 | - mkdir($imgDir, 0755, true); | |
95 | - } | |
96 | 89 | if($model->save()) { |
97 | - if($image) { | |
98 | - $image->saveAs(Yii::getAlias('@storage/articles/' . $image->name)); | |
99 | - } | |
100 | 90 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
101 | 91 | return $this->redirect([ |
102 | 92 | 'view', |
... | ... | @@ -130,17 +120,7 @@ |
130 | 120 | $model_langs = $model->generateLangs(); |
131 | 121 | if($model->load(Yii::$app->request->post())) { |
132 | 122 | $model->loadLangs(\Yii::$app->request, $model_langs); |
133 | - if(( $image = UploadedFile::getInstance($model, 'image') )) { | |
134 | - $model->image = $image->name; | |
135 | - } | |
136 | - $imgDir = Yii::getAlias('@storage/articles/'); | |
137 | - if(!is_dir($imgDir)) { | |
138 | - mkdir($imgDir, 0755, true); | |
139 | - } | |
140 | 123 | if($model->save()) { |
141 | - if($image) { | |
142 | - $image->saveAs(Yii::getAlias('@storage/articles/' . $image->name)); | |
143 | - } | |
144 | 124 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
145 | 125 | return $this->redirect([ |
146 | 126 | 'view', | ... | ... |
backend/controllers/BannerController.php
backend/controllers/BgController.php
... | ... | @@ -119,7 +119,7 @@ |
119 | 119 | $model_langs = $model->generateLangs(); |
120 | 120 | |
121 | 121 | if($model->load(Yii::$app->request->post()) && $model->save()) { |
122 | - $model->loadLangs(\Yii::$app->request); | |
122 | + $model->loadLangs(\Yii::$app->request, $model_langs); | |
123 | 123 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
124 | 124 | return $this->redirect([ |
125 | 125 | 'view', | ... | ... |
backend/controllers/BrandController.php
backend/controllers/CategoryController.php
... | ... | @@ -88,14 +88,8 @@ |
88 | 88 | |
89 | 89 | if($model->load(Yii::$app->request->post())) { |
90 | 90 | $model->loadLangs(\Yii::$app->request, $model_langs); |
91 | - if(( $image = UploadedFile::getInstance($model, 'imageUpload') )) { | |
92 | - $model->image = $image->name; | |
93 | - } | |
94 | 91 | |
95 | 92 | if($model->save()) { |
96 | - if($image) { | |
97 | - $image->saveAs(Yii::getAlias('@imagesDir/categories/' . $image->name)); | |
98 | - } | |
99 | 93 | |
100 | 94 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
101 | 95 | return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect([ |
... | ... | @@ -117,7 +111,7 @@ |
117 | 111 | 'model' => $model, |
118 | 112 | 'model_langs' => $model_langs, |
119 | 113 | 'categories' => ArtboxTreeHelper::treeMap(Category::find() |
120 | - ->getTree(), 'category_id', 'name', '.'), | |
114 | + ->getTree(), 'category_id', 'category_id', '.'), | |
121 | 115 | ]); |
122 | 116 | } |
123 | 117 | |
... | ... | @@ -136,14 +130,8 @@ |
136 | 130 | $model_langs = $model->generateLangs(); |
137 | 131 | |
138 | 132 | if($model->load(Yii::$app->request->post())) { |
139 | - if(( $image = UploadedFile::getInstance($model, 'imageUpload') )) { | |
140 | - $model->image = $image->name; | |
141 | - } | |
142 | 133 | $model->loadLangs(\Yii::$app->request, $model_langs); |
143 | 134 | if($model->save()) { |
144 | - if($image) { | |
145 | - $image->saveAs(Yii::getAlias('@imagesDir/categories/' . $image->name)); | |
146 | - } | |
147 | 135 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
148 | 136 | return $this->redirect([ |
149 | 137 | 'view', |
... | ... | @@ -156,7 +144,7 @@ |
156 | 144 | 'model' => $model, |
157 | 145 | 'model_langs' => $model_langs, |
158 | 146 | 'categories' => ArtboxTreeHelper::treeMap(Category::find() |
159 | - ->getTree(), 'category_id', 'name', '.'), | |
147 | + ->getTree(), 'category_id', 'category_id', '.'), | |
160 | 148 | ]); |
161 | 149 | } |
162 | 150 | ... | ... |
backend/controllers/EventController.php
... | ... | @@ -9,7 +9,6 @@ |
9 | 9 | use yii\web\NotFoundHttpException; |
10 | 10 | use yii\filters\VerbFilter; |
11 | 11 | use developeruz\db_rbac\behaviors\AccessBehavior; |
12 | - use yii\web\UploadedFile; | |
13 | 12 | |
14 | 13 | /** |
15 | 14 | * EventController implements the CRUD actions for Event model. |
... | ... | @@ -89,14 +88,7 @@ |
89 | 88 | |
90 | 89 | $model->loadLangs(\Yii::$app->request, $model_langs); |
91 | 90 | |
92 | - if(( $image = UploadedFile::getInstance($model, 'imageUpload') )) { | |
93 | - $model->image = $image->name; | |
94 | - } | |
95 | - | |
96 | 91 | if($model->save()) { |
97 | - if($image) { | |
98 | - $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name)); | |
99 | - } | |
100 | 92 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
101 | 93 | return $this->redirect([ |
102 | 94 | 'view', |
... | ... | @@ -133,14 +125,7 @@ |
133 | 125 | |
134 | 126 | $model->loadLangs(\Yii::$app->request, $model_langs); |
135 | 127 | |
136 | - if(( $image = UploadedFile::getInstance($model, 'imageUpload') )) { | |
137 | - $model->image = $image->name; | |
138 | - } | |
139 | - | |
140 | 128 | if($model->save()) { |
141 | - if($image) { | |
142 | - $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name)); | |
143 | - } | |
144 | 129 | if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { |
145 | 130 | return $this->redirect([ |
146 | 131 | 'view', | ... | ... |
backend/controllers/ProjectController.php
... | ... | @@ -201,8 +201,9 @@ |
201 | 201 | $project = $this->findModel($id); |
202 | 202 | $model = new ProductToProject(); |
203 | 203 | $products = Product::find() |
204 | + ->distinct() | |
204 | 205 | ->select([ |
205 | - 'product.name', | |
206 | + 'product.product_id', | |
206 | 207 | 'product.product_id', |
207 | 208 | ]) |
208 | 209 | ->joinWith('variants', true, 'INNER JOIN') |
... | ... | @@ -221,7 +222,6 @@ |
221 | 222 | if(!empty( $model->product_id ) && !empty( $products[ $model->product_id ] )) { |
222 | 223 | $variants = ProductVariant::find() |
223 | 224 | ->select([ |
224 | - 'name', | |
225 | 225 | 'product_variant_id', |
226 | 226 | ]) |
227 | 227 | ->where([ 'product_id' => $model->product_id ]) |
... | ... | @@ -261,7 +261,7 @@ |
261 | 261 | } |
262 | 262 | $products = Product::find() |
263 | 263 | ->select([ |
264 | - 'product.name', | |
264 | + 'product.product_id', | |
265 | 265 | 'product.product_id', |
266 | 266 | ]) |
267 | 267 | ->joinWith('variants', true, 'INNER JOIN') |
... | ... | @@ -272,7 +272,6 @@ |
272 | 272 | if(!empty( $model->product_id ) && !empty( $products[ $model->product_id ] )) { |
273 | 273 | $variants = ProductVariant::find() |
274 | 274 | ->select([ |
275 | - 'name', | |
276 | 275 | 'product_variant_id', |
277 | 276 | ]) |
278 | 277 | ->where([ 'product_id' => $model->product_id ]) | ... | ... |
backend/controllers/SliderImageController.php
... | ... | @@ -10,7 +10,6 @@ |
10 | 10 | use yii\web\Controller; |
11 | 11 | use yii\web\NotFoundHttpException; |
12 | 12 | use yii\filters\VerbFilter; |
13 | - use yii\web\UploadedFile; | |
14 | 13 | |
15 | 14 | /** |
16 | 15 | * SliderImageController implements the CRUD actions for SliderImage model. |
... | ... | @@ -97,38 +96,29 @@ |
97 | 96 | if($model->load(Yii::$app->request->post())) { |
98 | 97 | $model->loadLangs(\Yii::$app->request, $model_langs); |
99 | 98 | $model->slider_id = $slider_id; |
100 | - if(( $image = UploadedFile::getInstance($model, 'image') )) { | |
101 | - $model->image = $image->name; | |
102 | - } | |
103 | - if($model->save() && $image) { | |
104 | - $imgDir = Yii::getAlias('@storage/slider/'); | |
105 | - if(!is_dir($imgDir)) { | |
106 | - mkdir($imgDir, 0755, true); | |
99 | + if($model->save()) { | |
100 | + if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { | |
101 | + return $this->redirect([ | |
102 | + 'view', | |
103 | + 'slider_id' => $slider_id, | |
104 | + 'id' => $model->slider_image_id, | |
105 | + ]); | |
106 | + } else { | |
107 | + return $this->redirect([ | |
108 | + 'update', | |
109 | + 'slider_id' => $slider_id, | |
110 | + 'id' => $model->slider_image_id, | |
111 | + ]); | |
107 | 112 | } |
108 | - $image->saveAs(Yii::getAlias('@storage/slider/' . $image->name)); | |
109 | - } | |
110 | - if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { | |
111 | - return $this->redirect([ | |
112 | - 'view', | |
113 | - 'slider_id' => $slider_id, | |
114 | - 'id' => $model->slider_image_id, | |
115 | - ]); | |
116 | - } else { | |
117 | - return $this->redirect([ | |
118 | - 'update', | |
119 | - 'slider_id' => $slider_id, | |
120 | - 'id' => $model->slider_image_id, | |
121 | - ]); | |
122 | 113 | } |
123 | - } else { | |
124 | - $slider = Slider::findOne($slider_id); | |
125 | - return $this->render('create', [ | |
126 | - 'slider_id' => $slider_id, | |
127 | - 'model' => $model, | |
128 | - 'model_langs' => $model_langs, | |
129 | - 'slider' => $slider, | |
130 | - ]); | |
131 | 114 | } |
115 | + $slider = Slider::findOne($slider_id); | |
116 | + return $this->render('create', [ | |
117 | + 'slider_id' => $slider_id, | |
118 | + 'model' => $model, | |
119 | + 'model_langs' => $model_langs, | |
120 | + 'slider' => $slider, | |
121 | + ]); | |
132 | 122 | } |
133 | 123 | |
134 | 124 | /** |
... | ... | @@ -146,20 +136,7 @@ |
146 | 136 | $model_langs = $model->generateLangs(); |
147 | 137 | if($model->load(Yii::$app->request->post())) { |
148 | 138 | $model->loadLangs(\Yii::$app->request, $model_langs); |
149 | - if(( $image = UploadedFile::getInstance($model, 'image') )) { | |
150 | - $model->image = $image->name; | |
151 | - } | |
152 | - if(!$model->image) { | |
153 | - $model->image = $model->getOldAttribute('image'); | |
154 | - } | |
155 | - if($model->save() && $image) { | |
156 | - $imgDir = Yii::getAlias('@storage/slider/'); | |
157 | - if(!is_dir($imgDir)) { | |
158 | - mkdir($imgDir, 0755, true); | |
159 | - } | |
160 | - $image->saveAs(Yii::getAlias('@storage/slider/' . $image->name)); | |
161 | - } | |
162 | - if($model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { | |
139 | + if($model->save() && $model->linkLangs($model_langs) && $model->saveLangs($model_langs)) { | |
163 | 140 | return $this->redirect([ |
164 | 141 | 'view', |
165 | 142 | 'slider_id' => $slider_id, | ... | ... |
backend/models/Label.php
... | ... | @@ -11,9 +11,9 @@ use yii\web\Request; |
11 | 11 | * Class Label |
12 | 12 | * |
13 | 13 | * * From language behavior * |
14 | - * @property {TableLang} $lang | |
15 | - * @property {TableLang}[] $langs | |
16 | - * @property {TableLang} $object_lang | |
14 | + * @property OrdersLabelLang $lang | |
15 | + * @property OrdersLabelLang[] $langs | |
16 | + * @property OrdersLabelLang $object_lang | |
17 | 17 | * @property string $ownerKey |
18 | 18 | * @property string $langKey |
19 | 19 | * @method string getOwnerKey() |
... | ... | @@ -22,7 +22,7 @@ use yii\web\Request; |
22 | 22 | * @method void setLangKey(string $value) |
23 | 23 | * @method ActiveQuery getLangs() |
24 | 24 | * @method ActiveQuery getLang( integer $language_id ) |
25 | - * @method {TableLang}[] generateLangs() | |
25 | + * @method OrdersLabelLang[] generateLangs() | |
26 | 26 | * @method void loadLangs(Request $request, ActiveRecord[] $model_langs) |
27 | 27 | * @method bool linkLangs(ActiveRecord[] $model_langs) |
28 | 28 | * @method bool saveLangs(ActiveRecord[] $model_langs) |
... | ... | @@ -44,8 +44,4 @@ class Label extends \yii\db\ActiveRecord |
44 | 44 | ], |
45 | 45 | ]; |
46 | 46 | } |
47 | - | |
48 | - public function getNl(){ | |
49 | - return $this->name; | |
50 | - } | |
51 | 47 | } | ... | ... |
backend/views/articles/_form.php
... | ... | @@ -29,31 +29,9 @@ |
29 | 29 | ->widget(DatePicker::className(), [ |
30 | 30 | 'dateFormat' => 'dd-MM-yyyy', |
31 | 31 | ]) ?> |
32 | - <?= $form->field($model, 'title') | |
33 | - ->textInput([ 'maxlength' => true ]) ?> | |
34 | - | |
35 | - <?= $form->field($model, 'body') | |
36 | - ->widget(CKEditor::className(), [ | |
37 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
38 | - 'preset' => 'full', | |
39 | - 'inline' => false, | |
40 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
41 | - ->createUrl('file/uploader/images-upload'), | |
42 | - ]), | |
43 | - ]) ?> | |
44 | - | |
45 | - <?= $form->field($model, 'body_preview') | |
46 | - ->widget(CKEditor::className(), [ | |
47 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
48 | - 'preset' => 'full', | |
49 | - 'inline' => false, | |
50 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
51 | - ->createUrl('file/uploader/images-upload'), | |
52 | - ]), | |
53 | - ]) ?> | |
54 | 32 | |
55 | 33 | <?= $form->field($model, 'image') |
56 | - ->widget(\kartik\file\FileInput::classname(), [ | |
34 | + ->widget(\kartik\file\FileInput::className(), [ | |
57 | 35 | 'language' => 'ru', |
58 | 36 | 'options' => [ |
59 | 37 | 'accept' => 'image/*', |
... | ... | @@ -73,24 +51,6 @@ |
73 | 51 | ], |
74 | 52 | ]); ?> |
75 | 53 | |
76 | - <?= $form->field($model, 'translit') | |
77 | - ->textInput([ 'maxlength' => true ]) ?> | |
78 | - | |
79 | - <?= $form->field($model, 'meta_title') | |
80 | - ->textInput([ 'maxlength' => true ]) ?> | |
81 | - | |
82 | - <?= $form->field($model, 'meta_keywords') | |
83 | - ->textInput([ 'maxlength' => true ]) ?> | |
84 | - | |
85 | - <?= $form->field($model, 'meta_description') | |
86 | - ->textInput([ 'maxlength' => true ]) ?> | |
87 | - | |
88 | - <?= $form->field($model, 'seo_text') | |
89 | - ->textarea([ 'rows' => 6 ]) ?> | |
90 | - | |
91 | - <?= $form->field($model, 'h1') | |
92 | - ->textInput([ 'maxlength' => true ]) ?> | |
93 | - | |
94 | 54 | <?php |
95 | 55 | echo LanguageForm::widget([ |
96 | 56 | 'model_langs' => $model_langs, | ... | ... |
backend/views/articles/_form_language.php
... | ... | @@ -15,6 +15,8 @@ |
15 | 15 | ?> |
16 | 16 | <?= $form->field($model_lang, '[' . $language->language_id . ']title') |
17 | 17 | ->textInput([ 'maxlength' => true ]); ?> |
18 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
19 | + ->textInput([ 'maxlength' => true ]); ?> | |
18 | 20 | <?= $form->field($model_lang, '[' . $language->language_id . ']body') |
19 | 21 | ->widget(CKEditor::className(), [ |
20 | 22 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ... | ... |
backend/views/articles/create.php
... | ... | @@ -9,9 +9,9 @@ |
9 | 9 | * @var Articles $model |
10 | 10 | * @var ArticlesLang[] $model_langs |
11 | 11 | */ |
12 | - $this->title = 'Create Articles'; | |
12 | + $this->title = \Yii::t('app', 'Create Articles'); | |
13 | 13 | $this->params[ 'breadcrumbs' ][] = [ |
14 | - 'label' => 'Articles', | |
14 | + 'label' => \Yii::t('app', 'Articles'), | |
15 | 15 | 'url' => [ 'index' ], |
16 | 16 | ]; |
17 | 17 | $this->params[ 'breadcrumbs' ][] = $this->title; | ... | ... |
backend/views/articles/index.php
... | ... | @@ -7,34 +7,22 @@ use yii\grid\GridView; |
7 | 7 | /* @var $searchModel common\models\ArticlesSearch */ |
8 | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | |
10 | -$this->title = 'Articles'; | |
10 | +$this->title = \Yii::t('app', 'Articles'); | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | -<div class="articles-index" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> | |
14 | - | |
15 | - <h1 itemprop="title"><?= Html::encode($this->title) ?></h1> | |
16 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | - | |
13 | +<div class="articles-index"> | |
14 | + <h1><?= Html::encode($this->title) ?></h1> | |
18 | 15 | <p> |
19 | - <?= Html::a('Create Articles', ['create'], ['class' => 'btn btn-success']) ?> | |
16 | + <?= Html::a(\Yii::t('app', 'Create Articles'), ['create'], ['class' => 'btn btn-success']) ?> | |
20 | 17 | </p> |
21 | 18 | <?= GridView::widget([ |
22 | 19 | 'dataProvider' => $dataProvider, |
23 | 20 | 'filterModel' => $searchModel, |
24 | 21 | 'columns' => [ |
25 | 22 | ['class' => 'yii\grid\SerialColumn'], |
26 | - | |
27 | 23 | 'id', |
28 | 24 | 'date', |
29 | - 'title', | |
30 | - 'image', | |
31 | - // 'translit', | |
32 | - // 'meta_title', | |
33 | - // 'meta_keywords', | |
34 | - // 'meta_description', | |
35 | - // 'seo_text:ntext', | |
36 | - // 'h1', | |
37 | - | |
25 | + 'imageUrl:image', | |
38 | 26 | ['class' => 'yii\grid\ActionColumn'], |
39 | 27 | ], |
40 | 28 | ]); ?> | ... | ... |
backend/views/articles/update.php
... | ... | @@ -9,19 +9,19 @@ |
9 | 9 | * @var Articles $model |
10 | 10 | * @var ArticlesLang[] $model_langs |
11 | 11 | */ |
12 | - $this->title = 'Update Articles: ' . $model->title; | |
12 | + $this->title = \Yii::t('app', 'Update Articles').': ' . $model->id; | |
13 | 13 | $this->params[ 'breadcrumbs' ][] = [ |
14 | - 'label' => 'Articles', | |
14 | + 'label' => \Yii::t('app', 'Articles'), | |
15 | 15 | 'url' => [ 'index' ], |
16 | 16 | ]; |
17 | 17 | $this->params[ 'breadcrumbs' ][] = [ |
18 | - 'label' => $model->title, | |
18 | + 'label' => $model->id, | |
19 | 19 | 'url' => [ |
20 | 20 | 'view', |
21 | 21 | 'id' => $model->id, |
22 | 22 | ], |
23 | 23 | ]; |
24 | - $this->params[ 'breadcrumbs' ][] = 'Update'; | |
24 | + $this->params[ 'breadcrumbs' ][] = \Yii::t('app', 'Update'); | |
25 | 25 | ?> |
26 | 26 | <div class="articles-update"> |
27 | 27 | ... | ... |
backend/views/articles/view.php
... | ... | @@ -6,37 +6,27 @@ use yii\widgets\DetailView; |
6 | 6 | /* @var $this yii\web\View */ |
7 | 7 | /* @var $model common\models\Articles */ |
8 | 8 | |
9 | -$this->title = $model->title; | |
10 | -$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']]; | |
9 | +$this->title = $model->id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => \Yii::t('app', 'Articles'), 'url' => ['index']]; | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | -<div class="articles-view" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> | |
14 | - | |
15 | - <h1 itemprop="title"><?= Html::encode($this->title) ?></h1> | |
16 | - | |
13 | +<div class="articles-view"> | |
14 | + <h1><?= Html::encode($this->title) ?></h1> | |
17 | 15 | <p> |
18 | - <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
16 | + <?= Html::a(\Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
17 | + <?= Html::a(\Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ | |
20 | 18 | 'class' => 'btn btn-danger', |
21 | 19 | 'data' => [ |
22 | - 'confirm' => 'Are you sure you want to delete this item?', | |
20 | + 'confirm' => \Yii::t('app', 'Are you sure you want to delete this item?'), | |
23 | 21 | 'method' => 'post', |
24 | 22 | ], |
25 | 23 | ]) ?> |
26 | 24 | </p> |
27 | - | |
28 | 25 | <?= DetailView::widget([ |
29 | 26 | 'model' => $model, |
30 | 27 | 'attributes' => [ |
31 | 28 | 'id', |
32 | 29 | 'date', |
33 | - 'title', | |
34 | - 'translit', | |
35 | - 'meta_title', | |
36 | - 'meta_keywords', | |
37 | - 'meta_description', | |
38 | - 'h1', | |
39 | 30 | ], |
40 | 31 | ]) ?> |
41 | - | |
42 | 32 | </div> | ... | ... |
backend/views/banner/_form.php
... | ... | @@ -2,7 +2,6 @@ |
2 | 2 | |
3 | 3 | use common\models\Banner; |
4 | 4 | use common\models\BannerLang; |
5 | - use common\modules\file\widgets\ImageUploader; | |
6 | 5 | use common\modules\language\widgets\LanguageForm; |
7 | 6 | use kartik\select2\Select2; |
8 | 7 | use yii\helpers\Html; |
... | ... | @@ -25,12 +24,6 @@ |
25 | 24 | ], |
26 | 25 | ]); ?> |
27 | 26 | |
28 | - <?= $form->field($model, 'alt') | |
29 | - ->textInput([ 'maxlength' => true ]) ?> | |
30 | - | |
31 | - <?= $form->field($model, 'title') | |
32 | - ->textInput([ 'maxlength' => true ]) ?> | |
33 | - | |
34 | 27 | <?= $form->field($model, 'url') |
35 | 28 | ->textInput([ 'maxlength' => true ]) ?> |
36 | 29 | |
... | ... | @@ -39,10 +32,10 @@ |
39 | 32 | 'name' => 'status', |
40 | 33 | 'hideSearch' => true, |
41 | 34 | 'data' => [ |
42 | - 1 => 'Active', | |
43 | - 2 => 'Inactive', | |
35 | + 1 => \Yii::t('app', 'Active'), | |
36 | + 2 => \Yii::t('app', 'Inactive'), | |
44 | 37 | ], |
45 | - 'options' => [ 'placeholder' => 'Select status...' ], | |
38 | + 'options' => [ 'placeholder' => \Yii::t('app', 'Select status...') ], | |
46 | 39 | 'pluginOptions' => [ |
47 | 40 | 'allowClear' => true, |
48 | 41 | ], | ... | ... |
backend/views/banner/index.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\grid\GridView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $searchModel common\models\BannerSearch */ | |
8 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | - | |
10 | -$this->title = Yii::t('app', 'Banners'); | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\grid\GridView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $searchModel common\models\BannerSearch */ | |
8 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | + $this->title = Yii::t('app', 'Banners'); | |
11 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 12 | ?> |
13 | 13 | <div class="banner-index"> |
14 | - | |
14 | + | |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
17 | - | |
17 | + | |
18 | 18 | <p> |
19 | - <?= Html::a(Yii::t('app', 'Create Banner'), ['create'], ['class' => 'btn btn-success']) ?> | |
19 | + <?= Html::a(Yii::t('app', 'Create Banner'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
20 | 20 | </p> |
21 | 21 | <?= GridView::widget([ |
22 | 22 | 'dataProvider' => $dataProvider, |
23 | - 'filterModel' => $searchModel, | |
24 | - 'columns' => [ | |
25 | - ['class' => 'yii\grid\SerialColumn'], | |
26 | - | |
23 | + 'filterModel' => $searchModel, | |
24 | + 'columns' => [ | |
25 | + [ 'class' => 'yii\grid\SerialColumn' ], | |
27 | 26 | 'banner_id', |
28 | - 'image', | |
29 | - 'alt', | |
30 | - 'title', | |
31 | - // 'url:url', | |
32 | - // 'status', | |
33 | - | |
34 | - ['class' => 'yii\grid\ActionColumn'], | |
27 | + 'url', | |
28 | + 'status', | |
29 | + [ 'class' => 'yii\grid\ActionColumn' ], | |
35 | 30 | ], |
36 | 31 | ]); ?> |
37 | 32 | </div> | ... | ... |
backend/views/banner/update.php
... | ... | @@ -13,13 +13,13 @@ |
13 | 13 | |
14 | 14 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
15 | 15 | 'modelClass' => 'Banner', |
16 | - ]) . $model->title; | |
16 | + ]) . $model->banner_id; | |
17 | 17 | $this->params[ 'breadcrumbs' ][] = [ |
18 | 18 | 'label' => Yii::t('app', 'Banners'), |
19 | 19 | 'url' => [ 'index' ], |
20 | 20 | ]; |
21 | 21 | $this->params[ 'breadcrumbs' ][] = [ |
22 | - 'label' => $model->title, | |
22 | + 'label' => $model->banner_id, | |
23 | 23 | 'url' => [ |
24 | 24 | 'view', |
25 | 25 | 'id' => $model->banner_id, | ... | ... |
backend/views/banner/view.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\Banner */ | |
8 | - | |
9 | -$this->title = $model->title; | |
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\widgets\DetailView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $model common\models\Banner */ | |
8 | + | |
9 | + $this->title = $model->banner_id; | |
10 | + $this->params[ 'breadcrumbs' ][] = [ | |
11 | + 'label' => Yii::t('app', 'Banners'), | |
12 | + 'url' => [ 'index' ], | |
13 | + ]; | |
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 15 | ?> |
13 | 16 | <div class="banner-view"> |
14 | - | |
17 | + | |
15 | 18 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - | |
19 | + | |
17 | 20 | <p> |
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->banner_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->banner_id], [ | |
21 | + <?= Html::a(Yii::t('app', 'Update'), [ | |
22 | + 'update', | |
23 | + 'id' => $model->banner_id, | |
24 | + ], [ 'class' => 'btn btn-primary' ]) ?> | |
25 | + <?= Html::a(Yii::t('app', 'Delete'), [ | |
26 | + 'delete', | |
27 | + 'id' => $model->banner_id, | |
28 | + ], [ | |
20 | 29 | 'class' => 'btn btn-danger', |
21 | - 'data' => [ | |
30 | + 'data' => [ | |
22 | 31 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
23 | - 'method' => 'post', | |
32 | + 'method' => 'post', | |
24 | 33 | ], |
25 | 34 | ]) ?> |
26 | 35 | </p> |
27 | - | |
36 | + | |
28 | 37 | <?= DetailView::widget([ |
29 | 38 | 'model' => $model, |
30 | 39 | 'attributes' => [ |
31 | 40 | 'banner_id', |
32 | - 'image', | |
33 | - 'alt', | |
34 | - 'title', | |
35 | - 'url:url', | |
41 | + 'url', | |
36 | 42 | 'status', |
37 | 43 | ], |
38 | 44 | ]) ?> | ... | ... |
backend/views/bg/_form.php
... | ... | @@ -17,16 +17,37 @@ |
17 | 17 | |
18 | 18 | <div class="bg-form"> |
19 | 19 | |
20 | - <?php $form = ActiveForm::begin(); ?> | |
21 | - | |
22 | - <?= $form->field($model, 'title') | |
23 | - ->textInput([ 'maxlength' => true ]) ?> | |
20 | + <?php $form = ActiveForm::begin([ | |
21 | + 'options' => [ | |
22 | + 'enctype' => 'multipart/form-data', | |
23 | + ], | |
24 | + ]); ?> | |
24 | 25 | |
25 | 26 | <?= $form->field($model, 'url') |
26 | 27 | ->textInput([ 'maxlength' => true ]) ?> |
27 | 28 | |
29 | + | |
28 | 30 | <?= $form->field($model, 'image') |
29 | - ->textInput([ 'maxlength' => true ]) ?> | |
31 | + ->widget(\kartik\file\FileInput::className(), [ | |
32 | + 'model' => $model, | |
33 | + 'attribute' => 'image', | |
34 | + 'options' => [ | |
35 | + 'accept' => 'image/*', | |
36 | + 'multiple' => false, | |
37 | + ], | |
38 | + 'pluginOptions' => [ | |
39 | + 'allowedFileExtensions' => [ | |
40 | + 'jpg', | |
41 | + 'gif', | |
42 | + 'png', | |
43 | + ], | |
44 | + 'initialPreview' => $model->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'slider') : '', | |
45 | + 'showRemove' => false, | |
46 | + 'overwriteInitial' => true, | |
47 | + 'showUpload' => false, | |
48 | + 'showClose' => false, | |
49 | + ], | |
50 | + ]); ?> | |
30 | 51 | |
31 | 52 | <?= LanguageForm::widget([ |
32 | 53 | 'model_langs' => $model_langs, |
... | ... | @@ -35,7 +56,7 @@ |
35 | 56 | ]) ?> |
36 | 57 | |
37 | 58 | <div class="form-group"> |
38 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> | |
59 | + <?= Html::submitButton($model->isNewRecord ? \Yii::t('app', 'Create') : \Yii::t('app', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> | |
39 | 60 | </div> |
40 | 61 | |
41 | 62 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/bg/create.php
... | ... | @@ -11,9 +11,9 @@ |
11 | 11 | * @var BgLang[] $model_langs |
12 | 12 | */ |
13 | 13 | |
14 | - $this->title = 'Create Bg'; | |
14 | + $this->title = \Yii::t('app', 'Create Bg'); | |
15 | 15 | $this->params[ 'breadcrumbs' ][] = [ |
16 | - 'label' => 'Bgs', | |
16 | + 'label' => \Yii::t('app', 'Bgs'), | |
17 | 17 | 'url' => [ 'index' ], |
18 | 18 | ]; |
19 | 19 | $this->params[ 'breadcrumbs' ][] = $this->title; | ... | ... |
backend/views/bg/index.php
... | ... | @@ -7,7 +7,7 @@ use yii\grid\GridView; |
7 | 7 | /* @var $searchModel common\models\BgSearch */ |
8 | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | |
10 | -$this->title = 'Bgs'; | |
10 | +$this->title = \Yii::t('app', 'Bgs'); | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | 13 | <div class="bg-index"> |
... | ... | @@ -16,19 +16,16 @@ $this->params['breadcrumbs'][] = $this->title; |
16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
17 | 17 | |
18 | 18 | <p> |
19 | - <?= Html::a('Create Bg', ['create'], ['class' => 'btn btn-success']) ?> | |
19 | + <?= Html::a(\Yii::t('app', 'Create Bg'), ['create'], ['class' => 'btn btn-success']) ?> | |
20 | 20 | </p> |
21 | 21 | <?= GridView::widget([ |
22 | 22 | 'dataProvider' => $dataProvider, |
23 | 23 | 'filterModel' => $searchModel, |
24 | 24 | 'columns' => [ |
25 | 25 | ['class' => 'yii\grid\SerialColumn'], |
26 | - | |
27 | 26 | 'id', |
28 | - 'title', | |
29 | - 'url:url', | |
30 | - 'image', | |
31 | - | |
27 | + 'url', | |
28 | + 'imageUrl:image', | |
32 | 29 | ['class' => 'yii\grid\ActionColumn'], |
33 | 30 | ], |
34 | 31 | ]); ?> | ... | ... |
backend/views/bg/update.php
... | ... | @@ -11,19 +11,19 @@ |
11 | 11 | * @var BgLang[] $model_langs |
12 | 12 | */ |
13 | 13 | |
14 | - $this->title = 'Update Bg: ' . $model->title; | |
14 | + $this->title = \Yii::t('app', 'Update Bg: ') . $model->id; | |
15 | 15 | $this->params[ 'breadcrumbs' ][] = [ |
16 | - 'label' => 'Bgs', | |
16 | + 'label' => \Yii::t('app', 'Bgs'), | |
17 | 17 | 'url' => [ 'index' ], |
18 | 18 | ]; |
19 | 19 | $this->params[ 'breadcrumbs' ][] = [ |
20 | - 'label' => $model->title, | |
20 | + 'label' => $model->id, | |
21 | 21 | 'url' => [ |
22 | 22 | 'view', |
23 | 23 | 'id' => $model->id, |
24 | 24 | ], |
25 | 25 | ]; |
26 | - $this->params[ 'breadcrumbs' ][] = 'Update'; | |
26 | + $this->params[ 'breadcrumbs' ][] = \Yii::t('app', 'Update'); | |
27 | 27 | ?> |
28 | 28 | <div class="bg-update"> |
29 | 29 | ... | ... |
backend/views/bg/view.php
... | ... | @@ -6,8 +6,8 @@ use yii\widgets\DetailView; |
6 | 6 | /* @var $this yii\web\View */ |
7 | 7 | /* @var $model common\models\Bg */ |
8 | 8 | |
9 | -$this->title = $model->title; | |
10 | -$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']]; | |
9 | +$this->title = $model->id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => \Yii::t('app', 'Bgs'), 'url' => ['index']]; | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | 13 | <div class="bg-view"> |
... | ... | @@ -15,11 +15,11 @@ $this->params['breadcrumbs'][] = $this->title; |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | 16 | |
17 | 17 | <p> |
18 | - <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
18 | + <?= Html::a(\Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a(\Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ | |
20 | 20 | 'class' => 'btn btn-danger', |
21 | 21 | 'data' => [ |
22 | - 'confirm' => 'Are you sure you want to delete this item?', | |
22 | + 'confirm' => \Yii::t('app', 'Are you sure you want to delete this item?'), | |
23 | 23 | 'method' => 'post', |
24 | 24 | ], |
25 | 25 | ]) ?> |
... | ... | @@ -29,9 +29,8 @@ $this->params['breadcrumbs'][] = $this->title; |
29 | 29 | 'model' => $model, |
30 | 30 | 'attributes' => [ |
31 | 31 | 'id', |
32 | - 'title', | |
33 | - 'url:url', | |
34 | - 'image', | |
32 | + 'url', | |
33 | + 'imageUrl:image', | |
35 | 34 | ], |
36 | 35 | ]) ?> |
37 | 36 | ... | ... |
backend/views/brand/_form.php
... | ... | @@ -22,14 +22,8 @@ |
22 | 22 | 'options' => [ 'enctype' => 'multipart/form-data' ], |
23 | 23 | ]); ?> |
24 | 24 | |
25 | - <?= $form->field($model, 'name') | |
26 | - ->textInput() ?> | |
27 | - | |
28 | - <?= $form->field($model, 'alias') | |
29 | - ->textInput([ 'maxlength' => true ]) ?> | |
30 | - | |
31 | 25 | <?= $form->field($model, 'image') |
32 | - ->widget(\kartik\file\FileInput::classname(), [ | |
26 | + ->widget(\kartik\file\FileInput::className(), [ | |
33 | 27 | 'language' => 'ru', |
34 | 28 | 'options' => [ |
35 | 29 | 'accept' => 'image/*', |
... | ... | @@ -49,18 +43,6 @@ |
49 | 43 | ], |
50 | 44 | ]); ?> |
51 | 45 | |
52 | - <?= $form->field($model, 'meta_title') | |
53 | - ->textInput([ 'maxlength' => true ]) ?> | |
54 | - | |
55 | - <?= $form->field($model, 'meta_desc') | |
56 | - ->textarea([ 'rows' => 6 ]) ?> | |
57 | - | |
58 | - <?= $form->field($model, 'meta_robots') | |
59 | - ->textInput([ 'maxlength' => true ]) ?> | |
60 | - | |
61 | - <?= $form->field($model, 'seo_text') | |
62 | - ->textarea([ 'rows' => 6 ]) ?> | |
63 | - | |
64 | 46 | <?= LanguageForm::widget([ |
65 | 47 | 'model_langs' => $model_langs, |
66 | 48 | 'formView' => '@backend/views/brand/_form_language', | ... | ... |
backend/views/brand/_form_language.php
... | ... | @@ -14,6 +14,9 @@ |
14 | 14 | <?= $form->field($model_lang, '[' . $language->language_id . ']name') |
15 | 15 | ->textInput([ 'maxlength' => true ]); ?> |
16 | 16 | |
17 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
18 | + ->textInput([ 'maxlength' => true ]); ?> | |
19 | + | |
17 | 20 | <?= $form->field($model_lang, '[' . $language->language_id . ']meta_title') |
18 | 21 | ->textInput([ 'maxlength' => true ]) ?> |
19 | 22 | ... | ... |
backend/views/brand/index.php
... | ... | @@ -13,27 +13,16 @@ $this->params['breadcrumbs'][] = $this->title; |
13 | 13 | <div class="brand-index"> |
14 | 14 | |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | 16 | |
18 | 17 | <p> |
19 | 18 | <?= Html::a(Yii::t('product', 'Create Brand'), ['create'], ['class' => 'btn btn-success']) ?> |
20 | 19 | </p> |
21 | 20 | <?= GridView::widget([ |
22 | 21 | 'dataProvider' => $dataProvider, |
23 | -// 'filterModel' => $searchModel, | |
24 | 22 | 'columns' => [ |
25 | 23 | ['class' => 'yii\grid\SerialColumn'], |
26 | - | |
27 | - 'name', | |
28 | - 'alias', | |
29 | - [ | |
30 | - 'attribute' => 'title', | |
31 | - 'format' => 'html', | |
32 | - 'value' => function($data) { | |
33 | - return Html::img($data->imageUrl, ['width'=>'100']); | |
34 | - }, | |
35 | - ], | |
36 | - | |
24 | + 'brand_id', | |
25 | + 'imageUrl:image', | |
37 | 26 | ['class' => 'yii\grid\ActionColumn'], |
38 | 27 | ], |
39 | 28 | ]); ?> | ... | ... |
backend/views/brand/view.php
... | ... | @@ -29,12 +29,7 @@ $this->params['breadcrumbs'][] = $this->title; |
29 | 29 | 'model' => $model, |
30 | 30 | 'attributes' => [ |
31 | 31 | 'brand_id', |
32 | - 'alias', | |
33 | 32 | 'imageUrl:image', |
34 | - 'meta_title', | |
35 | - 'meta_desc:ntext', | |
36 | - 'meta_robots', | |
37 | - 'seo_text:ntext', | |
38 | 33 | ], |
39 | 34 | ]) ?> |
40 | 35 | ... | ... |
backend/views/category/_form.php
... | ... | @@ -6,8 +6,6 @@ |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use yii\web\View; |
8 | 8 | use yii\widgets\ActiveForm; |
9 | - use mihaildev\ckeditor\CKEditor; | |
10 | - use mihaildev\elfinder\ElFinder; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * @var View $this |
... | ... | @@ -25,12 +23,6 @@ |
25 | 23 | 'options' => [ 'enctype' => 'multipart/form-data' ], |
26 | 24 | ]); ?> |
27 | 25 | |
28 | - <?= $form->field($model, 'name') | |
29 | - ->textInput() ?> | |
30 | - | |
31 | - <?= $form->field($model, 'alias') | |
32 | - ->textInput([ 'maxlength' => true ]) ?> | |
33 | - | |
34 | 26 | <?= $form->field($model, 'parent_id') |
35 | 27 | ->dropDownList($categories, [ |
36 | 28 | 'prompt' => Yii::t('rubrication', 'Root category'), |
... | ... | @@ -40,26 +32,8 @@ |
40 | 32 | ]) |
41 | 33 | ->label(Yii::t('product', 'Parent category')) ?> |
42 | 34 | |
43 | - <?php | |
44 | - /* Tax group - add to controller | |
45 | - ?> | |
46 | - <?= $form->field($model, 'taxGroup')->widget(Select2::className(), [ | |
47 | - 'data' => \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'), | |
48 | - 'language' => 'ru', | |
49 | - 'options' => [ | |
50 | - 'placeholder' => 'Linked options', | |
51 | - 'multiple' => true, | |
52 | - ], | |
53 | - 'pluginOptions' => [ | |
54 | - 'allowClear' => true | |
55 | - ], | |
56 | - ] | |
57 | - ) ?> | |
58 | - */ | |
59 | - ?> | |
60 | - | |
61 | - <?= $form->field($model, 'imageUpload') | |
62 | - ->widget(\kartik\file\FileInput::classname(), [ | |
35 | + <?= $form->field($model, 'image') | |
36 | + ->widget(\kartik\file\FileInput::className(), [ | |
63 | 37 | 'language' => 'ru', |
64 | 38 | 'options' => [ |
65 | 39 | 'accept' => 'image/*', |
... | ... | @@ -80,30 +54,6 @@ |
80 | 54 | ]) |
81 | 55 | ->hint('ะะปั ะบะพััะตะบัะฝะพะณะพ ะพัะพะฑัะฐะถะตะฝะธั ะฝะฐ ัะฐะนัะต, ัะฐะทะผะตั ะธะทะพะฑัะฐะถะตะฝะธั ะดะพะปะถะตะฝ ะฑััั 262x144 ะปะธะฑะพ ัะพะฑะปัะดะฐัั ัะพะพัะฝะพัะตะฝะธะต ััะพัะพะฝ ะฟัะธะผะตัะฝะพ 2:1'); ?> |
82 | 56 | |
83 | - <?= $form->field($model, 'meta_title') | |
84 | - ->textInput([ 'maxlength' => true ]) ?> | |
85 | - | |
86 | - <?= $form->field($model, 'meta_desc') | |
87 | - ->textarea([ 'rows' => 6 ]) ?> | |
88 | - | |
89 | - <?= $form->field($model, 'meta_robots') | |
90 | - ->textInput([ 'maxlength' => true ]) ?> | |
91 | - | |
92 | - <?= $form->field($model, 'h1') | |
93 | - ->textInput([ 'maxlength' => true ]) ?> | |
94 | - | |
95 | - <?= $form->field($model, 'seo_text') | |
96 | - ->widget(CKEditor::className(), [ | |
97 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
98 | - 'preset' => 'full', | |
99 | - //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
100 | - 'inline' => false, | |
101 | - //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
102 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
103 | - ->createUrl('file/uploader/images-upload'), | |
104 | - ]), | |
105 | - ]) ?> | |
106 | - | |
107 | 57 | <?= LanguageForm::widget([ |
108 | 58 | 'model_langs' => $model_langs, |
109 | 59 | 'formView' => '@backend/views/category/_form_language', | ... | ... |
backend/views/category/_form_language.php
... | ... | @@ -14,6 +14,9 @@ |
14 | 14 | <?= $form->field($model_lang, '[' . $language->language_id . ']name') |
15 | 15 | ->textInput([ 'maxlength' => true ]); ?> |
16 | 16 | |
17 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
18 | + ->textInput([ 'maxlength' => true ]); ?> | |
19 | + | |
17 | 20 | <?= $form->field($model_lang, '[' . $language->language_id . ']meta_title') |
18 | 21 | ->textInput([ 'maxlength' => true ]) ?> |
19 | 22 | ... | ... |
backend/views/category/index.php
1 | 1 | <?php |
2 | 2 | |
3 | + use common\modules\product\models\Category; | |
3 | 4 | use yii\helpers\Html; |
4 | 5 | use kartik\grid\GridView; |
5 | 6 | |
... | ... | @@ -25,12 +26,15 @@ |
25 | 26 | [ |
26 | 27 | 'label' => Yii::t('product', 'Name'), |
27 | 28 | 'content' => function($data) { |
29 | + /** | |
30 | + * @var Category $data | |
31 | + */ | |
28 | 32 | $op = []; |
29 | 33 | foreach($data->getParents() |
30 | 34 | ->all() as $parent) { |
31 | - $op[] = $parent->name; | |
35 | + $op[] = $parent->category_id; | |
32 | 36 | } |
33 | - $op[] = $data->name; | |
37 | + $op[] = $data->category_id; | |
34 | 38 | return implode(' → ', $op); |
35 | 39 | }, |
36 | 40 | ], | ... | ... |
backend/views/category/update.php
... | ... | @@ -14,13 +14,13 @@ |
14 | 14 | |
15 | 15 | $this->title = Yii::t('product', 'Update {modelClass}: ', [ |
16 | 16 | 'modelClass' => 'Category', |
17 | - ]) . ' ' . $model->name; | |
17 | + ]) . ' ' . $model->category_id; | |
18 | 18 | $this->params[ 'breadcrumbs' ][] = [ |
19 | 19 | 'label' => Yii::t('product', 'Categories'), |
20 | 20 | 'url' => [ 'index' ], |
21 | 21 | ]; |
22 | 22 | $this->params[ 'breadcrumbs' ][] = [ |
23 | - 'label' => $model->name, | |
23 | + 'label' => $model->category_id, | |
24 | 24 | 'url' => [ |
25 | 25 | 'view', |
26 | 26 | 'id' => $model->category_id, | ... | ... |
backend/views/category/view.php
... | ... | @@ -6,7 +6,7 @@ use yii\widgets\DetailView; |
6 | 6 | /* @var $this yii\web\View */ |
7 | 7 | /* @var $model common\modules\product\models\Category */ |
8 | 8 | |
9 | -$this->title = $model->name; | |
9 | +$this->title = $model->category_id; | |
10 | 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']]; |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
... | ... | @@ -25,7 +25,7 @@ $this->params['breadcrumbs'][] = $this->title; |
25 | 25 | ]) ?> |
26 | 26 | <?= Html::a(Yii::t('product', 'Create Category'), ['category/create'], ['class' => 'btn btn-success']) ?> |
27 | 27 | <?php if (!empty($model->parent_id)) :?> |
28 | - <?= Html::a(Yii::t('product', 'Create category By {name}', ['name' => $model->parent->name]), ['category/create?parent='. $model->parent->category_id], ['class' => 'btn btn-success']) ?> | |
28 | + <?= Html::a(Yii::t('product', 'Create category By {name}', ['name' => $model->parent->category_id]), ['category/create?parent='. $model->parent->category_id], ['class' => 'btn btn-success']) ?> | |
29 | 29 | <?php endif?> |
30 | 30 | </p> |
31 | 31 | |
... | ... | @@ -37,13 +37,7 @@ $this->params['breadcrumbs'][] = $this->title; |
37 | 37 | 'path', |
38 | 38 | 'depth', |
39 | 39 | 'imageUrl:image', |
40 | - 'meta_title', | |
41 | - 'meta_desc:ntext', | |
42 | - 'meta_robots', | |
43 | - 'h1', | |
44 | - 'seo_text:ntext', | |
45 | 40 | 'product_unit_id', |
46 | - 'alias', | |
47 | 41 | ], |
48 | 42 | ]) ?> |
49 | 43 | ... | ... |
backend/views/event/_form.php
... | ... | @@ -25,25 +25,6 @@ |
25 | 25 | 'options' => [ 'enctype' => 'multipart/form-data' ], |
26 | 26 | ]); ?> |
27 | 27 | |
28 | - <?= $form->field($model, 'name') | |
29 | - ->textInput([ 'maxlength' => true ]) ?> | |
30 | - | |
31 | - <?= $form->field($model, 'alias') | |
32 | - ->textInput([ 'maxlength' => true ]) ?> | |
33 | - | |
34 | - <?= $form->field($model, 'body') | |
35 | - ->widget(CKEditor::className(), [ | |
36 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
37 | - 'preset' => 'full', | |
38 | - //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
39 | - 'inline' => false, | |
40 | - //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
41 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
42 | - ->createUrl('file/uploader/images-upload'), | |
43 | - ]), | |
44 | - ]) ?> | |
45 | - | |
46 | - | |
47 | 28 | <?= $form->field($model, 'end_at') |
48 | 29 | ->widget(DatePicker::className(), [ |
49 | 30 | 'pluginOptions' => [ |
... | ... | @@ -53,7 +34,7 @@ |
53 | 34 | ]) ?> |
54 | 35 | |
55 | 36 | |
56 | - <?= $form->field($model, 'imageUpload') | |
37 | + <?= $form->field($model, 'image') | |
57 | 38 | ->widget(\kartik\file\FileInput::className(), [ |
58 | 39 | 'language' => 'ru', |
59 | 40 | 'options' => [ |
... | ... | @@ -74,18 +55,6 @@ |
74 | 55 | ], |
75 | 56 | ]); ?> |
76 | 57 | |
77 | - <?= $form->field($model, 'meta_title') | |
78 | - ->textInput([ 'maxlength' => true ]) ?> | |
79 | - | |
80 | - <?= $form->field($model, 'description') | |
81 | - ->textInput([ 'maxlength' => true ]) ?> | |
82 | - | |
83 | - <?= $form->field($model, 'h1') | |
84 | - ->textInput([ 'maxlength' => true ]) ?> | |
85 | - | |
86 | - <?= $form->field($model, 'seo_text') | |
87 | - ->textarea([ 'rows' => 6 ]) ?> | |
88 | - | |
89 | 58 | <?= LanguageForm::widget([ |
90 | 59 | 'model_langs' => $model_langs, |
91 | 60 | 'formView' => '@backend/views/event/_form_language', | ... | ... |
backend/views/event/_form_language.php
... | ... | @@ -15,6 +15,10 @@ |
15 | 15 | ?> |
16 | 16 | <?= $form->field($model_lang, '[' . $language->language_id . ']name') |
17 | 17 | ->textInput([ 'maxlength' => true ]); ?> |
18 | + | |
19 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
20 | + ->textInput([ 'maxlength' => true ]); ?> | |
21 | + | |
18 | 22 | <?= $form->field($model_lang, '[' . $language->language_id . ']body') |
19 | 23 | ->widget(CKEditor::className(), [ |
20 | 24 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ... | ... |
backend/views/event/index.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\grid\GridView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $searchModel common\models\EventSearch */ | |
8 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | - | |
10 | -$this->title = Yii::t('app', 'Events'); | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\grid\GridView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $searchModel common\models\EventSearch */ | |
8 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | + $this->title = Yii::t('app', 'Events'); | |
11 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 12 | ?> |
13 | 13 | <div class="event-index"> |
14 | - | |
14 | + | |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
17 | - | |
17 | + | |
18 | 18 | <p> |
19 | - <?= Html::a(Yii::t('app', 'Create Event'), ['create'], ['class' => 'btn btn-success']) ?> | |
19 | + <?= Html::a(Yii::t('app', 'Create Event'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
20 | 20 | </p> |
21 | 21 | <?= GridView::widget([ |
22 | 22 | 'dataProvider' => $dataProvider, |
23 | - 'filterModel' => $searchModel, | |
24 | - 'columns' => [ | |
25 | - ['class' => 'yii\grid\SerialColumn'], | |
26 | - | |
23 | + 'filterModel' => $searchModel, | |
24 | + 'columns' => [ | |
25 | + [ 'class' => 'yii\grid\SerialColumn' ], | |
27 | 26 | 'event_id', |
28 | - 'name', | |
29 | - 'alias', | |
30 | - [ | |
31 | - 'format' => 'image', | |
32 | - 'attribute'=>'image', | |
33 | - ], | |
34 | - // 'meta_title', | |
35 | - // 'description', | |
36 | - // 'h1', | |
37 | - // 'seo_text:ntext', | |
38 | - // 'created_at', | |
39 | - // 'updated_at', | |
40 | - // 'end_at', | |
41 | - | |
42 | - ['class' => 'yii\grid\ActionColumn'], | |
27 | + 'imageUrl:image', | |
28 | + [ 'class' => 'yii\grid\ActionColumn' ], | |
43 | 29 | ], |
44 | 30 | ]); ?> |
45 | 31 | </div> | ... | ... |
backend/views/event/update.php
... | ... | @@ -13,13 +13,13 @@ |
13 | 13 | |
14 | 14 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
15 | 15 | 'modelClass' => 'Event', |
16 | - ]) . $model->name; | |
16 | + ]) . $model->event_id; | |
17 | 17 | $this->params[ 'breadcrumbs' ][] = [ |
18 | 18 | 'label' => Yii::t('app', 'Events'), |
19 | 19 | 'url' => [ 'index' ], |
20 | 20 | ]; |
21 | 21 | $this->params[ 'breadcrumbs' ][] = [ |
22 | - 'label' => $model->name, | |
22 | + 'label' => $model->event_id, | |
23 | 23 | 'url' => [ |
24 | 24 | 'view', |
25 | 25 | 'id' => $model->event_id, | ... | ... |
backend/views/event/view.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\Event */ | |
8 | - | |
9 | -$this->title = $model->name; | |
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\widgets\DetailView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $model common\models\Event */ | |
8 | + | |
9 | + $this->title = $model->event_id; | |
10 | + $this->params[ 'breadcrumbs' ][] = [ | |
11 | + 'label' => Yii::t('app', 'Events'), | |
12 | + 'url' => [ 'index' ], | |
13 | + ]; | |
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 15 | ?> |
13 | 16 | <div class="event-view"> |
14 | - | |
17 | + | |
15 | 18 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - | |
19 | + | |
17 | 20 | <p> |
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->event_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->event_id], [ | |
21 | + <?= Html::a(Yii::t('app', 'Update'), [ | |
22 | + 'update', | |
23 | + 'id' => $model->event_id, | |
24 | + ], [ 'class' => 'btn btn-primary' ]) ?> | |
25 | + <?= Html::a(Yii::t('app', 'Delete'), [ | |
26 | + 'delete', | |
27 | + 'id' => $model->event_id, | |
28 | + ], [ | |
20 | 29 | 'class' => 'btn btn-danger', |
21 | - 'data' => [ | |
30 | + 'data' => [ | |
22 | 31 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
23 | - 'method' => 'post', | |
32 | + 'method' => 'post', | |
24 | 33 | ], |
25 | 34 | ]) ?> |
26 | 35 | </p> |
27 | - | |
36 | + | |
28 | 37 | <?= DetailView::widget([ |
29 | 38 | 'model' => $model, |
30 | 39 | 'attributes' => [ |
31 | 40 | 'event_id', |
32 | - 'name', | |
33 | - 'alias', | |
34 | - 'meta_title', | |
35 | - 'description', | |
36 | - 'h1', | |
41 | + 'imageUrl:image', | |
37 | 42 | ], |
38 | 43 | ]) ?> |
39 | 44 | ... | ... |
backend/views/page/_form.php
... | ... | @@ -6,8 +6,6 @@ |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use yii\web\View; |
8 | 8 | use yii\widgets\ActiveForm; |
9 | - use mihaildev\ckeditor\CKEditor; | |
10 | - use mihaildev\elfinder\ElFinder; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * @var View $this |
... | ... | @@ -21,49 +19,15 @@ |
21 | 19 | |
22 | 20 | <?php $form = ActiveForm::begin(); ?> |
23 | 21 | |
24 | - <?= $form->field($model, 'title') | |
25 | - ->textInput([ 'maxlength' => true ]) ?> | |
26 | - | |
27 | - <?= $form->field($model, 'translit') | |
28 | - ->textInput([ 'maxlength' => true ]) ?> | |
29 | - | |
30 | - <?= $form->field($model, 'body') | |
31 | - ->widget(CKEditor::className(), [ | |
32 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
33 | - 'preset' => 'full', | |
34 | - //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
35 | - 'inline' => false, | |
36 | - //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
37 | - 'allowedContent' => true, | |
38 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
39 | - ->createUrl('file/uploader/images-upload'), | |
40 | - ]), | |
41 | - ]) ?> | |
42 | - | |
43 | - <?= $form->field($model, 'meta_title') | |
44 | - ->textInput([ 'maxlength' => true ]) ?> | |
45 | - | |
46 | - <?= $form->field($model, 'meta_keywords') | |
47 | - ->textInput([ 'maxlength' => true ]) ?> | |
48 | - | |
49 | - <?= $form->field($model, 'meta_description') | |
50 | - ->textInput([ 'maxlength' => true ]) ?> | |
51 | - | |
52 | - <?= $form->field($model, 'seo_text') | |
53 | - ->textarea([ 'rows' => 6 ]) ?> | |
54 | - | |
55 | - <?= $form->field($model, 'h1') | |
56 | - ->textInput([ 'maxlength' => true ]) ?> | |
57 | - | |
58 | - <?= $form->field($model, 'in_menu') | |
59 | - ->checkbox() ?> | |
60 | - | |
61 | 22 | <?= LanguageForm::widget([ |
62 | 23 | 'model_langs' => $model_langs, |
63 | 24 | 'formView' => '@backend/views/page/_form_language', |
64 | 25 | 'form' => $form, |
65 | 26 | ]) ?> |
66 | 27 | |
28 | + <?= $form->field($model, 'in_menu') | |
29 | + ->checkbox() ?> | |
30 | + | |
67 | 31 | <div class="form-group"> |
68 | 32 | <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> |
69 | 33 | </div> | ... | ... |
backend/views/page/_form_language.php
... | ... | @@ -7,15 +7,16 @@ |
7 | 7 | use yii\widgets\ActiveForm; |
8 | 8 | |
9 | 9 | /** |
10 | - * @var PageLang $model_lang | |
11 | - * @var Language $language | |
12 | - * @var ActiveForm $form | |
13 | - * @var View $this | |
10 | + * @var PageLang $model_lang | |
11 | + * @var Language $language | |
12 | + * @var ActiveForm $form | |
13 | + * @var View $this | |
14 | 14 | */ |
15 | 15 | ?> |
16 | 16 | <?= $form->field($model_lang, '[' . $language->language_id . ']title') |
17 | 17 | ->textInput([ 'maxlength' => true ]); ?> |
18 | - | |
18 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
19 | + ->textInput([ 'maxlength' => true ]); ?> | |
19 | 20 | <?= $form->field($model_lang, '[' . $language->language_id . ']body') |
20 | 21 | ->widget(CKEditor::className(), [ |
21 | 22 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ... | ... |
backend/views/page/create.php
... | ... | @@ -10,9 +10,9 @@ |
10 | 10 | * @var Page $model |
11 | 11 | * @var PageLang[] $model_langs |
12 | 12 | */ |
13 | - $this->title = 'Create Page'; | |
13 | + $this->title = \Yii::t('app', 'Create Page'); | |
14 | 14 | $this->params[ 'breadcrumbs' ][] = [ |
15 | - 'label' => 'Pages', | |
15 | + 'label' => \Yii::t('app', 'Pages'), | |
16 | 16 | 'url' => [ 'index' ], |
17 | 17 | ]; |
18 | 18 | $this->params[ 'breadcrumbs' ][] = $this->title; | ... | ... |
backend/views/page/index.php
... | ... | @@ -7,32 +7,22 @@ use yii\grid\GridView; |
7 | 7 | /* @var $searchModel common\models\PageSearch */ |
8 | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | |
10 | -$this->title = 'Pages'; | |
10 | +$this->title = \Yii::t('app', 'Pages'); | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | 13 | <div class="page-index"> |
14 | 14 | |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | 16 | |
18 | 17 | <p> |
19 | - <?= Html::a('Create Page', ['create'], ['class' => 'btn btn-success']) ?> | |
18 | + <?= Html::a(\Yii::t('app', 'Create Page'), ['create'], ['class' => 'btn btn-success']) ?> | |
20 | 19 | </p> |
21 | 20 | <?= GridView::widget([ |
22 | 21 | 'dataProvider' => $dataProvider, |
23 | 22 | 'filterModel' => $searchModel, |
24 | 23 | 'columns' => [ |
25 | 24 | ['class' => 'yii\grid\SerialColumn'], |
26 | - | |
27 | 25 | 'id', |
28 | - 'translit', | |
29 | - 'title', | |
30 | - 'meta_title', | |
31 | - // 'meta_keywords', | |
32 | - // 'meta_description', | |
33 | - // 'seo_text:ntext', | |
34 | - // 'h1', | |
35 | - | |
36 | 26 | ['class' => 'yii\grid\ActionColumn'], |
37 | 27 | ], |
38 | 28 | ]); ?> | ... | ... |
backend/views/page/update.php
... | ... | @@ -11,19 +11,19 @@ |
11 | 11 | * @var PageLang[] $model_langs |
12 | 12 | */ |
13 | 13 | |
14 | - $this->title = 'Update Page: ' . $model->title; | |
14 | + $this->title = \Yii::t('app', 'Update Page').': ' . $model->id; | |
15 | 15 | $this->params[ 'breadcrumbs' ][] = [ |
16 | - 'label' => 'Pages', | |
16 | + 'label' => \Yii::t('app', 'Pages'), | |
17 | 17 | 'url' => [ 'index' ], |
18 | 18 | ]; |
19 | 19 | $this->params[ 'breadcrumbs' ][] = [ |
20 | - 'label' => $model->title, | |
20 | + 'label' => $model->id, | |
21 | 21 | 'url' => [ |
22 | 22 | 'view', |
23 | 23 | 'id' => $model->id, |
24 | 24 | ], |
25 | 25 | ]; |
26 | - $this->params[ 'breadcrumbs' ][] = 'Update'; | |
26 | + $this->params[ 'breadcrumbs' ][] = \Yii::t('app', 'Update'); | |
27 | 27 | ?> |
28 | 28 | <div class="page-update"> |
29 | 29 | ... | ... |
backend/views/page/view.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\Page */ | |
8 | - | |
9 | -$this->title = $model->title; | |
10 | -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\widgets\DetailView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $model common\models\Page */ | |
8 | + | |
9 | + $this->title = $model->id; | |
10 | + $this->params[ 'breadcrumbs' ][] = [ | |
11 | + 'label' => \Yii::t('app', 'Pages'), | |
12 | + 'url' => [ 'index' ], | |
13 | + ]; | |
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 15 | ?> |
13 | 16 | <div class="page-view"> |
14 | - | |
17 | + | |
15 | 18 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - | |
19 | + | |
17 | 20 | <p> |
18 | - <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
21 | + <?= Html::a(\Yii::t('app', 'Update'), [ | |
22 | + 'update', | |
23 | + 'id' => $model->id, | |
24 | + ], [ 'class' => 'btn btn-primary' ]) ?> | |
25 | + <?= Html::a(\Yii::t('app', 'Delete'), [ | |
26 | + 'delete', | |
27 | + 'id' => $model->id, | |
28 | + ], [ | |
20 | 29 | 'class' => 'btn btn-danger', |
21 | - 'data' => [ | |
22 | - 'confirm' => 'Are you sure you want to delete this item?', | |
23 | - 'method' => 'post', | |
30 | + 'data' => [ | |
31 | + 'confirm' => \Yii::t('app', 'Are you sure you want to delete this item?'), | |
32 | + 'method' => 'post', | |
24 | 33 | ], |
25 | 34 | ]) ?> |
26 | 35 | </p> |
27 | - | |
36 | + | |
28 | 37 | <?= DetailView::widget([ |
29 | 38 | 'model' => $model, |
30 | 39 | 'attributes' => [ |
31 | 40 | 'id', |
32 | - 'translit', | |
33 | - 'title', | |
34 | - 'body:ntext', | |
35 | - 'meta_title', | |
36 | - 'meta_keywords', | |
37 | - 'meta_description', | |
38 | - 'seo_text:ntext', | |
39 | - 'h1', | |
40 | 41 | ], |
41 | 42 | ]) ?> |
42 | 43 | ... | ... |
backend/views/project/_form.php
... | ... | @@ -6,8 +6,6 @@ |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use yii\web\View; |
8 | 8 | use yii\widgets\ActiveForm; |
9 | - use mihaildev\ckeditor\CKEditor; | |
10 | - use mihaildev\elfinder\ElFinder; | |
11 | 9 | use yii\jui\DatePicker; |
12 | 10 | |
13 | 11 | /** |
... | ... | @@ -30,24 +28,6 @@ |
30 | 28 | 'dateFormat' => 'dd-MM-yyyy', |
31 | 29 | ]) ?> |
32 | 30 | |
33 | - <?= $form->field($model, 'title') | |
34 | - ->textInput([ 'maxlength' => true ]) ?> | |
35 | - | |
36 | - <?= $form->field($model, 'link') | |
37 | - ->textInput([ 'maxlength' => true ]) ?> | |
38 | - | |
39 | - <?= $form->field($model, 'description') | |
40 | - ->widget(CKEditor::className(), [ | |
41 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
42 | - 'preset' => 'full', | |
43 | - //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
44 | - 'inline' => false, | |
45 | - //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
46 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
47 | - ->createUrl('file/uploader/images-upload'), | |
48 | - ]), | |
49 | - ]) ?> | |
50 | - | |
51 | 31 | <?= $form->field($model, 'imagesUpload[]') |
52 | 32 | ->widget(\kartik\file\FileInput::className(), [ |
53 | 33 | 'language' => 'ru', |
... | ... | @@ -78,7 +58,7 @@ |
78 | 58 | ]) ?> |
79 | 59 | |
80 | 60 | <div class="form-group"> |
81 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> | |
61 | + <?= Html::submitButton($model->isNewRecord ? \Yii::t('app', 'Create') : \Yii::t('app', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> | |
82 | 62 | </div> |
83 | 63 | |
84 | 64 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/project/_form_language.php
... | ... | @@ -15,6 +15,8 @@ |
15 | 15 | ?> |
16 | 16 | <?= $form->field($model_lang, '[' . $language->language_id . ']title') |
17 | 17 | ->textInput([ 'maxlength' => true ]); ?> |
18 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
19 | + ->textInput([ 'maxlength' => true ]); ?> | |
18 | 20 | <?= $form->field($model_lang, '[' . $language->language_id . ']description') |
19 | 21 | ->widget(CKEditor::className(), [ |
20 | 22 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ... | ... |
backend/views/project/create.php
... | ... | @@ -11,9 +11,9 @@ |
11 | 11 | * @var ProjectLang $model_langs |
12 | 12 | */ |
13 | 13 | |
14 | - $this->title = 'Create Project'; | |
14 | + $this->title = \Yii::t('app', 'Create Project'); | |
15 | 15 | $this->params[ 'breadcrumbs' ][] = [ |
16 | - 'label' => 'Projects', | |
16 | + 'label' => \Yii::t('app', 'Projects'), | |
17 | 17 | 'url' => [ 'index' ], |
18 | 18 | ]; |
19 | 19 | $this->params[ 'breadcrumbs' ][] = $this->title; | ... | ... |
backend/views/project/index.php
... | ... | @@ -7,15 +7,15 @@ use yii\grid\GridView; |
7 | 7 | /* @var $searchModel common\models\ArticlesSearch */ |
8 | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | |
10 | -$this->title = 'Project'; | |
10 | +$this->title = \Yii::t('app', 'Project'); | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | -<div class="articles-index" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> | |
13 | +<div class="articles-index"> | |
14 | 14 | |
15 | - <h1 itemprop="title"><?= Html::encode($this->title) ?></h1> | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | 16 | |
17 | 17 | <p> |
18 | - <?= Html::a('Create Project', ['create'], ['class' => 'btn btn-success']) ?> | |
18 | + <?= Html::a(\Yii::t('app', 'Create Project'), ['create'], ['class' => 'btn btn-success']) ?> | |
19 | 19 | </p> |
20 | 20 | <?= GridView::widget([ |
21 | 21 | 'dataProvider' => $dataProvider, |
... | ... | @@ -24,8 +24,6 @@ $this->params['breadcrumbs'][] = $this->title; |
24 | 24 | ['class' => 'yii\grid\SerialColumn'], |
25 | 25 | 'project_id', |
26 | 26 | 'date_add:date', |
27 | - 'title', | |
28 | - | |
29 | 27 | [ |
30 | 28 | 'class' => 'yii\grid\ActionColumn', |
31 | 29 | 'buttons' => [ | ... | ... |
backend/views/project/product-create.php
... | ... | @@ -14,9 +14,9 @@ |
14 | 14 | * @var ProductToProject $model |
15 | 15 | * @var array $variants |
16 | 16 | */ |
17 | - $this->title = 'Create product to project'; | |
17 | + $this->title = \Yii::t('app', 'Create product to project'); | |
18 | 18 | $this->params[ 'breadcrumbs' ][] = [ |
19 | - 'label' => 'Products to project', | |
19 | + 'label' => \Yii::t('app', 'Products to project'), | |
20 | 20 | 'url' => [ |
21 | 21 | 'product', |
22 | 22 | 'id' => $project->project_id, |
... | ... | @@ -29,30 +29,28 @@ |
29 | 29 | <?php |
30 | 30 | $form = ActiveForm::begin(); |
31 | 31 | echo $form->field($model, 'product_id') |
32 | - ->dropDownList($products, [ 'prompt' => 'ะัะฑะตัะธัะต ะบะพะปะปะตะบัะธั' ]); | |
32 | + ->dropDownList($products, [ 'prompt' => \Yii::t('app', 'ะัะฑะตัะธัะต ะบะพะปะปะตะบัะธั')]); | |
33 | 33 | ?> |
34 | 34 | <div class="<?php echo( !empty( $variants ) ? '' : 'hidden' ); ?> product_variant_container"> |
35 | 35 | <?php |
36 | 36 | echo $form->field($model, 'product_variant_id') |
37 | - ->dropDownList($variants, [ 'prompt' => 'ะัะฑะตัะธัะต ัะพะฒะฐั' ]); | |
37 | + ->dropDownList($variants, [ 'prompt' => \Yii::t('app', 'ะัะฑะตัะธัะต ัะพะฒะฐั')]); | |
38 | 38 | ?> |
39 | 39 | </div> |
40 | 40 | <?php |
41 | - echo Html::submitInput(($model->isNewRecord?'ะะพะฑะฐะฒะธัั':'ะะฑะฝะพะฒะธัั'), [ 'class' => 'btn btn-success' ]); | |
41 | + echo Html::submitInput(($model->isNewRecord?\Yii::t('app', 'ะะพะฑะฐะฒะธัั'):\Yii::t('app', 'ะะฑะฝะพะฒะธัั')), [ 'class' => 'btn btn-success' ]); | |
42 | 42 | $form::end(); |
43 | 43 | ?> |
44 | 44 | </div> |
45 | -<script> | |
46 | - $( | |
47 | - function() | |
48 | - { | |
49 | - $(document).on( | |
45 | +<?php | |
46 | +$this->registerJs(" | |
47 | + $(document).on( | |
50 | 48 | 'change', '#producttoproject-product_id', function(e) |
51 | 49 | { |
52 | 50 | var value = parseInt($(this).val()); |
53 | 51 | var dropDown = $('#producttoproject-product_variant_id'); |
54 | 52 | var container = $(dropDown).parents('.product_variant_container'); |
55 | - $(dropDown).find('option[value!=""]').remove(); | |
53 | + $(dropDown).find('option[value!=\"\"]').remove(); | |
56 | 54 | $(container).addClass('hidden'); |
57 | 55 | if(value) |
58 | 56 | { |
... | ... | @@ -65,7 +63,7 @@ |
65 | 63 | data, function(key, value) |
66 | 64 | { |
67 | 65 | $(dropDown) |
68 | - .append('<option value="' + value.product_variant_id + '">' + value.name + '</option>'); | |
66 | + .append('<option value=\"' + value.product_variant_id + '\">' + value.product_variant_id + '</option>'); | |
69 | 67 | } |
70 | 68 | ); |
71 | 69 | console.log('hiodde'); |
... | ... | @@ -76,6 +74,5 @@ |
76 | 74 | } |
77 | 75 | } |
78 | 76 | ); |
79 | - } | |
80 | - ); | |
81 | -</script> | |
82 | 77 | \ No newline at end of file |
78 | +"); | |
79 | +?> | |
83 | 80 | \ No newline at end of file | ... | ... |
backend/views/project/product.php
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | * @var Project $project |
17 | 17 | */ |
18 | 18 | |
19 | - $this->title = 'Product to project'; | |
19 | + $this->title = \Yii::t('app', 'Product to project'); | |
20 | 20 | $this->params[ 'breadcrumbs' ][] = $this->title; |
21 | 21 | ?> |
22 | 22 | <div class="articles-index"> |
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | <h1 itemprop="title"><?= Html::encode($this->title) ?></h1> |
25 | 25 | |
26 | 26 | <p> |
27 | - <?= Html::a('Product to project', [ | |
27 | + <?= Html::a(\Yii::t('app', 'Product to project'), [ | |
28 | 28 | 'product-create', |
29 | 29 | 'id' => $project->project_id, |
30 | 30 | ], [ 'class' => 'btn btn-success' ]) ?> |
... | ... | @@ -34,8 +34,8 @@ |
34 | 34 | 'filterModel' => $searchModel, |
35 | 35 | 'columns' => [ |
36 | 36 | [ 'class' => 'yii\grid\SerialColumn' ], |
37 | - 'product.name', | |
38 | - 'productVariant.name', | |
37 | + 'product_variant_id', | |
38 | + 'project_id', | |
39 | 39 | [ |
40 | 40 | 'class' => 'yii\grid\ActionColumn', |
41 | 41 | 'template' => '{update} {delete}', |
... | ... | @@ -62,8 +62,8 @@ |
62 | 62 | 'project/product-delete', |
63 | 63 | 'product_to_project_id' => $model->product_to_project_id, |
64 | 64 | ]), [ |
65 | - 'data-confirm' => 'ะั ัะฒะตัะตะฝั, ััะพ ั ะพัะธัะต ัะดะฐะปะธัั ััะพั ัะปะตะผะตะฝั?', | |
66 | - 'title' => 'ะฃะดะฐะปะธัั', | |
65 | + 'data-confirm' => \Yii::t('app', 'ะั ัะฒะตัะตะฝั, ััะพ ั ะพัะธัะต ัะดะฐะปะธัั ััะพั ัะปะตะผะตะฝั?'), | |
66 | + 'title' => \Yii::t('app', 'ะฃะดะฐะปะธัั'), | |
67 | 67 | 'data-method' => 'post', |
68 | 68 | 'data-pjax' => 0, |
69 | 69 | ]); | ... | ... |
backend/views/project/update.php
... | ... | @@ -10,19 +10,19 @@ |
10 | 10 | * @var Project $model |
11 | 11 | * @var ProjectLang $model_langs |
12 | 12 | */ |
13 | - $this->title = 'Update Project: ' . $model->title; | |
13 | + $this->title = \Yii::t('app', 'Update Project').': ' . $model->project_id; | |
14 | 14 | $this->params[ 'breadcrumbs' ][] = [ |
15 | - 'label' => 'Project', | |
15 | + 'label' => \Yii::t('app', 'Project'), | |
16 | 16 | 'url' => [ 'index' ], |
17 | 17 | ]; |
18 | 18 | $this->params[ 'breadcrumbs' ][] = [ |
19 | - 'label' => $model->title, | |
19 | + 'label' => $model->project_id, | |
20 | 20 | 'url' => [ |
21 | 21 | 'view', |
22 | 22 | 'id' => $model->project_id, |
23 | 23 | ], |
24 | 24 | ]; |
25 | - $this->params[ 'breadcrumbs' ][] = 'Update'; | |
25 | + $this->params[ 'breadcrumbs' ][] = \Yii::t('app', 'Update'); | |
26 | 26 | ?> |
27 | 27 | <div class="articles-update"> |
28 | 28 | ... | ... |
backend/views/project/view.php
... | ... | @@ -6,20 +6,20 @@ use yii\widgets\DetailView; |
6 | 6 | /* @var $this yii\web\View */ |
7 | 7 | /* @var $model common\models\Project */ |
8 | 8 | |
9 | -$this->title = $model->title; | |
10 | -$this->params['breadcrumbs'][] = ['label' => 'Project', 'url' => ['index']]; | |
9 | +$this->title = $model->project_id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => \Yii::t('app', 'Project'), 'url' => ['index']]; | |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
13 | -<div class="articles-view" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> | |
13 | +<div class="articles-view"> | |
14 | 14 | |
15 | - <h1 itemprop="title"><?= Html::encode($this->title) ?></h1> | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | 16 | |
17 | 17 | <p> |
18 | - <?= Html::a('Update', ['update', 'id' => $model->project_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a('Delete', ['delete', 'id' => $model->project_id], [ | |
18 | + <?= Html::a(\Yii::t('app', 'Update'), ['update', 'id' => $model->project_id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a(\Yii::t('app', 'Delete'), ['delete', 'id' => $model->project_id], [ | |
20 | 20 | 'class' => 'btn btn-danger', |
21 | 21 | 'data' => [ |
22 | - 'confirm' => 'Are you sure you want to delete this item?', | |
22 | + 'confirm' => \Yii::t('app', 'Are you sure you want to delete this item?'), | |
23 | 23 | 'method' => 'post', |
24 | 24 | ], |
25 | 25 | ]) ?> |
... | ... | @@ -30,7 +30,6 @@ $this->params['breadcrumbs'][] = $this->title; |
30 | 30 | 'attributes' => [ |
31 | 31 | 'project_id', |
32 | 32 | 'date_add:date', |
33 | - 'title', | |
34 | 33 | ], |
35 | 34 | ]) ?> |
36 | 35 | ... | ... |
backend/views/seo-category/_form.php
backend/views/seo-category/index.php
... | ... | @@ -24,12 +24,9 @@ $this->params['breadcrumbs'][] = $this->title; |
24 | 24 | 'filterModel' => $searchModel, |
25 | 25 | 'columns' => [ |
26 | 26 | ['class' => 'yii\grid\SerialColumn'], |
27 | - | |
28 | 27 | 'seo_category_id', |
29 | - 'name', | |
30 | 28 | 'controller', |
31 | 29 | 'status', |
32 | - | |
33 | 30 | [ |
34 | 31 | 'class' => 'yii\grid\ActionColumn', |
35 | 32 | 'template' => '{update} {image} {delete}', | ... | ... |
backend/views/seo-category/update.php
... | ... | @@ -13,13 +13,13 @@ |
13 | 13 | |
14 | 14 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
15 | 15 | 'modelClass' => 'Seo Category', |
16 | - ]) . $model->name; | |
16 | + ]) . $model->seo_category_id; | |
17 | 17 | $this->params[ 'breadcrumbs' ][] = [ |
18 | 18 | 'label' => Yii::t('app', 'Seo Categories'), |
19 | 19 | 'url' => [ 'index' ], |
20 | 20 | ]; |
21 | 21 | $this->params[ 'breadcrumbs' ][] = [ |
22 | - 'label' => $model->name, | |
22 | + 'label' => $model->seo_category_id, | |
23 | 23 | 'url' => [ |
24 | 24 | 'view', |
25 | 25 | 'id' => $model->seo_category_id, | ... | ... |
backend/views/seo-category/view.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\SeoCategory */ | |
8 | - | |
9 | -$this->title = $model->name; | |
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\widgets\DetailView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $model common\models\SeoCategory */ | |
8 | + | |
9 | + $this->title = $model->seo_category_id; | |
10 | + $this->params[ 'breadcrumbs' ][] = [ | |
11 | + 'label' => Yii::t('app', 'Seo Categories'), | |
12 | + 'url' => [ 'index' ], | |
13 | + ]; | |
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 15 | ?> |
13 | 16 | <div class="seo-category-view"> |
14 | - | |
17 | + | |
15 | 18 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - | |
19 | + | |
17 | 20 | <p> |
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_category_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_category_id], [ | |
21 | + <?= Html::a(Yii::t('app', 'Update'), [ | |
22 | + 'update', | |
23 | + 'id' => $model->seo_category_id, | |
24 | + ], [ 'class' => 'btn btn-primary' ]) ?> | |
25 | + <?= Html::a(Yii::t('app', 'Delete'), [ | |
26 | + 'delete', | |
27 | + 'id' => $model->seo_category_id, | |
28 | + ], [ | |
20 | 29 | 'class' => 'btn btn-danger', |
21 | - 'data' => [ | |
30 | + 'data' => [ | |
22 | 31 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
23 | - 'method' => 'post', | |
32 | + 'method' => 'post', | |
24 | 33 | ], |
25 | 34 | ]) ?> |
26 | 35 | </p> |
27 | - | |
36 | + | |
28 | 37 | <?= DetailView::widget([ |
29 | 38 | 'model' => $model, |
30 | 39 | 'attributes' => [ |
31 | 40 | 'seo_category_id', |
32 | - 'name', | |
33 | 41 | 'controller', |
34 | 42 | 'status', |
35 | 43 | ], | ... | ... |
backend/views/seo-dynamic/_form.php
... | ... | @@ -24,36 +24,15 @@ |
24 | 24 | |
25 | 25 | <?php $form = ActiveForm::begin(); ?> |
26 | 26 | |
27 | - <?= $form->field($model, 'name') | |
28 | - ->textInput([ 'maxlength' => true ]) ?> | |
29 | - | |
30 | 27 | <?= $form->field($model, 'action') |
31 | 28 | ->textInput([ 'maxlength' => true ]) ?> |
32 | 29 | |
33 | 30 | <?= $form->field($model, 'param') |
34 | 31 | ->textInput([ 'maxlength' => true ]) ?> |
35 | 32 | |
36 | - <?= $form->field($model, 'key') | |
37 | - ->textInput([ 'maxlength' => true ]) ?> | |
38 | - | |
39 | 33 | <?= $form->field($model, 'fields') |
40 | 34 | ->textInput([ 'maxlength' => true ]) ?> |
41 | 35 | |
42 | - <?= $form->field($model, 'title') | |
43 | - ->textInput([ 'maxlength' => true ]) ?> | |
44 | - | |
45 | - <?= $form->field($model, 'meta') | |
46 | - ->textInput([ 'maxlength' => true ]) ?> | |
47 | - | |
48 | - <?= $form->field($model, 'h1') | |
49 | - ->textInput([ 'maxlength' => true ]) ?> | |
50 | - | |
51 | - <?= $form->field($model, 'description') | |
52 | - ->textInput([ 'maxlength' => true ]) ?> | |
53 | - | |
54 | - <?= $form->field($model, 'seo_text') | |
55 | - ->textarea([ 'rows' => 6 ]) ?> | |
56 | - | |
57 | 36 | <?= $form->field($model, 'status') |
58 | 37 | ->textInput() ?> |
59 | 38 | ... | ... |
backend/views/seo-dynamic/index.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\grid\GridView; | |
5 | -use yii\helpers\Url; | |
6 | - | |
7 | -/* @var $this yii\web\View */ | |
8 | -/* @var $searchModel common\models\SeoDynamicSearch */ | |
9 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
10 | - | |
11 | -$this->title = Yii::t('app', 'Seo Dynamics'); | |
12 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\grid\GridView; | |
5 | + use yii\helpers\Url; | |
6 | + | |
7 | + /* @var $this yii\web\View */ | |
8 | + /* @var $searchModel common\models\SeoDynamicSearch */ | |
9 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | |
10 | + | |
11 | + $this->title = Yii::t('app', 'Seo Dynamics'); | |
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
13 | 13 | ?> |
14 | 14 | <div class="seo-dynamic-index"> |
15 | - | |
15 | + | |
16 | 16 | <h1><?= Html::encode($this->title) ?></h1> |
17 | 17 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
18 | - | |
18 | + | |
19 | 19 | <p> |
20 | - <?= Html::a(Yii::t('app', 'Create Seo Dynamic'), Url::toRoute(['create','seo_category_id'=>$seo_category_id]), ['class' => 'btn btn-success']) ?> | |
20 | + <?= Html::a(Yii::t('app', 'Create Seo Dynamic'), Url::toRoute([ | |
21 | + 'create', | |
22 | + 'seo_category_id' => $seo_category_id, | |
23 | + ]), [ 'class' => 'btn btn-success' ]) ?> | |
21 | 24 | </p> |
22 | 25 | <?= GridView::widget([ |
23 | 26 | 'dataProvider' => $dataProvider, |
24 | - 'filterModel' => $searchModel, | |
25 | - 'columns' => [ | |
26 | - ['class' => 'yii\grid\SerialColumn'], | |
27 | - | |
27 | + 'filterModel' => $searchModel, | |
28 | + 'columns' => [ | |
29 | + [ 'class' => 'yii\grid\SerialColumn' ], | |
28 | 30 | 'seo_dynamic_id', |
29 | 31 | 'seo_category_id', |
30 | - 'name', | |
31 | 32 | 'action', |
32 | 33 | 'fields', |
33 | - 'meta', | |
34 | - // 'title', | |
35 | - // 'h1', | |
36 | - // 'description', | |
37 | - // 'seo_text:ntext', | |
38 | - // 'status', | |
39 | - | |
34 | + 'status', | |
40 | 35 | [ |
41 | - 'class' => 'yii\grid\ActionColumn', | |
42 | - 'buttons' => [ | |
43 | - 'view' => function ($url, $model) | |
44 | - { | |
45 | - return Html::a ( | |
46 | - '<span class="glyphicon glyphicon-eye-open"></span>', | |
47 | - Url::toRoute(['view','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), | |
48 | - [ | |
36 | + 'class' => 'yii\grid\ActionColumn', | |
37 | + 'buttons' => [ | |
38 | + 'view' => function($url, $model) { | |
39 | + return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', Url::toRoute([ | |
40 | + 'view', | |
41 | + 'seo_category_id' => $model->seo_category_id, | |
42 | + 'id' => $model->seo_dynamic_id, | |
43 | + ]), [ | |
49 | 44 | 'title' => "ะัะพัะผะพัั", |
50 | - ] | |
51 | - ); | |
45 | + ]); | |
52 | 46 | }, |
53 | - 'update' => function ($url, $model) | |
54 | - { | |
55 | - return Html::a ( | |
56 | - '<span class="glyphicon glyphicon-pencil"></span>', | |
57 | - Url::toRoute(['update','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), | |
58 | - [ | |
47 | + 'update' => function($url, $model) { | |
48 | + return Html::a('<span class="glyphicon glyphicon-pencil"></span>', Url::toRoute([ | |
49 | + 'update', | |
50 | + 'seo_category_id' => $model->seo_category_id, | |
51 | + 'id' => $model->seo_dynamic_id, | |
52 | + ]), [ | |
59 | 53 | 'title' => "ะ ะตะดะฐะบัะธัะพะฒะฐัั", |
60 | - ] | |
61 | - ); | |
54 | + ]); | |
62 | 55 | }, |
63 | - 'delete' => function ($url, $model) | |
64 | - { | |
65 | - | |
66 | - return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::toRoute(['delete','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), [ | |
67 | - 'title' => Yii::t('yii', 'Delete'), | |
56 | + 'delete' => function($url, $model) { | |
57 | + | |
58 | + return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::toRoute([ | |
59 | + 'delete', | |
60 | + 'seo_category_id' => $model->seo_category_id, | |
61 | + 'id' => $model->seo_dynamic_id, | |
62 | + ]), [ | |
63 | + 'title' => Yii::t('yii', 'Delete'), | |
68 | 64 | 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), |
69 | - 'data-method' => 'post', | |
65 | + 'data-method' => 'post', | |
70 | 66 | ]); |
71 | - | |
67 | + | |
72 | 68 | }, |
73 | 69 | ], |
74 | 70 | ], | ... | ... |
backend/views/seo-dynamic/update.php
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | |
16 | 16 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
17 | 17 | 'modelClass' => 'Seo Dynamic', |
18 | - ]) . $model->name; | |
18 | + ]) . $model->seo_dynamic_id; | |
19 | 19 | $this->params[ 'breadcrumbs' ][] = [ |
20 | 20 | 'label' => Yii::t('app', 'Seo Dynamics'), |
21 | 21 | 'url' => Url::toRoute([ |
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | ]), |
25 | 25 | ]; |
26 | 26 | $this->params[ 'breadcrumbs' ][] = [ |
27 | - 'label' => $model->name, | |
27 | + 'label' => $model->seo_dynamic_id, | |
28 | 28 | 'url' => Url::toRoute([ |
29 | 29 | 'view', |
30 | 30 | 'seo_category_id' => $seo_category_id, | ... | ... |
backend/views/seo-dynamic/view.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\SeoDynamic */ | |
8 | - | |
9 | -$this->title = $model->name; | |
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\widgets\DetailView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $model common\models\SeoDynamic */ | |
8 | + | |
9 | + $this->title = $model->seo_dynamic_id; | |
10 | + $this->params[ 'breadcrumbs' ][] = [ | |
11 | + 'label' => Yii::t('app', 'Seo Dynamics'), | |
12 | + 'url' => [ 'index' ], | |
13 | + ]; | |
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 15 | ?> |
13 | 16 | <div class="seo-dynamic-view"> |
14 | - | |
17 | + | |
15 | 18 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - | |
19 | + | |
17 | 20 | <p> |
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_dynamic_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_dynamic_id], [ | |
21 | + <?= Html::a(Yii::t('app', 'Update'), [ | |
22 | + 'update', | |
23 | + 'id' => $model->seo_dynamic_id, | |
24 | + ], [ 'class' => 'btn btn-primary' ]) ?> | |
25 | + <?= Html::a(Yii::t('app', 'Delete'), [ | |
26 | + 'delete', | |
27 | + 'id' => $model->seo_dynamic_id, | |
28 | + ], [ | |
20 | 29 | 'class' => 'btn btn-danger', |
21 | - 'data' => [ | |
30 | + 'data' => [ | |
22 | 31 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
23 | - 'method' => 'post', | |
32 | + 'method' => 'post', | |
24 | 33 | ], |
25 | 34 | ]) ?> |
26 | 35 | </p> |
27 | - | |
36 | + | |
28 | 37 | <?= DetailView::widget([ |
29 | 38 | 'model' => $model, |
30 | 39 | 'attributes' => [ |
31 | 40 | 'seo_dynamic_id', |
32 | 41 | 'seo_category_id', |
33 | - 'name', | |
34 | 42 | 'action', |
35 | 43 | 'fields', |
36 | - 'title', | |
37 | - 'meta', | |
38 | - 'h1', | |
39 | - 'description', | |
40 | - 'seo_text:ntext', | |
41 | 44 | 'status', |
42 | 45 | ], |
43 | 46 | ]) ?> | ... | ... |
backend/views/seo/_form.php
... | ... | @@ -6,8 +6,6 @@ |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use yii\web\View; |
8 | 8 | use yii\widgets\ActiveForm; |
9 | - use mihaildev\ckeditor\CKEditor; | |
10 | - use mihaildev\elfinder\ElFinder; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * @var View $this |
... | ... | @@ -24,29 +22,6 @@ |
24 | 22 | <?= $form->field($model, 'url') |
25 | 23 | ->textInput([ 'maxlength' => true ]) ?> |
26 | 24 | |
27 | - <?= $form->field($model, 'title') | |
28 | - ->textInput([ 'maxlength' => true ]) ?> | |
29 | - | |
30 | - <?= $form->field($model, 'meta') | |
31 | - ->textInput([ 'maxlength' => true ]) ?> | |
32 | - | |
33 | - <?= $form->field($model, 'description') | |
34 | - ->textInput([ 'maxlength' => true ]) ?> | |
35 | - | |
36 | - <?= $form->field($model, 'h1') | |
37 | - ->textInput([ 'maxlength' => true ]) ?> | |
38 | - <?= $form->field($model, 'seo_text') | |
39 | - ->widget(CKEditor::className(), [ | |
40 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
41 | - 'preset' => 'full', | |
42 | - //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
43 | - 'inline' => false, | |
44 | - //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
45 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
46 | - ->createUrl('file/uploader/images-upload'), | |
47 | - ]), | |
48 | - ]) ?> | |
49 | - | |
50 | 25 | <?= LanguageForm::widget([ |
51 | 26 | 'model_langs' => $model_langs, |
52 | 27 | 'formView' => '@backend/views/seo/_form_language', | ... | ... |
backend/views/seo/_form_language.php
... | ... | @@ -7,14 +7,15 @@ |
7 | 7 | use yii\widgets\ActiveForm; |
8 | 8 | |
9 | 9 | /** |
10 | - * @var SeoLang $model_lang | |
11 | - * @var Language $language | |
12 | - * @var ActiveForm $form | |
13 | - * @var View $this | |
10 | + * @var SeoLang $model_lang | |
11 | + * @var Language $language | |
12 | + * @var ActiveForm $form | |
13 | + * @var View $this | |
14 | 14 | */ |
15 | 15 | ?> |
16 | 16 | <?= $form->field($model_lang, '[' . $language->language_id . ']title') |
17 | 17 | ->textInput([ 'maxlength' => true ]); ?> |
18 | + | |
18 | 19 | <?= $form->field($model_lang, '[' . $language->language_id . ']description') |
19 | 20 | ->widget(CKEditor::className(), [ |
20 | 21 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ... | ... |
backend/views/seo/index.php
... | ... | @@ -23,13 +23,8 @@ $this->params['breadcrumbs'][] = $this->title; |
23 | 23 | 'filterModel' => $searchModel, |
24 | 24 | 'columns' => [ |
25 | 25 | ['class' => 'yii\grid\SerialColumn'], |
26 | - | |
27 | 26 | 'seo_id', |
28 | - 'url:url', | |
29 | - 'meta', | |
30 | - 'h1', | |
31 | - // 'seo_text:ntext', | |
32 | - | |
27 | + 'url', | |
33 | 28 | ['class' => 'yii\grid\ActionColumn'], |
34 | 29 | ], |
35 | 30 | ]); ?> | ... | ... |
backend/views/seo/update.php
backend/views/seo/view.php
... | ... | @@ -6,7 +6,7 @@ use yii\widgets\DetailView; |
6 | 6 | /* @var $this yii\web\View */ |
7 | 7 | /* @var $model common\models\Seo */ |
8 | 8 | |
9 | -$this->title = $model->title; | |
9 | +$this->title = $model->seo_id; | |
10 | 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; |
11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | ?> |
... | ... | @@ -29,12 +29,7 @@ $this->params['breadcrumbs'][] = $this->title; |
29 | 29 | 'model' => $model, |
30 | 30 | 'attributes' => [ |
31 | 31 | 'seo_id', |
32 | - 'url:url', | |
33 | - 'title', | |
34 | - 'meta', | |
35 | - 'description', | |
36 | - 'h1', | |
37 | - 'seo_text:ntext', | |
32 | + 'url', | |
38 | 33 | ], |
39 | 34 | ]) ?> |
40 | 35 | ... | ... |
backend/views/service/_form.php
... | ... | @@ -6,8 +6,6 @@ |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use yii\web\View; |
8 | 8 | use yii\widgets\ActiveForm; |
9 | - use mihaildev\ckeditor\CKEditor; | |
10 | - use mihaildev\elfinder\ElFinder; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * @var View $this |
... | ... | @@ -19,56 +17,32 @@ |
19 | 17 | |
20 | 18 | <div class="service-form"> |
21 | 19 | |
22 | - <?php $form = ActiveForm::begin(); ?> | |
23 | - | |
24 | - <?= $form->field($model, 'name') | |
25 | - ->textInput([ 'maxlength' => true ]) ?> | |
26 | - | |
27 | - <?= $form->field($model, 'alias') | |
28 | - ->textInput([ 'maxlength' => true ]) ?> | |
29 | - | |
30 | - <?= $form->field($model, 'body') | |
31 | - ->widget(CKEditor::className(), [ | |
32 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
33 | - 'preset' => 'full', | |
34 | - //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
35 | - 'inline' => false, | |
36 | - //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
37 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
38 | - ->createUrl('file/uploader/images-upload'), | |
39 | - ]), | |
40 | - ]) ?> | |
41 | - | |
42 | - | |
43 | - <?= \common\modules\file\widgets\ImageUploader::widget([ | |
44 | - 'model' => $model, | |
45 | - 'field' => 'image', | |
46 | - 'size' => [ | |
47 | - [ | |
48 | - 'width' => 200, | |
49 | - 'height' => 200, | |
50 | - ], | |
51 | - [ | |
52 | - 'width' => 940, | |
53 | - 'height' => 480, | |
54 | - ], | |
20 | + <?php $form = ActiveForm::begin([ | |
21 | + 'options' => [ | |
22 | + 'enctype' => 'multipart/form-data', | |
55 | 23 | ], |
56 | - 'multi' => false, | |
57 | - 'gallery' => $model->image, | |
58 | - 'name' => 'ะะฐะณััะทะธัั ะธะทะพะฑัะฐะถะตะฝะธะต', | |
59 | 24 | ]); ?> |
60 | 25 | |
61 | - <?= $form->field($model, 'meta_title') | |
62 | - ->textInput([ 'maxlength' => true ]) ?> | |
63 | - | |
64 | - <?= $form->field($model, 'description') | |
65 | - ->textInput([ 'maxlength' => true ]) ?> | |
66 | - | |
67 | - <?= $form->field($model, 'h1') | |
68 | - ->textInput([ 'maxlength' => true ]) ?> | |
69 | - | |
70 | - <?= $form->field($model, 'seo_text') | |
71 | - ->textarea([ 'rows' => 6 ]) ?> | |
26 | + <?= $form->field($model, 'image') | |
27 | + ->widget(\kartik\file\FileInput::className(), [ | |
28 | + 'language' => 'ru', | |
29 | + 'options' => [ | |
30 | + 'accept' => 'image/*', | |
31 | + 'multiple' => false, | |
32 | + ], | |
33 | + 'pluginOptions' => [ | |
34 | + 'allowedFileExtensions' => [ | |
35 | + 'jpg', | |
36 | + 'gif', | |
37 | + 'png', | |
38 | + ], | |
39 | + 'initialPreview' => !empty( $model->imageUrl ) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '', | |
40 | + 'overwriteInitial' => true, | |
41 | + 'showRemove' => false, | |
42 | + 'showUpload' => false, | |
43 | + 'previewFileType' => 'image', | |
44 | + ], | |
45 | + ]); ?> | |
72 | 46 | |
73 | 47 | <?= LanguageForm::widget([ |
74 | 48 | 'model_langs' => $model_langs, | ... | ... |
backend/views/service/_form_language.php
... | ... | @@ -15,6 +15,8 @@ |
15 | 15 | ?> |
16 | 16 | <?= $form->field($model_lang, '[' . $language->language_id . ']name') |
17 | 17 | ->textInput([ 'maxlength' => true ]); ?> |
18 | +<?= $form->field($model_lang, '[' . $language->language_id . ']alias') | |
19 | + ->textInput([ 'maxlength' => true ]); ?> | |
18 | 20 | <?= $form->field($model_lang, '[' . $language->language_id . ']body') |
19 | 21 | ->widget(CKEditor::className(), [ |
20 | 22 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ... | ... |
backend/views/service/index.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\grid\GridView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $searchModel common\models\ServiceSearch */ | |
8 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | - | |
10 | -$this->title = Yii::t('app', 'Services'); | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\grid\GridView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $searchModel common\models\ServiceSearch */ | |
8 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | + $this->title = Yii::t('app', 'Services'); | |
11 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 12 | ?> |
13 | 13 | <div class="service-index"> |
14 | - | |
14 | + | |
15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
17 | - | |
17 | + | |
18 | 18 | <p> |
19 | - <?= Html::a(Yii::t('app', 'Create Service'), ['create'], ['class' => 'btn btn-success']) ?> | |
19 | + <?= Html::a(Yii::t('app', 'Create Service'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
20 | 20 | </p> |
21 | 21 | <?= GridView::widget([ |
22 | 22 | 'dataProvider' => $dataProvider, |
23 | - 'filterModel' => $searchModel, | |
24 | - 'columns' => [ | |
25 | - ['class' => 'yii\grid\SerialColumn'], | |
26 | - | |
23 | + 'filterModel' => $searchModel, | |
24 | + 'columns' => [ | |
25 | + [ 'class' => 'yii\grid\SerialColumn' ], | |
26 | + | |
27 | 27 | 'service_id', |
28 | - 'name', | |
29 | - 'alias', | |
30 | - [ | |
31 | - 'format' => 'image', | |
32 | - 'attribute'=>'image', | |
33 | - ], | |
34 | - // 'meta_title', | |
35 | - // 'description', | |
36 | - // 'h1', | |
37 | - // 'seo_text:ntext', | |
38 | - // 'created_at', | |
39 | - // 'updated_at', | |
40 | - | |
41 | - ['class' => 'yii\grid\ActionColumn'], | |
28 | + 'imageUrl:image', | |
29 | + 'created_at:date', | |
30 | + | |
31 | + [ 'class' => 'yii\grid\ActionColumn' ], | |
42 | 32 | ], |
43 | 33 | ]); ?> |
44 | 34 | </div> | ... | ... |
backend/views/service/update.php
... | ... | @@ -13,13 +13,13 @@ |
13 | 13 | |
14 | 14 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
15 | 15 | 'modelClass' => 'Service', |
16 | - ]) . $model->name; | |
16 | + ]) . $model->service_id; | |
17 | 17 | $this->params[ 'breadcrumbs' ][] = [ |
18 | 18 | 'label' => Yii::t('app', 'Services'), |
19 | 19 | 'url' => [ 'index' ], |
20 | 20 | ]; |
21 | 21 | $this->params[ 'breadcrumbs' ][] = [ |
22 | - 'label' => $model->name, | |
22 | + 'label' => $model->service_id, | |
23 | 23 | 'url' => [ |
24 | 24 | 'view', |
25 | 25 | 'id' => $model->service_id, | ... | ... |
backend/views/service/view.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\Service */ | |
8 | - | |
9 | -$this->title = $model->name; | |
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
2 | + | |
3 | + use yii\helpers\Html; | |
4 | + use yii\widgets\DetailView; | |
5 | + | |
6 | + /* @var $this yii\web\View */ | |
7 | + /* @var $model common\models\Service */ | |
8 | + | |
9 | + $this->title = $model->service_id; | |
10 | + $this->params[ 'breadcrumbs' ][] = [ | |
11 | + 'label' => Yii::t('app', 'Services'), | |
12 | + 'url' => [ 'index' ], | |
13 | + ]; | |
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
12 | 15 | ?> |
13 | 16 | <div class="service-view"> |
14 | - | |
17 | + | |
15 | 18 | <h1><?= Html::encode($this->title) ?></h1> |
16 | - | |
19 | + | |
17 | 20 | <p> |
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->service_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->service_id], [ | |
21 | + <?= Html::a(Yii::t('app', 'Update'), [ | |
22 | + 'update', | |
23 | + 'id' => $model->service_id, | |
24 | + ], [ 'class' => 'btn btn-primary' ]) ?> | |
25 | + <?= Html::a(Yii::t('app', 'Delete'), [ | |
26 | + 'delete', | |
27 | + 'id' => $model->service_id, | |
28 | + ], [ | |
20 | 29 | 'class' => 'btn btn-danger', |
21 | - 'data' => [ | |
30 | + 'data' => [ | |
22 | 31 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
23 | - 'method' => 'post', | |
32 | + 'method' => 'post', | |
24 | 33 | ], |
25 | 34 | ]) ?> |
26 | 35 | </p> |
27 | - | |
36 | + | |
28 | 37 | <?= DetailView::widget([ |
29 | 38 | 'model' => $model, |
30 | 39 | 'attributes' => [ |
31 | 40 | 'service_id', |
32 | - 'name', | |
33 | - 'alias', | |
34 | - [ | |
35 | - 'format' => 'image', | |
36 | - 'attribute'=>'image', | |
37 | - ], | |
38 | - 'meta_title', | |
39 | - 'description', | |
40 | - 'h1', | |
41 | - 'seo_text:ntext', | |
42 | - 'created_at', | |
43 | - 'updated_at', | |
41 | + 'imageUrl:image', | |
42 | + 'created_at:date', | |
44 | 43 | ], |
45 | 44 | ]) ?> |
46 | 45 | ... | ... |
backend/views/slider-image/_form.php
... | ... | @@ -44,13 +44,6 @@ |
44 | 44 | ], |
45 | 45 | ]); ?> |
46 | 46 | |
47 | - | |
48 | - <?= $form->field($model, 'alt') | |
49 | - ->textInput([ 'maxlength' => true ]) ?> | |
50 | - | |
51 | - <?= $form->field($model, 'title') | |
52 | - ->textInput([ 'maxlength' => true ]) ?> | |
53 | - | |
54 | 47 | <?= $form->field($model, 'url') |
55 | 48 | ->textInput([ 'maxlength' => true ]) ?> |
56 | 49 | |
... | ... | @@ -59,8 +52,8 @@ |
59 | 52 | 'name' => 'status', |
60 | 53 | 'hideSearch' => true, |
61 | 54 | 'data' => [ |
62 | - 1 => 'Active', | |
63 | - 2 => 'Inactive', | |
55 | + 1 => \Yii::t('app', 'Active'), | |
56 | + 2 => \Yii::t('app', 'Inactive'), | |
64 | 57 | ], |
65 | 58 | 'options' => [ 'placeholder' => 'Select status...' ], |
66 | 59 | 'pluginOptions' => [ | ... | ... |
backend/views/slider-image/index.php
... | ... | @@ -27,13 +27,9 @@ $this->params['breadcrumbs'][] = $this->title; |
27 | 27 | |
28 | 28 | 'slider_image_id', |
29 | 29 | 'slider_id', |
30 | - 'image', | |
31 | - 'alt', | |
32 | - 'title', | |
33 | - // 'url:url', | |
34 | - // 'status', | |
35 | - // 'sort', | |
36 | - | |
30 | + 'imageUrl:image', | |
31 | + 'url', | |
32 | + 'status', | |
37 | 33 | [ |
38 | 34 | 'class' => 'yii\grid\ActionColumn', |
39 | 35 | 'buttons' => [ | ... | ... |
backend/views/slider-image/view.php
common/behaviors/SaveImgBehavior.php
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | |
41 | 41 | if(empty($image) && $event->name == ActiveRecord::EVENT_BEFORE_UPDATE) { |
42 | 42 | $this->owner->$field_name = $this->owner->getOldAttribute($field_name); |
43 | - } else { | |
43 | + } elseif(!empty($image)) { | |
44 | 44 | $imgDir = \Yii::getAlias('@storage/'.$field['directory'].'/'); |
45 | 45 | |
46 | 46 | if(!is_dir($imgDir)) { | ... | ... |
common/behaviors/Slug.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\behaviors; | |
4 | - | |
5 | -use yii; | |
6 | -use yii\base\Behavior; | |
7 | -use yii\db\ActiveRecord; | |
8 | -use dosamigos\transliterator\TransliteratorHelper; | |
9 | -class Slug extends Behavior | |
10 | -{ | |
11 | - public $in_attribute = 'name'; | |
12 | - public $out_attribute = 'slug'; | |
13 | - public $translit = true; | |
14 | - | |
15 | - public function events() | |
2 | + | |
3 | + namespace common\behaviors; | |
4 | + | |
5 | + use yii; | |
6 | + use yii\base\Behavior; | |
7 | + use yii\db\ActiveRecord; | |
8 | + use dosamigos\transliterator\TransliteratorHelper; | |
9 | + | |
10 | + class Slug extends Behavior | |
16 | 11 | { |
17 | - return [ | |
18 | - ActiveRecord::EVENT_BEFORE_INSERT=> 'getSlug', | |
19 | - ActiveRecord::EVENT_BEFORE_UPDATE=> 'getSlug' | |
20 | - ]; | |
21 | - } | |
22 | - | |
23 | - public function getSlug( $event ) | |
24 | - { | |
25 | - if(!empty($this->owner->{$this->in_attribute})){ | |
26 | - if ( empty( $this->owner->{$this->out_attribute} ) ) { | |
27 | - $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} ); | |
12 | + | |
13 | + public $in_attribute = 'name'; | |
14 | + | |
15 | + public $out_attribute = 'slug'; | |
16 | + | |
17 | + public $translit = true; | |
18 | + | |
19 | + public function events() | |
20 | + { | |
21 | + return [ | |
22 | + ActiveRecord::EVENT_BEFORE_INSERT => 'getSlug', | |
23 | + ActiveRecord::EVENT_BEFORE_UPDATE => 'getSlug', | |
24 | + ]; | |
25 | + } | |
26 | + | |
27 | + public function getSlug($event) | |
28 | + { | |
29 | + if(!empty( $this->owner->{$this->in_attribute} )) { | |
30 | + if(empty( $this->owner->{$this->out_attribute} )) { | |
31 | + $this->owner->{$this->out_attribute} = $this->generateSlug($this->owner->{$this->in_attribute}); | |
32 | + } else { | |
33 | + $this->owner->{$this->out_attribute} = $this->generateSlug($this->owner->{$this->out_attribute}); | |
34 | + } | |
35 | + } | |
36 | + | |
37 | + } | |
38 | + | |
39 | + private function generateSlug($slug) | |
40 | + { | |
41 | + $slug = $this->slugify($slug); | |
42 | + if($this->checkUniqueSlug($slug)) { | |
43 | + return $slug; | |
28 | 44 | } else { |
29 | - $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} ); | |
45 | + for($suffix = 2; !$this->checkUniqueSlug($new_slug = $slug . '-' . $suffix); $suffix++) { | |
46 | + } | |
47 | + return $new_slug; | |
30 | 48 | } |
31 | 49 | } |
32 | - | |
33 | - } | |
34 | - | |
35 | - private function generateSlug( $slug ) | |
36 | - { | |
37 | - $slug = $this->slugify( $slug ); | |
38 | - if ( $this->checkUniqueSlug( $slug ) ) { | |
39 | - return $slug; | |
40 | - } else { | |
41 | - for ( $suffix = 2; !$this->checkUniqueSlug( $new_slug = $slug . '-' . $suffix ); $suffix++ ) {} | |
42 | - return $new_slug; | |
50 | + | |
51 | + private function slugify($slug) | |
52 | + { | |
53 | + if($this->translit) { | |
54 | + return yii\helpers\Inflector::slug(TransliteratorHelper::process($slug), '-', true); | |
55 | + } else { | |
56 | + return $this->slug($slug, '-', true); | |
57 | + } | |
43 | 58 | } |
44 | - } | |
45 | - | |
46 | - private function slugify( $slug ) | |
47 | - { | |
48 | - if ( $this->translit ) { | |
49 | - return yii\helpers\Inflector::slug( TransliteratorHelper::process( $slug ), '-', true ); | |
50 | - } else { | |
51 | - return $this->slug( $slug, '-', true ); | |
59 | + | |
60 | + private function slug($string, $replacement = '-', $lowercase = true) | |
61 | + { | |
62 | + $string = preg_replace('/[^\p{L}\p{Nd}]+/u', $replacement, $string); | |
63 | + $string = trim($string, $replacement); | |
64 | + return $lowercase ? strtolower($string) : $string; | |
52 | 65 | } |
53 | - } | |
54 | - | |
55 | - private function slug( $string, $replacement = '-', $lowercase = true ) | |
56 | - { | |
57 | - $string = preg_replace( '/[^\p{L}\p{Nd}]+/u', $replacement, $string ); | |
58 | - $string = trim( $string, $replacement ); | |
59 | - return $lowercase ? strtolower( $string ) : $string; | |
60 | - } | |
61 | - | |
62 | - private function checkUniqueSlug( $slug ) | |
63 | - { | |
64 | - $pk = $this->owner->primaryKey(); | |
65 | - $pk = $pk[0]; | |
66 | - | |
67 | - $condition = $this->out_attribute . ' = :out_attribute'; | |
68 | - $params = [ ':out_attribute' => $slug ]; | |
69 | - if ( !$this->owner->isNewRecord ) { | |
70 | - $condition .= ' and ' . $pk . ' != :pk'; | |
71 | - $params[':pk'] = $this->owner->{$pk}; | |
66 | + | |
67 | + private function checkUniqueSlug($slug) | |
68 | + { | |
69 | + $pk = $this->owner->primaryKey(); | |
70 | + $pk = $pk[ 0 ]; | |
71 | + | |
72 | + $condition = $this->out_attribute . ' = :out_attribute'; | |
73 | + $params = [ ':out_attribute' => $slug ]; | |
74 | + if(!$this->owner->isNewRecord) { | |
75 | + $condition .= ' and ' . $pk . ' != :pk'; | |
76 | + $params[ ':pk' ] = $this->owner->{$pk}; | |
77 | + } | |
78 | + return !$this->owner->find() | |
79 | + ->where($condition, $params) | |
80 | + ->one(); | |
72 | 81 | } |
73 | - | |
74 | - return !$this->owner->find() | |
75 | - ->where( $condition, $params ) | |
76 | - ->one(); | |
77 | - } | |
78 | - | |
79 | -} | |
80 | 82 | \ No newline at end of file |
83 | + | |
84 | + } | |
81 | 85 | \ No newline at end of file | ... | ... |
common/models/Articles.php
... | ... | @@ -14,16 +14,7 @@ |
14 | 14 | * This is the model class for table "articles". |
15 | 15 | * @property integer $id |
16 | 16 | * @property integer $date |
17 | - * @property string $title | |
18 | - * @property string $body | |
19 | 17 | * @property string $image |
20 | - * @property string $translit | |
21 | - * @property string $meta_title | |
22 | - * @property string $meta_keywords | |
23 | - * @property string $meta_description | |
24 | - * @property string $seo_text | |
25 | - * @property string $h1 | |
26 | - * @property string $body_preview | |
27 | 18 | * * From language behavior * |
28 | 19 | * @property ArticlesLang $lang |
29 | 20 | * @property ArticlesLang[] $langs |
... | ... | @@ -60,14 +51,14 @@ |
60 | 51 | public function behaviors() |
61 | 52 | { |
62 | 53 | return [ |
63 | - 'slug' => [ | |
64 | - 'class' => 'common\behaviors\Slug', | |
65 | - 'in_attribute' => 'title', | |
66 | - 'out_attribute' => 'translit', | |
67 | - 'translit' => true, | |
68 | - ], | |
69 | 54 | [ |
70 | 55 | 'class' => SaveImgBehavior::className(), |
56 | + 'fields' => [ | |
57 | + [ | |
58 | + 'name' => 'image', | |
59 | + 'directory' => 'articles', | |
60 | + ] | |
61 | + ], | |
71 | 62 | ], |
72 | 63 | 'language' => [ |
73 | 64 | 'class' => LanguageBehavior::className(), |
... | ... | @@ -94,28 +85,7 @@ |
94 | 85 | ], |
95 | 86 | [ |
96 | 87 | [ |
97 | - 'title', | |
98 | - 'body', | |
99 | - ], | |
100 | - 'required', | |
101 | - ], | |
102 | - [ | |
103 | - [ | |
104 | - 'body', | |
105 | - 'body_preview', | |
106 | - 'seo_text', | |
107 | - ], | |
108 | - 'string', | |
109 | - ], | |
110 | - [ | |
111 | - [ | |
112 | - 'title', | |
113 | 88 | 'image', |
114 | - 'translit', | |
115 | - 'meta_title', | |
116 | - 'meta_keywords', | |
117 | - 'meta_description', | |
118 | - 'h1', | |
119 | 89 | ], |
120 | 90 | 'string', |
121 | 91 | 'max' => 255, |
... | ... | @@ -145,19 +115,10 @@ |
145 | 115 | public function attributeLabels() |
146 | 116 | { |
147 | 117 | return [ |
148 | - 'id' => 'ID', | |
149 | - 'date' => 'Date', | |
150 | - 'title' => 'Title', | |
151 | - 'body' => 'Body', | |
152 | - 'body_preview' => 'Body preview', | |
153 | - 'image' => 'Image', | |
118 | + 'id' => Yii::t('app', 'ID'), | |
119 | + 'date' => Yii::t('app', 'Date'), | |
120 | + 'image' => Yii::t('app', 'Image'), | |
154 | 121 | 'imageUrl' => Yii::t('app', 'Image'), |
155 | - 'translit' => 'Translit', | |
156 | - 'meta_title' => 'Meta Title', | |
157 | - 'meta_keywords' => 'Meta Keywords', | |
158 | - 'meta_description' => 'Meta Description', | |
159 | - 'seo_text' => 'Seo Text', | |
160 | - 'h1' => 'H1', | |
161 | 122 | ]; |
162 | 123 | } |
163 | 124 | ... | ... |
common/models/ArticlesLang.php
... | ... | @@ -18,6 +18,7 @@ use Yii; |
18 | 18 | * @property string $seo_text |
19 | 19 | * @property string $h1 |
20 | 20 | * @property string $body_preview |
21 | + * @property string $alias | |
21 | 22 | * |
22 | 23 | * @property Articles $articles |
23 | 24 | * @property Language $language |
... | ... | @@ -40,6 +41,18 @@ class ArticlesLang extends \yii\db\ActiveRecord |
40 | 41 | return 'articles_lang'; |
41 | 42 | } |
42 | 43 | |
44 | + public function behaviors() | |
45 | + { | |
46 | + return [ | |
47 | + 'slug' => [ | |
48 | + 'class' => 'common\behaviors\Slug', | |
49 | + 'in_attribute' => 'title', | |
50 | + 'out_attribute' => 'alias', | |
51 | + 'translit' => true, | |
52 | + ], | |
53 | + ]; | |
54 | + } | |
55 | + | |
43 | 56 | /** |
44 | 57 | * @inheritdoc |
45 | 58 | */ |
... | ... | @@ -47,7 +60,7 @@ class ArticlesLang extends \yii\db\ActiveRecord |
47 | 60 | { |
48 | 61 | return [ |
49 | 62 | [['title', 'body'], 'required'], |
50 | - [['body', 'seo_text', 'body_preview'], 'string'], | |
63 | + [['body', 'seo_text', 'body_preview', 'alias'], 'string'], | |
51 | 64 | [['title', 'meta_title', 'meta_keywords', 'meta_description', 'h1'], 'string', 'max' => 255], |
52 | 65 | [['articles_id', 'language_id'], 'unique', 'targetAttribute' => ['articles_id', 'language_id'], 'message' => 'The combination of Articles ID and Language ID has already been taken.'], |
53 | 66 | [['articles_id'], 'exist', 'skipOnError' => true, 'targetClass' => Articles::className(), 'targetAttribute' => ['articles_id' => 'id']], | ... | ... |
common/models/ArticlesSearch.php
... | ... | @@ -2,10 +2,8 @@ |
2 | 2 | |
3 | 3 | namespace common\models; |
4 | 4 | |
5 | -use Yii; | |
6 | 5 | use yii\base\Model; |
7 | 6 | use yii\data\ActiveDataProvider; |
8 | -use common\models\Articles; | |
9 | 7 | |
10 | 8 | /** |
11 | 9 | * ArticlesSearch represents the model behind the search form about `common\models\Articles`. |
... | ... | @@ -19,7 +17,6 @@ class ArticlesSearch extends Articles |
19 | 17 | { |
20 | 18 | return [ |
21 | 19 | [['id'], 'integer'], |
22 | - [['title', 'body', 'translit', 'meta_title', 'meta_keywords', 'meta_description', 'seo_text', 'h1'], 'safe'], | |
23 | 20 | ]; |
24 | 21 | } |
25 | 22 | |
... | ... | @@ -67,15 +64,6 @@ class ArticlesSearch extends Articles |
67 | 64 | 'id' => $this->id, |
68 | 65 | ]); |
69 | 66 | |
70 | - $query->andFilterWhere(['like', 'title', $this->title]) | |
71 | - ->andFilterWhere(['like', 'body', $this->body]) | |
72 | - ->andFilterWhere(['like', 'translit', $this->translit]) | |
73 | - ->andFilterWhere(['like', 'meta_title', $this->meta_title]) | |
74 | - ->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords]) | |
75 | - ->andFilterWhere(['like', 'meta_description', $this->meta_description]) | |
76 | - ->andFilterWhere(['like', 'seo_text', $this->seo_text]) | |
77 | - ->andFilterWhere(['like', 'h1', $this->h1]); | |
78 | - | |
79 | 67 | return $dataProvider; |
80 | 68 | } |
81 | 69 | } | ... | ... |
common/models/Banner.php
... | ... | @@ -12,9 +12,6 @@ use yii\web\Request; |
12 | 12 | * This is the model class for table "banner". |
13 | 13 | * |
14 | 14 | * @property integer $banner_id |
15 | - * @property string $image | |
16 | - * @property string $alt | |
17 | - * @property string $title | |
18 | 15 | * @property string $url |
19 | 16 | * @property integer $status |
20 | 17 | * * From language behavior * |
... | ... | @@ -61,10 +58,7 @@ class Banner extends \yii\db\ActiveRecord |
61 | 58 | { |
62 | 59 | return [ |
63 | 60 | [['status'], 'integer'], |
64 | - [['image', 'alt', 'title', 'url'], 'string', 'max' => 255], | |
65 | - ['title', 'unique', 'targetClass' => '\common\models\Slider', 'message' => Yii::t('app','message',[ | |
66 | - 'field' => 'Title' | |
67 | - ])], | |
61 | + [['url'], 'string', 'max' => 255], | |
68 | 62 | ]; |
69 | 63 | } |
70 | 64 | |
... | ... | @@ -74,10 +68,7 @@ class Banner extends \yii\db\ActiveRecord |
74 | 68 | public function attributeLabels() |
75 | 69 | { |
76 | 70 | return [ |
77 | - 'banner_id' => Yii::t('app', 'status'), | |
78 | - 'image' => Yii::t('app', 'image'), | |
79 | - 'alt' => Yii::t('app', 'alt'), | |
80 | - 'title' => Yii::t('app', 'title'), | |
71 | + 'banner_id' => Yii::t('app', 'banner_id'), | |
81 | 72 | 'url' => Yii::t('app', 'url'), |
82 | 73 | 'status' => Yii::t('app', 'status'), |
83 | 74 | ]; | ... | ... |
common/models/BannerSearch.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\base\Model; | |
7 | -use yii\data\ActiveDataProvider; | |
8 | -use common\models\Banner; | |
9 | - | |
10 | -/** | |
11 | - * BannerSearch represents the model behind the search form about `common\models\Banner`. | |
12 | - */ | |
13 | -class BannerSearch extends Banner | |
14 | -{ | |
15 | - /** | |
16 | - * @inheritdoc | |
17 | - */ | |
18 | - public function rules() | |
19 | - { | |
20 | - return [ | |
21 | - [['banner_id', 'status'], 'integer'], | |
22 | - [['image', 'alt', 'title', 'url'], 'safe'], | |
23 | - ]; | |
24 | - } | |
25 | - | |
26 | - public function behaviors() | |
27 | - { | |
28 | - return []; | |
29 | - } | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use yii\base\Model; | |
6 | + use yii\data\ActiveDataProvider; | |
30 | 7 | |
31 | 8 | /** |
32 | - * @inheritdoc | |
33 | - */ | |
34 | - public function scenarios() | |
35 | - { | |
36 | - // bypass scenarios() implementation in the parent class | |
37 | - return Model::scenarios(); | |
38 | - } | |
39 | - | |
40 | - /** | |
41 | - * Creates data provider instance with search query applied | |
42 | - * | |
43 | - * @param array $params | |
44 | - * | |
45 | - * @return ActiveDataProvider | |
9 | + * BannerSearch represents the model behind the search form about `common\models\Banner`. | |
46 | 10 | */ |
47 | - public function search($params) | |
11 | + class BannerSearch extends Banner | |
48 | 12 | { |
49 | - $query = Banner::find(); | |
50 | - | |
51 | - // add conditions that should always apply here | |
52 | - | |
53 | - $dataProvider = new ActiveDataProvider([ | |
54 | - 'query' => $query, | |
55 | - ]); | |
56 | - | |
57 | - $this->load($params); | |
58 | - | |
59 | - if (!$this->validate()) { | |
60 | - // uncomment the following line if you do not want to return any records when validation fails | |
61 | - // $query->where('0=1'); | |
13 | + | |
14 | + /** | |
15 | + * @inheritdoc | |
16 | + */ | |
17 | + public function rules() | |
18 | + { | |
19 | + return [ | |
20 | + [ | |
21 | + [ | |
22 | + 'banner_id', | |
23 | + 'status', | |
24 | + ], | |
25 | + 'integer', | |
26 | + ], | |
27 | + [ | |
28 | + [ 'url' ], | |
29 | + 'safe', | |
30 | + ], | |
31 | + ]; | |
32 | + } | |
33 | + | |
34 | + public function behaviors() | |
35 | + { | |
36 | + return []; | |
37 | + } | |
38 | + | |
39 | + /** | |
40 | + * @inheritdoc | |
41 | + */ | |
42 | + public function scenarios() | |
43 | + { | |
44 | + // bypass scenarios() implementation in the parent class | |
45 | + return Model::scenarios(); | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * Creates data provider instance with search query applied | |
50 | + * | |
51 | + * @param array $params | |
52 | + * | |
53 | + * @return ActiveDataProvider | |
54 | + */ | |
55 | + public function search($params) | |
56 | + { | |
57 | + $query = Banner::find(); | |
58 | + | |
59 | + // add conditions that should always apply here | |
60 | + | |
61 | + $dataProvider = new ActiveDataProvider([ | |
62 | + 'query' => $query, | |
63 | + ]); | |
64 | + | |
65 | + $this->load($params); | |
66 | + | |
67 | + if(!$this->validate()) { | |
68 | + // uncomment the following line if you do not want to return any records when validation fails | |
69 | + // $query->where('0=1'); | |
70 | + return $dataProvider; | |
71 | + } | |
72 | + | |
73 | + // grid filtering conditions | |
74 | + $query->andFilterWhere([ | |
75 | + 'banner_id' => $this->banner_id, | |
76 | + 'status' => $this->status, | |
77 | + ]); | |
78 | + | |
79 | + $query->andFilterWhere([ | |
80 | + 'like', | |
81 | + 'url', | |
82 | + $this->url, | |
83 | + ]); | |
84 | + | |
62 | 85 | return $dataProvider; |
63 | 86 | } |
64 | - | |
65 | - // grid filtering conditions | |
66 | - $query->andFilterWhere([ | |
67 | - 'banner_id' => $this->banner_id, | |
68 | - 'status' => $this->status, | |
69 | - ]); | |
70 | - | |
71 | - $query->andFilterWhere(['like', 'image', $this->image]) | |
72 | - ->andFilterWhere(['like', 'alt', $this->alt]) | |
73 | - ->andFilterWhere(['like', 'title', $this->title]) | |
74 | - ->andFilterWhere(['like', 'url', $this->url]); | |
75 | - | |
76 | - return $dataProvider; | |
77 | 87 | } |
78 | -} | ... | ... |
common/models/Bg.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use common\modules\language\behaviors\LanguageBehavior; | |
6 | -use yii\db\ActiveQuery; | |
7 | -use yii\db\ActiveRecord; | |
8 | -use yii\web\Request; | |
9 | - | |
10 | -/** | |
11 | - * Class Bg | |
12 | - * * From language behavior * | |
13 | - * @property BgLang $lang | |
14 | - * @property BgLang[] $langs | |
15 | - * @property BgLang $object_lang | |
16 | - * @property string $ownerKey | |
17 | - * @property string $langKey | |
18 | - * @method string getOwnerKey() | |
19 | - * @method void setOwnerKey(string $value) | |
20 | - * @method string getLangKey() | |
21 | - * @method void setLangKey(string $value) | |
22 | - * @method ActiveQuery getLangs() | |
23 | - * @method ActiveQuery getLang( integer $language_id ) | |
24 | - * @method BgLang[] generateLangs() | |
25 | - * @method void loadLangs(Request $request, ActiveRecord[] $model_langs) | |
26 | - * @method bool linkLangs(ActiveRecord[] $model_langs) | |
27 | - * @method bool saveLangs(ActiveRecord[] $model_langs) | |
28 | - * * End language behavior * | |
29 | - */ | |
30 | -class Bg extends \yii\db\ActiveRecord | |
31 | -{ | |
32 | - public $old_image; | |
33 | - | |
34 | - public static function tableName() | |
35 | - { | |
36 | - return 'bg'; | |
37 | - } | |
38 | 2 | |
39 | - public function behaviors() | |
40 | - { | |
41 | - return [ | |
42 | - 'language' => [ | |
43 | - 'class' => LanguageBehavior::className(), | |
44 | - ], | |
45 | - ]; | |
46 | - } | |
3 | + namespace common\models; | |
47 | 4 | |
48 | - public function rules() | |
49 | - { | |
50 | - return [ | |
51 | - [['title'], 'required'], | |
52 | - [['old_image','url'], 'safe'], | |
53 | - [['image'], 'file', 'extensions'=>'jpg, gif, png', 'skipOnEmpty'=>true], | |
54 | - | |
55 | - ]; | |
56 | - } | |
57 | - | |
58 | - public function attributeLabels() | |
59 | - { | |
60 | - return [ | |
61 | - 'title'=>'ะะฐะทะฒะฐะฝะธะต', | |
62 | - 'body'=>'ะะฟะธัะฐะฝะธะต', | |
63 | - 'date'=>'ะะฐัะฐ', | |
64 | - 'image'=>'ะะทะพะฑัะฐะถะตะฝะธั', | |
65 | - ]; | |
66 | - } | |
5 | + use common\behaviors\SaveImgBehavior; | |
6 | + use common\modules\language\behaviors\LanguageBehavior; | |
7 | + use yii\db\ActiveQuery; | |
8 | + use yii\db\ActiveRecord; | |
9 | + use yii\web\Request; | |
10 | + | |
11 | + /** | |
12 | + * Class Bg | |
13 | + * * From language behavior * | |
14 | + * @property BgLang $lang | |
15 | + * @property BgLang[] $langs | |
16 | + * @property BgLang $object_lang | |
17 | + * @property string $ownerKey | |
18 | + * @property string $langKey | |
19 | + * @method string getOwnerKey() | |
20 | + * @method void setOwnerKey( string $value ) | |
21 | + * @method string getLangKey() | |
22 | + * @method void setLangKey( string $value ) | |
23 | + * @method ActiveQuery getLangs() | |
24 | + * @method ActiveQuery getLang( integer $language_id ) | |
25 | + * @method BgLang[] generateLangs() | |
26 | + * @method void loadLangs( Request $request, ActiveRecord[] $model_langs ) | |
27 | + * @method bool linkLangs( ActiveRecord[] $model_langs ) | |
28 | + * @method bool saveLangs( ActiveRecord[] $model_langs ) | |
29 | + * * End language behavior * | |
30 | + */ | |
31 | + class Bg extends \yii\db\ActiveRecord | |
32 | + { | |
67 | 33 | |
68 | - | |
34 | + public static function tableName() | |
35 | + { | |
36 | + return 'bg'; | |
37 | + } | |
69 | 38 | |
70 | - public function beforeDelete() { | |
71 | - $this->deleteImage($this->image); | |
72 | - return parent::beforeDelete(); | |
73 | - } | |
74 | - | |
75 | - public function deleteImage($file){ | |
76 | - if(!empty($file)){ | |
77 | - @unlink('upload/bg/'.$file); | |
78 | - } | |
79 | - } | |
80 | - | |
81 | - | |
82 | -} | |
39 | + public function behaviors() | |
40 | + { | |
41 | + return [ | |
42 | + [ | |
43 | + 'class' => SaveImgBehavior::className(), | |
44 | + 'fields' => [ | |
45 | + [ | |
46 | + 'name' => 'image', | |
47 | + 'directory' => 'bg', | |
48 | + ], | |
49 | + ], | |
50 | + ], | |
51 | + 'language' => [ | |
52 | + 'class' => LanguageBehavior::className(), | |
53 | + ], | |
54 | + ]; | |
55 | + } | |
56 | + | |
57 | + public function rules() | |
58 | + { | |
59 | + return [ | |
60 | + [ | |
61 | + [ 'url' ], | |
62 | + 'string', | |
63 | + ], | |
64 | + ]; | |
65 | + } | |
66 | + | |
67 | + public function attributeLabels() | |
68 | + { | |
69 | + return [ | |
70 | + 'image' => \Yii::t('app', 'Image'), | |
71 | + 'url' => \Yii::t('app', 'Url'), | |
72 | + ]; | |
73 | + } | |
74 | + } | |
83 | 75 | ... | ... |
common/models/BgSearch.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\base\Model; | |
7 | -use yii\data\ActiveDataProvider; | |
8 | -use common\models\Bg; | |
9 | - | |
10 | -/** | |
11 | - * BgSearch represents the model behind the search form about `common\models\Bg`. | |
12 | - */ | |
13 | -class BgSearch extends Bg | |
14 | -{ | |
15 | - /** | |
16 | - * @inheritdoc | |
17 | - */ | |
18 | - public function rules() | |
19 | - { | |
20 | - return [ | |
21 | - [['id'], 'integer'], | |
22 | - [['title', 'url', 'image'], 'safe'], | |
23 | - ]; | |
24 | - } | |
25 | 2 | |
26 | - public function behaviors() | |
27 | - { | |
28 | - return []; | |
29 | - } | |
3 | + namespace common\models; | |
4 | + | |
5 | + use yii\base\Model; | |
6 | + use yii\data\ActiveDataProvider; | |
30 | 7 | |
31 | 8 | /** |
32 | - * @inheritdoc | |
33 | - */ | |
34 | - public function scenarios() | |
35 | - { | |
36 | - // bypass scenarios() implementation in the parent class | |
37 | - return Model::scenarios(); | |
38 | - } | |
39 | - | |
40 | - /** | |
41 | - * Creates data provider instance with search query applied | |
42 | - * | |
43 | - * @param array $params | |
44 | - * | |
45 | - * @return ActiveDataProvider | |
9 | + * BgSearch represents the model behind the search form about `common\models\Bg`. | |
46 | 10 | */ |
47 | - public function search($params) | |
11 | + class BgSearch extends Bg | |
48 | 12 | { |
49 | - $query = Bg::find(); | |
50 | - | |
51 | - // add conditions that should always apply here | |
52 | - | |
53 | - $dataProvider = new ActiveDataProvider([ | |
54 | - 'query' => $query, | |
55 | - ]); | |
56 | - | |
57 | - $this->load($params); | |
58 | - | |
59 | - if (!$this->validate()) { | |
60 | - // uncomment the following line if you do not want to return any records when validation fails | |
61 | - // $query->where('0=1'); | |
13 | + | |
14 | + /** | |
15 | + * @inheritdoc | |
16 | + */ | |
17 | + public function rules() | |
18 | + { | |
19 | + return [ | |
20 | + [ | |
21 | + [ 'id' ], | |
22 | + 'integer', | |
23 | + ], | |
24 | + [ | |
25 | + [ 'url' ], | |
26 | + 'safe', | |
27 | + ], | |
28 | + ]; | |
29 | + } | |
30 | + | |
31 | + public function behaviors() | |
32 | + { | |
33 | + return []; | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * @inheritdoc | |
38 | + */ | |
39 | + public function scenarios() | |
40 | + { | |
41 | + // bypass scenarios() implementation in the parent class | |
42 | + return Model::scenarios(); | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * Creates data provider instance with search query applied | |
47 | + * | |
48 | + * @param array $params | |
49 | + * | |
50 | + * @return ActiveDataProvider | |
51 | + */ | |
52 | + public function search($params) | |
53 | + { | |
54 | + $query = Bg::find(); | |
55 | + | |
56 | + // add conditions that should always apply here | |
57 | + | |
58 | + $dataProvider = new ActiveDataProvider([ | |
59 | + 'query' => $query, | |
60 | + ]); | |
61 | + | |
62 | + $this->load($params); | |
63 | + | |
64 | + if(!$this->validate()) { | |
65 | + // uncomment the following line if you do not want to return any records when validation fails | |
66 | + // $query->where('0=1'); | |
67 | + return $dataProvider; | |
68 | + } | |
69 | + | |
70 | + // grid filtering conditions | |
71 | + $query->andFilterWhere([ | |
72 | + 'id' => $this->id, | |
73 | + ]); | |
74 | + | |
75 | + $query->andFilterWhere([ | |
76 | + 'like', | |
77 | + 'url', | |
78 | + $this->url, | |
79 | + ]); | |
80 | + | |
62 | 81 | return $dataProvider; |
63 | 82 | } |
64 | - | |
65 | - // grid filtering conditions | |
66 | - $query->andFilterWhere([ | |
67 | - 'id' => $this->id, | |
68 | - ]); | |
69 | - | |
70 | - $query->andFilterWhere(['like', 'title', $this->title]) | |
71 | - ->andFilterWhere(['like', 'url', $this->url]) | |
72 | - ->andFilterWhere(['like', 'image', $this->image]); | |
73 | - | |
74 | - return $dataProvider; | |
75 | 83 | } |
76 | -} | ... | ... |
common/models/Delivery.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use common\modules\language\behaviors\LanguageBehavior; | |
6 | -use yii\db\ActiveQuery; | |
7 | -use yii\db\ActiveRecord; | |
8 | -use yii\web\Request; | |
9 | - | |
10 | -/** | |
11 | - * Class Delivery | |
12 | - * | |
13 | - * * From language behavior * | |
14 | - * @property OrdersDeliveryLang $lang | |
15 | - * @property OrdersDeliveryLang[] $langs | |
16 | - * @property OrdersDeliveryLang $object_lang | |
17 | - * @property string $ownerKey | |
18 | - * @property string $langKey | |
19 | - * @method string getOwnerKey() | |
20 | - * @method void setOwnerKey(string $value) | |
21 | - * @method string getLangKey() | |
22 | - * @method void setLangKey(string $value) | |
23 | - * @method ActiveQuery getLangs() | |
24 | - * @method ActiveQuery getLang( integer $language_id ) | |
25 | - * @method OrdersDeliveryLang[] generateLangs() | |
26 | - * @method void loadLangs(Request $request, ActiveRecord[] $model_langs) | |
27 | - * @method bool linkLangs(ActiveRecord[] $model_langs) | |
28 | - * @method bool saveLangs(ActiveRecord[] $model_langs) | |
29 | - * * End language behavior * | |
30 | - */ | |
31 | -class Delivery extends \yii\db\ActiveRecord | |
32 | -{ | |
33 | 2 | |
34 | - public function behaviors() | |
35 | - { | |
36 | - return [ | |
37 | - 'language' => [ | |
38 | - 'class' => LanguageBehavior::className(), | |
39 | - ], | |
40 | - ]; | |
41 | - } | |
3 | + namespace common\models; | |
42 | 4 | |
43 | - public static function tableName() | |
44 | - { | |
45 | - return 'orders_delivery'; | |
46 | - } | |
5 | + use common\modules\language\behaviors\LanguageBehavior; | |
6 | + use yii\db\ActiveQuery; | |
7 | + use yii\db\ActiveRecord; | |
8 | + use yii\web\Request; | |
47 | 9 | |
48 | -} | |
49 | 10 | \ No newline at end of file |
11 | + /** | |
12 | + * Class Delivery | |
13 | + * * From language behavior * | |
14 | + * @property OrdersDeliveryLang $lang | |
15 | + * @property OrdersDeliveryLang[] $langs | |
16 | + * @property OrdersDeliveryLang $object_lang | |
17 | + * @property string $ownerKey | |
18 | + * @property string $langKey | |
19 | + * @method string getOwnerKey() | |
20 | + * @method void setOwnerKey( string $value ) | |
21 | + * @method string getLangKey() | |
22 | + * @method void setLangKey( string $value ) | |
23 | + * @method ActiveQuery getLangs() | |
24 | + * @method ActiveQuery getLang( integer $language_id ) | |
25 | + * @method OrdersDeliveryLang[] generateLangs() | |
26 | + * @method void loadLangs( Request $request, ActiveRecord[] $model_langs ) | |
27 | + * @method bool linkLangs( ActiveRecord[] $model_langs ) | |
28 | + * @method bool saveLangs( ActiveRecord[] $model_langs ) | |
29 | + * * End language behavior * | |
30 | + */ | |
31 | + class Delivery extends \yii\db\ActiveRecord | |
32 | + { | |
33 | + | |
34 | + public function behaviors() | |
35 | + { | |
36 | + return [ | |
37 | + 'language' => [ | |
38 | + 'class' => LanguageBehavior::className(), | |
39 | + ], | |
40 | + ]; | |
41 | + } | |
42 | + | |
43 | + public static function tableName() | |
44 | + { | |
45 | + return 'orders_delivery'; | |
46 | + } | |
47 | + | |
48 | + } | |
50 | 49 | \ No newline at end of file | ... | ... |
common/models/Event.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | namespace common\models; |
4 | 4 | |
5 | +use common\behaviors\SaveImgBehavior; | |
5 | 6 | use common\modules\language\behaviors\LanguageBehavior; |
6 | 7 | use Yii; |
7 | 8 | use yii\behaviors\TimestampBehavior; |
... | ... | @@ -13,14 +14,7 @@ use yii\web\Request; |
13 | 14 | * This is the model class for table "event". |
14 | 15 | * |
15 | 16 | * @property integer $event_id |
16 | - * @property string $name | |
17 | - * @property string $alias | |
18 | - * @property string $body | |
19 | 17 | * @property string $image |
20 | - * @property string $meta_title | |
21 | - * @property string $description | |
22 | - * @property string $h1 | |
23 | - * @property string $seo_text | |
24 | 18 | * @property integer $created_at |
25 | 19 | * @property integer $updated_at |
26 | 20 | * @property integer $end_at |
... | ... | @@ -45,8 +39,6 @@ use yii\web\Request; |
45 | 39 | */ |
46 | 40 | class Event extends \yii\db\ActiveRecord |
47 | 41 | { |
48 | - public $imageUpload; | |
49 | - | |
50 | 42 | /** |
51 | 43 | * @inheritdoc |
52 | 44 | */ |
... | ... | @@ -62,18 +54,21 @@ class Event extends \yii\db\ActiveRecord |
62 | 54 | { |
63 | 55 | return [ |
64 | 56 | TimestampBehavior::className(), |
65 | - 'slug' => [ | |
66 | - 'class' => 'common\behaviors\Slug', | |
67 | - 'in_attribute' => 'name', | |
68 | - 'out_attribute' => 'alias', | |
69 | - 'translit' => true | |
70 | - ], | |
71 | 57 | [ |
72 | 58 | 'class' => 'common\behaviors\ShowImage', |
73 | 59 | ], |
74 | 60 | 'language' => [ |
75 | 61 | 'class' => LanguageBehavior::className(), |
76 | 62 | ], |
63 | + [ | |
64 | + 'class' => SaveImgBehavior::className(), | |
65 | + 'fields' => [ | |
66 | + [ | |
67 | + 'name' => 'image', | |
68 | + 'directory' => 'event', | |
69 | + ], | |
70 | + ], | |
71 | + ], | |
77 | 72 | ]; |
78 | 73 | } |
79 | 74 | |
... | ... | @@ -99,12 +94,8 @@ class Event extends \yii\db\ActiveRecord |
99 | 94 | public function rules() |
100 | 95 | { |
101 | 96 | return [ |
102 | - [['body', 'seo_text'], 'string'], | |
103 | 97 | [['created_at', 'updated_at' ], 'integer'], |
104 | - [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at'], 'string', 'max' => 255], | |
105 | - [['name','body'], 'required'], | |
106 | - [['imageUpload'], 'safe'], | |
107 | - [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], | |
98 | + [['end_at'], 'string', 'max' => 255], | |
108 | 99 | ]; |
109 | 100 | } |
110 | 101 | |
... | ... | @@ -115,27 +106,10 @@ class Event extends \yii\db\ActiveRecord |
115 | 106 | { |
116 | 107 | return [ |
117 | 108 | 'event_id' => Yii::t('app', 'event_id'), |
118 | - 'name' => Yii::t('app', 'name'), | |
119 | - 'alias' => Yii::t('app', 'alias'), | |
120 | - 'body' => Yii::t('app', 'body'), | |
121 | 109 | 'image' => Yii::t('app', 'image'), |
122 | - 'meta_title' => Yii::t('app', 'meta_title'), | |
123 | - 'description' => Yii::t('app', 'description'), | |
124 | - 'h1' => Yii::t('app', 'h1'), | |
125 | - 'seo_text' => Yii::t('app', 'seo_text'), | |
126 | 110 | 'created_at' => Yii::t('app', 'created_at'), |
127 | 111 | 'updated_at' => Yii::t('app', 'updated_at'), |
128 | 112 | 'end_at' => Yii::t('app', 'end_at'), |
129 | 113 | ]; |
130 | 114 | } |
131 | - | |
132 | - | |
133 | - public function getImageFile() { | |
134 | - return empty($this->image) ? null : Yii::getAlias('@imagesDir/articles/'. $this->image); | |
135 | - } | |
136 | - | |
137 | - public function getImageUrl() | |
138 | - { | |
139 | - return empty($this->image) ? null : Yii::getAlias('@imagesUrl/articles/' . $this->image); | |
140 | - } | |
141 | 115 | } | ... | ... |
common/models/EventLang.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use common\modules\language\models\Language; | |
6 | -use Yii; | |
7 | - | |
8 | -/** | |
9 | - * This is the model class for table "event_lang". | |
10 | - * | |
11 | - * @property integer $event_id | |
12 | - * @property integer $language_id | |
13 | - * @property string $name | |
14 | - * @property string $body | |
15 | - * @property string $meta_title | |
16 | - * @property string $description | |
17 | - * @property string $seo_text | |
18 | - * @property string $h1 | |
19 | - * | |
20 | - * @property Event $event | |
21 | - * @property Language $language | |
22 | - */ | |
23 | -class EventLang extends \yii\db\ActiveRecord | |
24 | -{ | |
25 | 2 | |
26 | - public static function primaryKey() | |
27 | - { | |
28 | - return [ | |
29 | - 'event_id', | |
30 | - 'language_id', | |
31 | - ]; | |
32 | - } | |
3 | + namespace common\models; | |
33 | 4 | |
34 | - /** | |
35 | - * @inheritdoc | |
36 | - */ | |
37 | - public static function tableName() | |
38 | - { | |
39 | - return 'event_lang'; | |
40 | - } | |
5 | + use common\modules\language\models\Language; | |
6 | + use Yii; | |
41 | 7 | |
42 | 8 | /** |
43 | - * @inheritdoc | |
44 | - */ | |
45 | - public function rules() | |
46 | - { | |
47 | - return [ | |
48 | - [['name', 'body'], 'required'], | |
49 | - [['body', 'seo_text'], 'string'], | |
50 | - [['name', 'meta_title', 'description', 'h1'], 'string', 'max' => 255], | |
51 | - [['event_id', 'language_id'], 'unique', 'targetAttribute' => ['event_id', 'language_id'], 'message' => 'The combination of Event ID and Language ID has already been taken.'], | |
52 | - [['event_id'], 'exist', 'skipOnError' => true, 'targetClass' => Event::className(), 'targetAttribute' => ['event_id' => 'event_id']], | |
53 | - [['language_id'], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), 'targetAttribute' => ['language_id' => 'language_id']], | |
54 | - ]; | |
55 | - } | |
56 | - | |
57 | - /** | |
58 | - * @inheritdoc | |
59 | - */ | |
60 | - public function attributeLabels() | |
61 | - { | |
62 | - return [ | |
63 | - 'event_id' => Yii::t('app', 'Event ID'), | |
64 | - 'language_id' => Yii::t('app', 'Language ID'), | |
65 | - 'name' => Yii::t('app', 'Name'), | |
66 | - 'body' => Yii::t('app', 'Body'), | |
67 | - 'meta_title' => Yii::t('app', 'Meta Title'), | |
68 | - 'description' => Yii::t('app', 'Description'), | |
69 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
70 | - 'h1' => Yii::t('app', 'H1'), | |
71 | - ]; | |
72 | - } | |
73 | - | |
74 | - /** | |
75 | - * @return \yii\db\ActiveQuery | |
76 | - */ | |
77 | - public function getEvent() | |
78 | - { | |
79 | - return $this->hasOne(Event::className(), ['event_id' => 'event_id']); | |
80 | - } | |
81 | - | |
82 | - /** | |
83 | - * @return \yii\db\ActiveQuery | |
9 | + * This is the model class for table "event_lang". | |
10 | + * @property integer $event_id | |
11 | + * @property integer $language_id | |
12 | + * @property string $name | |
13 | + * @property string $body | |
14 | + * @property string $meta_title | |
15 | + * @property string $description | |
16 | + * @property string $seo_text | |
17 | + * @property string $h1 | |
18 | + * @property string $alias | |
19 | + * @property Event $event | |
20 | + * @property Language $language | |
84 | 21 | */ |
85 | - public function getLanguage() | |
22 | + class EventLang extends \yii\db\ActiveRecord | |
86 | 23 | { |
87 | - return $this->hasOne(Language::className(), ['language_id' => 'language_id']); | |
24 | + | |
25 | + public static function primaryKey() | |
26 | + { | |
27 | + return [ | |
28 | + 'event_id', | |
29 | + 'language_id', | |
30 | + ]; | |
31 | + } | |
32 | + | |
33 | + /** | |
34 | + * @inheritdoc | |
35 | + */ | |
36 | + public static function tableName() | |
37 | + { | |
38 | + return 'event_lang'; | |
39 | + } | |
40 | + | |
41 | + public function behaviors() | |
42 | + { | |
43 | + return [ | |
44 | + 'slug' => [ | |
45 | + 'class' => 'common\behaviors\Slug', | |
46 | + 'in_attribute' => 'name', | |
47 | + 'out_attribute' => 'alias', | |
48 | + 'translit' => true, | |
49 | + ], | |
50 | + ]; | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * @inheritdoc | |
55 | + */ | |
56 | + public function rules() | |
57 | + { | |
58 | + return [ | |
59 | + [ | |
60 | + [ | |
61 | + 'name', | |
62 | + 'body', | |
63 | + ], | |
64 | + 'required', | |
65 | + ], | |
66 | + [ | |
67 | + [ | |
68 | + 'body', | |
69 | + 'seo_text', | |
70 | + ], | |
71 | + 'string', | |
72 | + ], | |
73 | + [ | |
74 | + [ | |
75 | + 'name', | |
76 | + 'meta_title', | |
77 | + 'description', | |
78 | + 'h1', | |
79 | + 'alias', | |
80 | + ], | |
81 | + 'string', | |
82 | + 'max' => 255, | |
83 | + ], | |
84 | + [ | |
85 | + [ | |
86 | + 'event_id', | |
87 | + 'language_id', | |
88 | + ], | |
89 | + 'unique', | |
90 | + 'targetAttribute' => [ | |
91 | + 'event_id', | |
92 | + 'language_id', | |
93 | + ], | |
94 | + 'message' => 'The combination of Event ID and Language ID has already been taken.', | |
95 | + ], | |
96 | + [ | |
97 | + [ 'event_id' ], | |
98 | + 'exist', | |
99 | + 'skipOnError' => true, | |
100 | + 'targetClass' => Event::className(), | |
101 | + 'targetAttribute' => [ 'event_id' => 'event_id' ], | |
102 | + ], | |
103 | + [ | |
104 | + [ 'language_id' ], | |
105 | + 'exist', | |
106 | + 'skipOnError' => true, | |
107 | + 'targetClass' => Language::className(), | |
108 | + 'targetAttribute' => [ 'language_id' => 'language_id' ], | |
109 | + ], | |
110 | + ]; | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * @inheritdoc | |
115 | + */ | |
116 | + public function attributeLabels() | |
117 | + { | |
118 | + return [ | |
119 | + 'event_id' => Yii::t('app', 'Event ID'), | |
120 | + 'language_id' => Yii::t('app', 'Language ID'), | |
121 | + 'name' => Yii::t('app', 'Name'), | |
122 | + 'body' => Yii::t('app', 'Body'), | |
123 | + 'meta_title' => Yii::t('app', 'Meta Title'), | |
124 | + 'description' => Yii::t('app', 'Description'), | |
125 | + 'seo_text' => Yii::t('app', 'Seo Text'), | |
126 | + 'h1' => Yii::t('app', 'H1'), | |
127 | + ]; | |
128 | + } | |
129 | + | |
130 | + /** | |
131 | + * @return \yii\db\ActiveQuery | |
132 | + */ | |
133 | + public function getEvent() | |
134 | + { | |
135 | + return $this->hasOne(Event::className(), [ 'event_id' => 'event_id' ]); | |
136 | + } | |
137 | + | |
138 | + /** | |
139 | + * @return \yii\db\ActiveQuery | |
140 | + */ | |
141 | + public function getLanguage() | |
142 | + { | |
143 | + return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); | |
144 | + } | |
88 | 145 | } |
89 | -} | ... | ... |
common/models/EventSearch.php
... | ... | @@ -17,7 +17,6 @@ class EventSearch extends Event |
17 | 17 | { |
18 | 18 | return [ |
19 | 19 | [['event_id', 'created_at', 'updated_at', 'end_at'], 'integer'], |
20 | - [['name', 'alias', 'body', 'image', 'meta_title', 'description', 'h1', 'seo_text'], 'safe'], | |
21 | 20 | ]; |
22 | 21 | } |
23 | 22 | |
... | ... | @@ -70,15 +69,6 @@ class EventSearch extends Event |
70 | 69 | 'end_at' => $this->end_at, |
71 | 70 | ]); |
72 | 71 | |
73 | - $query->andFilterWhere(['like', 'name', $this->name]) | |
74 | - ->andFilterWhere(['like', 'alias', $this->alias]) | |
75 | - ->andFilterWhere(['like', 'body', $this->body]) | |
76 | - ->andFilterWhere(['like', 'image', $this->image]) | |
77 | - ->andFilterWhere(['like', 'meta_title', $this->meta_title]) | |
78 | - ->andFilterWhere(['like', 'description', $this->description]) | |
79 | - ->andFilterWhere(['like', 'h1', $this->h1]) | |
80 | - ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | |
81 | - | |
82 | 72 | return $dataProvider; |
83 | 73 | } |
84 | 74 | } | ... | ... |
common/models/OrdersDeliveryLang.php
... | ... | @@ -46,7 +46,7 @@ class OrdersDeliveryLang extends \yii\db\ActiveRecord |
46 | 46 | [['title'], 'string', 'max' => 255], |
47 | 47 | [['orders_delivery_id', 'language_id'], 'unique', 'targetAttribute' => ['orders_delivery_id', 'language_id'], 'message' => 'The combination of Orders Delivery ID and Language ID has already been taken.'], |
48 | 48 | [['language_id'], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), 'targetAttribute' => ['language_id' => 'language_id']], |
49 | - [['orders_delivery_id'], 'exist', 'skipOnError' => true, 'targetClass' => OrdersDelivery::className(), 'targetAttribute' => ['orders_delivery_id' => 'id']], | |
49 | + [['orders_delivery_id'], 'exist', 'skipOnError' => true, 'targetClass' => Delivery::className(), 'targetAttribute' => ['orders_delivery_id' => 'id']], | |
50 | 50 | ]; |
51 | 51 | } |
52 | 52 | ... | ... |
common/models/Page.php
... | ... | @@ -9,14 +9,6 @@ |
9 | 9 | /** |
10 | 10 | * This is the model class for table "page". |
11 | 11 | * @property integer $id |
12 | - * @property string $translit | |
13 | - * @property string $title | |
14 | - * @property string $body | |
15 | - * @property string $meta_title | |
16 | - * @property string $meta_keywords | |
17 | - * @property string $meta_description | |
18 | - * @property string $seo_text | |
19 | - * @property string $h1 | |
20 | 12 | * @property bool $in_menu |
21 | 13 | * * From language behavior * |
22 | 14 | * @property PageLang $lang |
... | ... | @@ -53,12 +45,6 @@ |
53 | 45 | public function behaviors() |
54 | 46 | { |
55 | 47 | return [ |
56 | - 'slug' => [ | |
57 | - 'class' => 'common\behaviors\Slug', | |
58 | - 'in_attribute' => 'title', | |
59 | - 'out_attribute' => 'translit', | |
60 | - 'translit' => true, | |
61 | - ], | |
62 | 48 | 'language' => [ |
63 | 49 | 'class' => LanguageBehavior::className(), |
64 | 50 | ], |
... | ... | @@ -73,25 +59,6 @@ |
73 | 59 | return [ |
74 | 60 | [ |
75 | 61 | [ |
76 | - 'body', | |
77 | - 'seo_text', | |
78 | - ], | |
79 | - 'string', | |
80 | - ], | |
81 | - [ | |
82 | - [ | |
83 | - 'translit', | |
84 | - 'title', | |
85 | - 'meta_title', | |
86 | - 'meta_keywords', | |
87 | - 'meta_description', | |
88 | - 'h1', | |
89 | - ], | |
90 | - 'string', | |
91 | - 'max' => 255, | |
92 | - ], | |
93 | - [ | |
94 | - [ | |
95 | 62 | 'in_menu', |
96 | 63 | ], |
97 | 64 | 'boolean', |
... | ... | @@ -99,14 +66,6 @@ |
99 | 66 | ]; |
100 | 67 | } |
101 | 68 | |
102 | - public function getPageTranslit($page) | |
103 | - { | |
104 | - return self::find() | |
105 | - ->where([ 'translit' => $page ]) | |
106 | - ->one(); | |
107 | - | |
108 | - } | |
109 | - | |
110 | 69 | /** |
111 | 70 | * @inheritdoc |
112 | 71 | */ |
... | ... | @@ -114,14 +73,6 @@ |
114 | 73 | { |
115 | 74 | return [ |
116 | 75 | 'id' => 'ID', |
117 | - 'translit' => 'Translit', | |
118 | - 'title' => 'Title', | |
119 | - 'body' => 'Body', | |
120 | - 'meta_title' => 'Meta Title', | |
121 | - 'meta_keywords' => 'Meta Keywords', | |
122 | - 'meta_description' => 'Meta Description', | |
123 | - 'seo_text' => 'Seo Text', | |
124 | - 'h1' => 'H1', | |
125 | 76 | 'in_menu' => 'Show in menu', |
126 | 77 | ]; |
127 | 78 | } | ... | ... |
common/models/PageLang.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use common\modules\language\models\Language; | |
6 | -use Yii; | |
7 | - | |
8 | -/** | |
9 | - * This is the model class for table "page_lang". | |
10 | - * | |
11 | - * @property integer $page_id | |
12 | - * @property integer $language_id | |
13 | - * @property string $title | |
14 | - * @property string $body | |
15 | - * @property string $meta_title | |
16 | - * @property string $meta_keywords | |
17 | - * @property string $meta_description | |
18 | - * @property string $seo_text | |
19 | - * @property string $h1 | |
20 | - * | |
21 | - * @property Language $language | |
22 | - * @property Page $page | |
23 | - */ | |
24 | -class PageLang extends \yii\db\ActiveRecord | |
25 | -{ | |
26 | 2 | |
27 | - public static function primaryKey() | |
28 | - { | |
29 | - return [ | |
30 | - 'page_id', | |
31 | - 'language_id', | |
32 | - ]; | |
33 | - } | |
3 | + namespace common\models; | |
4 | + | |
5 | + use common\modules\language\models\Language; | |
6 | + use Yii; | |
34 | 7 | |
35 | 8 | /** |
36 | - * @inheritdoc | |
37 | - */ | |
38 | - public static function tableName() | |
39 | - { | |
40 | - return 'page_lang'; | |
41 | - } | |
42 | - | |
43 | - /** | |
44 | - * @inheritdoc | |
45 | - */ | |
46 | - public function rules() | |
47 | - { | |
48 | - return [ | |
49 | - [['title', 'body'], 'required'], | |
50 | - [['body', 'seo_text'], 'string'], | |
51 | - [['title', 'meta_title', 'meta_keywords', 'meta_description', 'h1'], 'string', 'max' => 255], | |
52 | - [['page_id', 'language_id'], 'unique', 'targetAttribute' => ['page_id', 'language_id'], 'message' => 'The combination of Page ID and Language ID has already been taken.'], | |
53 | - [['language_id'], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), 'targetAttribute' => ['language_id' => 'language_id']], | |
54 | - [['page_id'], 'exist', 'skipOnError' => true, 'targetClass' => Page::className(), 'targetAttribute' => ['page_id' => 'id']], | |
55 | - ]; | |
56 | - } | |
57 | - | |
58 | - /** | |
59 | - * @inheritdoc | |
60 | - */ | |
61 | - public function attributeLabels() | |
62 | - { | |
63 | - return [ | |
64 | - 'page_id' => Yii::t('app', 'Page ID'), | |
65 | - 'language_id' => Yii::t('app', 'Language ID'), | |
66 | - 'title' => Yii::t('app', 'Title'), | |
67 | - 'body' => Yii::t('app', 'Body'), | |
68 | - 'meta_title' => Yii::t('app', 'Meta Title'), | |
69 | - 'meta_keywords' => Yii::t('app', 'Meta Keywords'), | |
70 | - 'meta_description' => Yii::t('app', 'Meta Description'), | |
71 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
72 | - 'h1' => Yii::t('app', 'H1'), | |
73 | - ]; | |
74 | - } | |
75 | - | |
76 | - /** | |
77 | - * @return \yii\db\ActiveQuery | |
78 | - */ | |
79 | - public function getLanguage() | |
80 | - { | |
81 | - return $this->hasOne(Language::className(), ['language_id' => 'language_id']); | |
82 | - } | |
83 | - | |
84 | - /** | |
85 | - * @return \yii\db\ActiveQuery | |
9 | + * This is the model class for table "page_lang". | |
10 | + * @property integer $page_id | |
11 | + * @property integer $language_id | |
12 | + * @property string $title | |
13 | + * @property string $body | |
14 | + * @property string $meta_title | |
15 | + * @property string $meta_keywords | |
16 | + * @property string $meta_description | |
17 | + * @property string $seo_text | |
18 | + * @property string $h1 | |
19 | + * @property string $alias | |
20 | + * @property Language $language | |
21 | + * @property Page $page | |
86 | 22 | */ |
87 | - public function getPage() | |
23 | + class PageLang extends \yii\db\ActiveRecord | |
88 | 24 | { |
89 | - return $this->hasOne(Page::className(), ['id' => 'page_id']); | |
25 | + | |
26 | + public static function primaryKey() | |
27 | + { | |
28 | + return [ | |
29 | + 'page_id', | |
30 | + 'language_id', | |
31 | + ]; | |
32 | + } | |
33 | + | |
34 | + /** | |
35 | + * @inheritdoc | |
36 | + */ | |
37 | + public static function tableName() | |
38 | + { | |
39 | + return 'page_lang'; | |
40 | + } | |
41 | + | |
42 | + public function behaviors() | |
43 | + { | |
44 | + return [ | |
45 | + 'slug' => [ | |
46 | + 'class' => 'common\behaviors\Slug', | |
47 | + 'in_attribute' => 'title', | |
48 | + 'out_attribute' => 'alias', | |
49 | + 'translit' => true, | |
50 | + ], | |
51 | + ]; | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * @inheritdoc | |
56 | + */ | |
57 | + public function rules() | |
58 | + { | |
59 | + return [ | |
60 | + [ | |
61 | + [ | |
62 | + 'title', | |
63 | + 'body', | |
64 | + ], | |
65 | + 'required', | |
66 | + ], | |
67 | + [ | |
68 | + [ | |
69 | + 'body', | |
70 | + 'seo_text', | |
71 | + ], | |
72 | + 'string', | |
73 | + ], | |
74 | + [ | |
75 | + [ | |
76 | + 'title', | |
77 | + 'meta_title', | |
78 | + 'meta_keywords', | |
79 | + 'meta_description', | |
80 | + 'h1', | |
81 | + 'alias', | |
82 | + ], | |
83 | + 'string', | |
84 | + 'max' => 255, | |
85 | + ], | |
86 | + [ | |
87 | + [ | |
88 | + 'page_id', | |
89 | + 'language_id', | |
90 | + ], | |
91 | + 'unique', | |
92 | + 'targetAttribute' => [ | |
93 | + 'page_id', | |
94 | + 'language_id', | |
95 | + ], | |
96 | + 'message' => 'The combination of Page ID and Language ID has already been taken.', | |
97 | + ], | |
98 | + [ | |
99 | + [ 'language_id' ], | |
100 | + 'exist', | |
101 | + 'skipOnError' => true, | |
102 | + 'targetClass' => Language::className(), | |
103 | + 'targetAttribute' => [ 'language_id' => 'language_id' ], | |
104 | + ], | |
105 | + [ | |
106 | + [ 'page_id' ], | |
107 | + 'exist', | |
108 | + 'skipOnError' => true, | |
109 | + 'targetClass' => Page::className(), | |
110 | + 'targetAttribute' => [ 'page_id' => 'id' ], | |
111 | + ], | |
112 | + ]; | |
113 | + } | |
114 | + | |
115 | + /** | |
116 | + * @inheritdoc | |
117 | + */ | |
118 | + public function attributeLabels() | |
119 | + { | |
120 | + return [ | |
121 | + 'page_id' => Yii::t('app', 'Page ID'), | |
122 | + 'language_id' => Yii::t('app', 'Language ID'), | |
123 | + 'title' => Yii::t('app', 'Title'), | |
124 | + 'body' => Yii::t('app', 'Body'), | |
125 | + 'meta_title' => Yii::t('app', 'Meta Title'), | |
126 | + 'meta_keywords' => Yii::t('app', 'Meta Keywords'), | |
127 | + 'meta_description' => Yii::t('app', 'Meta Description'), | |
128 | + 'seo_text' => Yii::t('app', 'Seo Text'), | |
129 | + 'h1' => Yii::t('app', 'H1'), | |
130 | + 'alias' => Yii::t('app', 'Alias'), | |
131 | + ]; | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * @return \yii\db\ActiveQuery | |
136 | + */ | |
137 | + public function getLanguage() | |
138 | + { | |
139 | + return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); | |
140 | + } | |
141 | + | |
142 | + /** | |
143 | + * @return \yii\db\ActiveQuery | |
144 | + */ | |
145 | + public function getPage() | |
146 | + { | |
147 | + return $this->hasOne(Page::className(), [ 'id' => 'page_id' ]); | |
148 | + } | |
90 | 149 | } |
91 | -} | ... | ... |
common/models/PageSearch.php
... | ... | @@ -17,7 +17,6 @@ class PageSearch extends Page |
17 | 17 | { |
18 | 18 | return [ |
19 | 19 | [['id'], 'integer'], |
20 | - [['translit', 'title', 'body', 'meta_title', 'meta_keywords', 'meta_description', 'seo_text', 'h1'], 'safe'], | |
21 | 20 | ]; |
22 | 21 | } |
23 | 22 | |
... | ... | @@ -65,15 +64,6 @@ class PageSearch extends Page |
65 | 64 | 'id' => $this->id, |
66 | 65 | ]); |
67 | 66 | |
68 | - $query->andFilterWhere(['like', 'translit', $this->translit]) | |
69 | - ->andFilterWhere(['like', 'title', $this->title]) | |
70 | - ->andFilterWhere(['like', 'body', $this->body]) | |
71 | - ->andFilterWhere(['like', 'meta_title', $this->meta_title]) | |
72 | - ->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords]) | |
73 | - ->andFilterWhere(['like', 'meta_description', $this->meta_description]) | |
74 | - ->andFilterWhere(['like', 'seo_text', $this->seo_text]) | |
75 | - ->andFilterWhere(['like', 'h1', $this->h1]); | |
76 | - | |
77 | 67 | return $dataProvider; |
78 | 68 | } |
79 | 69 | } | ... | ... |
common/models/ProductSpec.php
... | ... | @@ -13,10 +13,8 @@ |
13 | 13 | * This is the model class for table "product_spec". |
14 | 14 | * @property integer $product_spec_id |
15 | 15 | * @property integer $product_id |
16 | - * @property string $tech_spec_text | |
17 | 16 | * @property string $tech_spec_link |
18 | 17 | * @property string $tech_char_link |
19 | - * @property string $instruction | |
20 | 18 | * @property Product $product |
21 | 19 | * |
22 | 20 | * * From language behavior * |
... | ... | @@ -75,13 +73,6 @@ |
75 | 73 | return [ |
76 | 74 | [ |
77 | 75 | [ |
78 | - 'tech_spec_text', | |
79 | - 'instruction', | |
80 | - ], | |
81 | - 'string', | |
82 | - ], | |
83 | - [ | |
84 | - [ | |
85 | 76 | 'techSpecFile', |
86 | 77 | 'techCharFile', |
87 | 78 | ], |
... | ... | @@ -99,10 +90,8 @@ |
99 | 90 | return [ |
100 | 91 | 'product_spec_id' => 'Product Spec ID', |
101 | 92 | 'product_id' => 'Product ID', |
102 | - 'tech_spec_text' => 'Tech Spec Text', | |
103 | 93 | 'tech_spec_link' => 'Tech Spec Link', |
104 | 94 | 'tech_char_link' => 'Tech Char Link', |
105 | - 'instruction' => 'Instruction', | |
106 | 95 | 'techSpecFile' => 'techSpecFile', |
107 | 96 | 'techCharFile' => 'techCharFile', |
108 | 97 | ]; | ... | ... |
common/models/Project.php
... | ... | @@ -11,9 +11,6 @@ |
11 | 11 | /** |
12 | 12 | * This is the model class for table "project". |
13 | 13 | * @property integer $project_id |
14 | - * @property string $title | |
15 | - * @property string $link | |
16 | - * @property string $description | |
17 | 14 | * @property integer $date_add |
18 | 15 | * @property ProjectImage[] $images |
19 | 16 | * @property ProjectImage $image |
... | ... | @@ -57,12 +54,6 @@ |
57 | 54 | public function behaviors() |
58 | 55 | { |
59 | 56 | return [ |
60 | - 'slug' => [ | |
61 | - 'class' => 'common\behaviors\Slug', | |
62 | - 'in_attribute' => 'title', | |
63 | - 'out_attribute' => 'link', | |
64 | - 'translit' => true, | |
65 | - ], | |
66 | 57 | 'language' => [ |
67 | 58 | 'class' => LanguageBehavior::className(), |
68 | 59 | ], |
... | ... | @@ -83,14 +74,6 @@ |
83 | 74 | }, |
84 | 75 | ], |
85 | 76 | [ |
86 | - [ 'title' ], | |
87 | - 'required', | |
88 | - ], | |
89 | - [ | |
90 | - [ 'description' ], | |
91 | - 'string', | |
92 | - ], | |
93 | - [ | |
94 | 77 | [ |
95 | 78 | 'date_add', |
96 | 79 | 'imagesUpload', | ... | ... |
common/models/ProjectLang.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use common\modules\language\models\Language; | |
6 | -use Yii; | |
7 | - | |
8 | -/** | |
9 | - * This is the model class for table "project_lang". | |
10 | - * | |
11 | - * @property integer $project_id | |
12 | - * @property integer $language_id | |
13 | - * @property string $title | |
14 | - * @property string $description | |
15 | - * | |
16 | - * @property Language $language | |
17 | - * @property Project $project | |
18 | - */ | |
19 | -class ProjectLang extends \yii\db\ActiveRecord | |
20 | -{ | |
21 | 2 | |
22 | - public static function primaryKey() | |
23 | - { | |
24 | - return [ | |
25 | - 'project_id', | |
26 | - 'language_id', | |
27 | - ]; | |
28 | - } | |
3 | + namespace common\models; | |
4 | + | |
5 | + use common\modules\language\models\Language; | |
6 | + use Yii; | |
29 | 7 | |
30 | 8 | /** |
31 | - * @inheritdoc | |
32 | - */ | |
33 | - public static function tableName() | |
34 | - { | |
35 | - return 'project_lang'; | |
36 | - } | |
37 | - | |
38 | - /** | |
39 | - * @inheritdoc | |
40 | - */ | |
41 | - public function rules() | |
42 | - { | |
43 | - return [ | |
44 | - [['title'], 'required'], | |
45 | - [['description'], 'string'], | |
46 | - [['title'], 'string', 'max' => 255], | |
47 | - [['project_id', 'language_id'], 'unique', 'targetAttribute' => ['project_id', 'language_id'], 'message' => 'The combination of Project ID and Language ID has already been taken.'], | |
48 | - [['language_id'], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), 'targetAttribute' => ['language_id' => 'language_id']], | |
49 | - [['project_id'], 'exist', 'skipOnError' => true, 'targetClass' => Project::className(), 'targetAttribute' => ['project_id' => 'project_id']], | |
50 | - ]; | |
51 | - } | |
52 | - | |
53 | - /** | |
54 | - * @inheritdoc | |
55 | - */ | |
56 | - public function attributeLabels() | |
57 | - { | |
58 | - return [ | |
59 | - 'project_id' => Yii::t('app', 'Project ID'), | |
60 | - 'language_id' => Yii::t('app', 'Language ID'), | |
61 | - 'title' => Yii::t('app', 'Title'), | |
62 | - 'description' => Yii::t('app', 'Description'), | |
63 | - ]; | |
64 | - } | |
65 | - | |
66 | - /** | |
67 | - * @return \yii\db\ActiveQuery | |
68 | - */ | |
69 | - public function getLanguage() | |
70 | - { | |
71 | - return $this->hasOne(Language::className(), ['language_id' => 'language_id']); | |
72 | - } | |
73 | - | |
74 | - /** | |
75 | - * @return \yii\db\ActiveQuery | |
9 | + * This is the model class for table "project_lang". | |
10 | + * @property integer $project_id | |
11 | + * @property integer $language_id | |
12 | + * @property string $title | |
13 | + * @property string $description | |
14 | + * @property string $alias | |
15 | + * @property Language $language | |
16 | + * @property Project $project | |
76 | 17 | */ |
77 | - public function getProject() | |
18 | + class ProjectLang extends \yii\db\ActiveRecord | |
78 | 19 | { |
79 | - return $this->hasOne(Project::className(), ['project_id' => 'project_id']); | |
20 | + | |
21 | + public static function primaryKey() | |
22 | + { | |
23 | + return [ | |
24 | + 'project_id', | |
25 | + 'language_id', | |
26 | + ]; | |
27 | + } | |
28 | + | |
29 | + /** | |
30 | + * @inheritdoc | |
31 | + */ | |
32 | + public static function tableName() | |
33 | + { | |
34 | + return 'project_lang'; | |
35 | + } | |
36 | + | |
37 | + public function behaviors() | |
38 | + { | |
39 | + return [ | |
40 | + 'slug' => [ | |
41 | + 'class' => 'common\behaviors\Slug', | |
42 | + 'in_attribute' => 'title', | |
43 | + 'out_attribute' => 'alias', | |
44 | + 'translit' => true, | |
45 | + ], | |
46 | + ]; | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * @inheritdoc | |
51 | + */ | |
52 | + public function rules() | |
53 | + { | |
54 | + return [ | |
55 | + [ | |
56 | + [ 'title' ], | |
57 | + 'required', | |
58 | + ], | |
59 | + [ | |
60 | + [ 'description' ], | |
61 | + 'string', | |
62 | + ], | |
63 | + [ | |
64 | + [ | |
65 | + 'title', | |
66 | + 'alias', | |
67 | + ], | |
68 | + 'string', | |
69 | + 'max' => 255, | |
70 | + ], | |
71 | + [ | |
72 | + [ | |
73 | + 'project_id', | |
74 | + 'language_id', | |
75 | + ], | |
76 | + 'unique', | |
77 | + 'targetAttribute' => [ | |
78 | + 'project_id', | |
79 | + 'language_id', | |
80 | + ], | |
81 | + 'message' => 'The combination of Project ID and Language ID has already been taken.', | |
82 | + ], | |
83 | + [ | |
84 | + [ 'language_id' ], | |
85 | + 'exist', | |
86 | + 'skipOnError' => true, | |
87 | + 'targetClass' => Language::className(), | |
88 | + 'targetAttribute' => [ 'language_id' => 'language_id' ], | |
89 | + ], | |
90 | + [ | |
91 | + [ 'project_id' ], | |
92 | + 'exist', | |
93 | + 'skipOnError' => true, | |
94 | + 'targetClass' => Project::className(), | |
95 | + 'targetAttribute' => [ 'project_id' => 'project_id' ], | |
96 | + ], | |
97 | + ]; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * @inheritdoc | |
102 | + */ | |
103 | + public function attributeLabels() | |
104 | + { | |
105 | + return [ | |
106 | + 'project_id' => Yii::t('app', 'Project ID'), | |
107 | + 'language_id' => Yii::t('app', 'Language ID'), | |
108 | + 'title' => Yii::t('app', 'Title'), | |
109 | + 'description' => Yii::t('app', 'Description'), | |
110 | + 'alias' => Yii::t('app', 'Alias'), | |
111 | + ]; | |
112 | + } | |
113 | + | |
114 | + /** | |
115 | + * @return \yii\db\ActiveQuery | |
116 | + */ | |
117 | + public function getLanguage() | |
118 | + { | |
119 | + return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); | |
120 | + } | |
121 | + | |
122 | + /** | |
123 | + * @return \yii\db\ActiveQuery | |
124 | + */ | |
125 | + public function getProject() | |
126 | + { | |
127 | + return $this->hasOne(Project::className(), [ 'project_id' => 'project_id' ]); | |
128 | + } | |
80 | 129 | } |
81 | -} | ... | ... |
common/models/ProjectSearch.php
... | ... | @@ -23,7 +23,6 @@ class ProjectSearch extends Project |
23 | 23 | { |
24 | 24 | return [ |
25 | 25 | [['project_id', 'date_add'], 'integer'], |
26 | - [['title', 'link', 'description'], 'safe'], | |
27 | 26 | ]; |
28 | 27 | } |
29 | 28 | |
... | ... | @@ -67,10 +66,6 @@ class ProjectSearch extends Project |
67 | 66 | 'date_add' => $this->date_add, |
68 | 67 | ]); |
69 | 68 | |
70 | - $query->andFilterWhere(['like', 'title', $this->title]) | |
71 | - ->andFilterWhere(['like', 'link', $this->link]) | |
72 | - ->andFilterWhere(['like', 'description', $this->description]); | |
73 | - | |
74 | 69 | return $dataProvider; |
75 | 70 | } |
76 | 71 | } | ... | ... |
common/models/Seo.php
... | ... | @@ -13,11 +13,6 @@ use yii\web\Request; |
13 | 13 | * |
14 | 14 | * @property integer $seo_id |
15 | 15 | * @property string $url |
16 | - * @property string $title | |
17 | - * @property string $meta | |
18 | - * @property string $description | |
19 | - * @property string $h1 | |
20 | - * @property string $seo_text | |
21 | 16 | * |
22 | 17 | * * From language behavior * |
23 | 18 | * @property SeoLang $lang |
... | ... | @@ -63,8 +58,7 @@ class Seo extends \yii\db\ActiveRecord |
63 | 58 | { |
64 | 59 | return [ |
65 | 60 | [['url'], 'required'], |
66 | - [['seo_text'], 'string'], | |
67 | - [['url', 'title', 'meta', 'description', 'h1'], 'string', 'max' => 255], | |
61 | + [['url'], 'string', 'max' => 255], | |
68 | 62 | ]; |
69 | 63 | } |
70 | 64 | |
... | ... | @@ -76,11 +70,6 @@ class Seo extends \yii\db\ActiveRecord |
76 | 70 | return [ |
77 | 71 | 'seo_id' => Yii::t('app', 'seo_id'), |
78 | 72 | 'url' => Yii::t('app', 'url'), |
79 | - 'title' => Yii::t('app', 'title'), | |
80 | - 'meta' => Yii::t('app', 'meta_title'), | |
81 | - 'description' => Yii::t('app', 'description'), | |
82 | - 'h1' => Yii::t('app', 'h1'), | |
83 | - 'seo_text' => Yii::t('app', 'seo_text'), | |
84 | 73 | ]; |
85 | 74 | } |
86 | 75 | } | ... | ... |
common/models/SeoCategory.php
... | ... | @@ -12,7 +12,6 @@ use yii\web\Request; |
12 | 12 | * This is the model class for table "seo_category". |
13 | 13 | * |
14 | 14 | * @property integer $seo_category_id |
15 | - * @property string $name | |
16 | 15 | * @property string $controller |
17 | 16 | * @property integer $status |
18 | 17 | * |
... | ... | @@ -62,7 +61,6 @@ class SeoCategory extends \yii\db\ActiveRecord |
62 | 61 | { |
63 | 62 | return [ |
64 | 63 | [['status'], 'integer'], |
65 | - [['name'], 'string', 'max' => 255], | |
66 | 64 | [['controller'], 'string', 'max' => 100], |
67 | 65 | ]; |
68 | 66 | } |
... | ... | @@ -74,7 +72,6 @@ class SeoCategory extends \yii\db\ActiveRecord |
74 | 72 | { |
75 | 73 | return [ |
76 | 74 | 'seo_category_id' => Yii::t('app', 'seo_category_id'), |
77 | - 'name' => Yii::t('app', 'name'), | |
78 | 75 | 'controller' => Yii::t('app', 'controller'), |
79 | 76 | 'status' => Yii::t('app', 'status'), |
80 | 77 | ]; | ... | ... |
common/models/SeoCategorySearch.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\base\Model; | |
7 | -use yii\data\ActiveDataProvider; | |
8 | -use common\models\SeoCategory; | |
9 | - | |
10 | -/** | |
11 | - * SeoCategorySearch represents the model behind the search form about `common\models\SeoCategory`. | |
12 | - */ | |
13 | -class SeoCategorySearch extends SeoCategory | |
14 | -{ | |
15 | 2 | |
16 | - public function behaviors() | |
17 | - { | |
18 | - return []; | |
19 | - } | |
3 | + namespace common\models; | |
4 | + | |
5 | + use yii\base\Model; | |
6 | + use yii\data\ActiveDataProvider; | |
20 | 7 | |
21 | 8 | /** |
22 | - * @inheritdoc | |
23 | - */ | |
24 | - public function rules() | |
25 | - { | |
26 | - return [ | |
27 | - [['seo_category_id', 'status'], 'integer'], | |
28 | - [['name', 'controller'], 'safe'], | |
29 | - ]; | |
30 | - } | |
31 | - | |
32 | - /** | |
33 | - * @inheritdoc | |
34 | - */ | |
35 | - public function scenarios() | |
36 | - { | |
37 | - // bypass scenarios() implementation in the parent class | |
38 | - return Model::scenarios(); | |
39 | - } | |
40 | - | |
41 | - /** | |
42 | - * Creates data provider instance with search query applied | |
43 | - * | |
44 | - * @param array $params | |
45 | - * | |
46 | - * @return ActiveDataProvider | |
9 | + * SeoCategorySearch represents the model behind the search form about | |
10 | + * `common\models\SeoCategory`. | |
47 | 11 | */ |
48 | - public function search($params) | |
12 | + class SeoCategorySearch extends SeoCategory | |
49 | 13 | { |
50 | - $query = SeoCategory::find(); | |
51 | - | |
52 | - // add conditions that should always apply here | |
53 | - | |
54 | - $dataProvider = new ActiveDataProvider([ | |
55 | - 'query' => $query, | |
56 | - ]); | |
57 | - | |
58 | - $this->load($params); | |
59 | - | |
60 | - if (!$this->validate()) { | |
61 | - // uncomment the following line if you do not want to return any records when validation fails | |
62 | - // $query->where('0=1'); | |
14 | + | |
15 | + public function behaviors() | |
16 | + { | |
17 | + return []; | |
18 | + } | |
19 | + | |
20 | + /** | |
21 | + * @inheritdoc | |
22 | + */ | |
23 | + public function rules() | |
24 | + { | |
25 | + return [ | |
26 | + [ | |
27 | + [ | |
28 | + 'seo_category_id', | |
29 | + 'status', | |
30 | + ], | |
31 | + 'integer', | |
32 | + ], | |
33 | + [ | |
34 | + [ 'controller' ], | |
35 | + 'safe', | |
36 | + ], | |
37 | + ]; | |
38 | + } | |
39 | + | |
40 | + /** | |
41 | + * @inheritdoc | |
42 | + */ | |
43 | + public function scenarios() | |
44 | + { | |
45 | + // bypass scenarios() implementation in the parent class | |
46 | + return Model::scenarios(); | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * Creates data provider instance with search query applied | |
51 | + * | |
52 | + * @param array $params | |
53 | + * | |
54 | + * @return ActiveDataProvider | |
55 | + */ | |
56 | + public function search($params) | |
57 | + { | |
58 | + $query = SeoCategory::find(); | |
59 | + | |
60 | + // add conditions that should always apply here | |
61 | + | |
62 | + $dataProvider = new ActiveDataProvider([ | |
63 | + 'query' => $query, | |
64 | + ]); | |
65 | + | |
66 | + $this->load($params); | |
67 | + | |
68 | + if(!$this->validate()) { | |
69 | + // uncomment the following line if you do not want to return any records when validation fails | |
70 | + // $query->where('0=1'); | |
71 | + return $dataProvider; | |
72 | + } | |
73 | + | |
74 | + // grid filtering conditions | |
75 | + $query->andFilterWhere([ | |
76 | + 'seo_category_id' => $this->seo_category_id, | |
77 | + 'status' => $this->status, | |
78 | + ]); | |
79 | + | |
80 | + $query->andFilterWhere([ | |
81 | + 'like', | |
82 | + 'controller', | |
83 | + $this->controller, | |
84 | + ]); | |
85 | + | |
63 | 86 | return $dataProvider; |
64 | 87 | } |
65 | - | |
66 | - // grid filtering conditions | |
67 | - $query->andFilterWhere([ | |
68 | - 'seo_category_id' => $this->seo_category_id, | |
69 | - 'status' => $this->status, | |
70 | - ]); | |
71 | - | |
72 | - $query->andFilterWhere(['like', 'name', $this->name]) | |
73 | - ->andFilterWhere(['like', 'controller', $this->controller]); | |
74 | - | |
75 | - return $dataProvider; | |
76 | 88 | } |
77 | -} | ... | ... |
common/models/SeoDynamic.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use common\modules\language\behaviors\LanguageBehavior; | |
6 | -use Yii; | |
7 | -use yii\db\ActiveQuery; | |
8 | -use yii\db\ActiveRecord; | |
9 | -use yii\web\Request; | |
10 | -/** | |
11 | - * This is the model class for table "seo_dynamic". | |
12 | - * | |
13 | - * @property integer $seo_dynamic_id | |
14 | - * @property integer $seo_category_id | |
15 | - * @property string $name | |
16 | - * @property string $action | |
17 | - * @property string $fields | |
18 | - * @property string $title | |
19 | - * @property string $h1 | |
20 | - * @property string $description | |
21 | - * @property string $seo_text | |
22 | - * @property integer $status | |
23 | - * @property string $param | |
24 | - * @property string $key | |
25 | - * | |
26 | - * * From language behavior * | |
27 | - * @property SeoDynamicLang $lang | |
28 | - * @property SeoDynamicLang[] $langs | |
29 | - * @property SeoDynamicLang $object_lang | |
30 | - * @property string $ownerKey | |
31 | - * @property string $langKey | |
32 | - * @method string getOwnerKey() | |
33 | - * @method void setOwnerKey(string $value) | |
34 | - * @method string getLangKey() | |
35 | - * @method void setLangKey(string $value) | |
36 | - * @method ActiveQuery getLangs() | |
37 | - * @method ActiveQuery getLang( integer $language_id ) | |
38 | - * @method SeoDynamicLang[] generateLangs() | |
39 | - * @method void loadLangs(Request $request, ActiveRecord[] $model_langs) | |
40 | - * @method bool linkLangs(ActiveRecord[] $model_langs) | |
41 | - * @method bool saveLangs(ActiveRecord[] $model_langs) | |
42 | - * * End language behavior * | |
43 | - * @property SeoCategory $seoCategory | |
44 | - */ | |
45 | -class SeoDynamic extends \yii\db\ActiveRecord | |
46 | -{ | |
47 | - /** | |
48 | - * @inheritdoc | |
49 | - */ | |
50 | - public static function tableName() | |
51 | - { | |
52 | - return 'seo_dynamic'; | |
53 | - } | |
54 | 2 | |
55 | - public function behaviors() | |
56 | - { | |
57 | - return [ | |
58 | - 'language' => [ | |
59 | - 'class' => LanguageBehavior::className(), | |
60 | - ], | |
61 | - ]; | |
62 | - } | |
3 | + namespace common\models; | |
4 | + | |
5 | + use common\modules\language\behaviors\LanguageBehavior; | |
6 | + use Yii; | |
7 | + use yii\db\ActiveQuery; | |
8 | + use yii\db\ActiveRecord; | |
9 | + use yii\web\Request; | |
63 | 10 | |
64 | 11 | /** |
65 | - * @inheritdoc | |
66 | - */ | |
67 | - public function rules() | |
68 | - { | |
69 | - return [ | |
70 | - [['seo_category_id', 'status'], 'integer'], | |
71 | - [['seo_text'], 'string'], | |
72 | - [['name', 'action'], 'string', 'max' => 200], | |
73 | - [['fields', 'title', 'meta', 'h1', 'description', 'param', 'key'], 'string', 'max' => 255], | |
74 | - [['seo_category_id'], 'exist', 'skipOnError' => true, 'targetClass' => SeoCategory::className(), 'targetAttribute' => ['seo_category_id' => 'seo_category_id']], | |
75 | - ]; | |
76 | - } | |
77 | - | |
78 | - /** | |
79 | - * @inheritdoc | |
80 | - */ | |
81 | - public function attributeLabels() | |
82 | - { | |
83 | - return [ | |
84 | - 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), | |
85 | - 'seo_category_id' => Yii::t('app', 'seo_category_id'), | |
86 | - 'name' => Yii::t('app', 'name'), | |
87 | - 'action' => Yii::t('app', 'action'), | |
88 | - 'fields' => Yii::t('app', 'fields'), | |
89 | - 'title' => Yii::t('app', 'title'), | |
90 | - 'meta' => Yii::t('app', 'meta'), | |
91 | - 'h1' => Yii::t('app', 'h1'), | |
92 | - 'description' => Yii::t('app', 'description'), | |
93 | - 'seo_text' => Yii::t('app', 'seo_text'), | |
94 | - 'status' => Yii::t('app', 'status'), | |
95 | - 'param' => Yii::t('app', 'param'), | |
96 | - 'key' => Yii::t('app', 'key'), | |
97 | - ]; | |
98 | - } | |
99 | - | |
100 | - /** | |
101 | - * @return \yii\db\ActiveQuery | |
12 | + * This is the model class for table "seo_dynamic". | |
13 | + * @property integer $seo_dynamic_id | |
14 | + * @property integer $seo_category_id | |
15 | + * @property string $action | |
16 | + * @property string $fields | |
17 | + * @property integer $status | |
18 | + * @property string $param | |
19 | + * * From language behavior * | |
20 | + * @property SeoDynamicLang $lang | |
21 | + * @property SeoDynamicLang[] $langs | |
22 | + * @property SeoDynamicLang $object_lang | |
23 | + * @property string $ownerKey | |
24 | + * @property string $langKey | |
25 | + * @method string getOwnerKey() | |
26 | + * @method void setOwnerKey( string $value ) | |
27 | + * @method string getLangKey() | |
28 | + * @method void setLangKey( string $value ) | |
29 | + * @method ActiveQuery getLangs() | |
30 | + * @method ActiveQuery getLang( integer $language_id ) | |
31 | + * @method SeoDynamicLang[] generateLangs() | |
32 | + * @method void loadLangs( Request $request, ActiveRecord[] $model_langs ) | |
33 | + * @method bool linkLangs( ActiveRecord[] $model_langs ) | |
34 | + * @method bool saveLangs( ActiveRecord[] $model_langs ) | |
35 | + * * End language behavior * | |
36 | + * @property SeoCategory $seoCategory | |
102 | 37 | */ |
103 | - public function getSeoCategory() | |
38 | + class SeoDynamic extends \yii\db\ActiveRecord | |
104 | 39 | { |
105 | - return $this->hasOne(SeoCategory::className(), ['seo_category_id' => 'seo_category_id']); | |
40 | + | |
41 | + /** | |
42 | + * @inheritdoc | |
43 | + */ | |
44 | + public static function tableName() | |
45 | + { | |
46 | + return 'seo_dynamic'; | |
47 | + } | |
48 | + | |
49 | + public function behaviors() | |
50 | + { | |
51 | + return [ | |
52 | + 'language' => [ | |
53 | + 'class' => LanguageBehavior::className(), | |
54 | + ], | |
55 | + ]; | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * @inheritdoc | |
60 | + */ | |
61 | + public function rules() | |
62 | + { | |
63 | + return [ | |
64 | + [ | |
65 | + [ | |
66 | + 'seo_category_id', | |
67 | + 'status', | |
68 | + ], | |
69 | + 'integer', | |
70 | + ], | |
71 | + [ | |
72 | + [ | |
73 | + 'action', | |
74 | + ], | |
75 | + 'string', | |
76 | + 'max' => 200, | |
77 | + ], | |
78 | + [ | |
79 | + [ | |
80 | + 'fields', | |
81 | + 'param', | |
82 | + ], | |
83 | + 'string', | |
84 | + 'max' => 255, | |
85 | + ], | |
86 | + [ | |
87 | + [ 'seo_category_id' ], | |
88 | + 'exist', | |
89 | + 'skipOnError' => true, | |
90 | + 'targetClass' => SeoCategory::className(), | |
91 | + 'targetAttribute' => [ 'seo_category_id' => 'seo_category_id' ], | |
92 | + ], | |
93 | + ]; | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * @inheritdoc | |
98 | + */ | |
99 | + public function attributeLabels() | |
100 | + { | |
101 | + return [ | |
102 | + 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), | |
103 | + 'seo_category_id' => Yii::t('app', 'seo_category_id'), | |
104 | + 'action' => Yii::t('app', 'action'), | |
105 | + 'fields' => Yii::t('app', 'fields'), | |
106 | + 'status' => Yii::t('app', 'status'), | |
107 | + 'param' => Yii::t('app', 'param'), | |
108 | + ]; | |
109 | + } | |
110 | + | |
111 | + /** | |
112 | + * @return \yii\db\ActiveQuery | |
113 | + */ | |
114 | + public function getSeoCategory() | |
115 | + { | |
116 | + return $this->hasOne(SeoCategory::className(), [ 'seo_category_id' => 'seo_category_id' ]); | |
117 | + } | |
106 | 118 | } |
107 | -} | ... | ... |
common/models/SeoDynamicSearch.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\models; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\base\Model; | |
7 | -use yii\data\ActiveDataProvider; | |
8 | -use common\models\SeoDynamic; | |
9 | - | |
10 | -/** | |
11 | - * SeoDynamicSearch represents the model behind the search form about `common\models\SeoDynamic`. | |
12 | - */ | |
13 | -class SeoDynamicSearch extends SeoDynamic | |
14 | -{ | |
15 | 2 | |
16 | - public function behaviors() | |
17 | - { | |
18 | - return []; | |
19 | - } | |
3 | + namespace common\models; | |
4 | + | |
5 | + use yii\base\Model; | |
6 | + use yii\data\ActiveDataProvider; | |
20 | 7 | |
21 | 8 | /** |
22 | - * @inheritdoc | |
23 | - */ | |
24 | - public function rules() | |
25 | - { | |
26 | - return [ | |
27 | - [['seo_dynamic_id', 'seo_category_id', 'status'], 'integer'], | |
28 | - [['name', 'action', 'fields', 'title', 'meta', 'h1', 'description', 'seo_text'], 'safe'], | |
29 | - ]; | |
30 | - } | |
31 | - | |
32 | - /** | |
33 | - * @inheritdoc | |
34 | - */ | |
35 | - public function scenarios() | |
36 | - { | |
37 | - // bypass scenarios() implementation in the parent class | |
38 | - return Model::scenarios(); | |
39 | - } | |
40 | - | |
41 | - /** | |
42 | - * Creates data provider instance with search query applied | |
43 | - * | |
44 | - * @param array $params | |
45 | - * | |
46 | - * @return ActiveDataProvider | |
9 | + * SeoDynamicSearch represents the model behind the search form about | |
10 | + * `common\models\SeoDynamic`. | |
47 | 11 | */ |
48 | - public function search($seo_category_id, $params) | |
12 | + class SeoDynamicSearch extends SeoDynamic | |
49 | 13 | { |
50 | - $query = SeoDynamic::find(); | |
51 | - | |
52 | - // add conditions that should always apply here | |
53 | - | |
54 | - $dataProvider = new ActiveDataProvider([ | |
55 | - 'query' => $query, | |
56 | - ]); | |
57 | - | |
58 | - $this->load($params); | |
59 | - | |
60 | - if (!$this->validate()) { | |
61 | - // uncomment the following line if you do not want to return any records when validation fails | |
62 | - // $query->where('0=1'); | |
14 | + | |
15 | + public function behaviors() | |
16 | + { | |
17 | + return []; | |
18 | + } | |
19 | + | |
20 | + /** | |
21 | + * @inheritdoc | |
22 | + */ | |
23 | + public function rules() | |
24 | + { | |
25 | + return [ | |
26 | + [ | |
27 | + [ | |
28 | + 'seo_dynamic_id', | |
29 | + 'seo_category_id', | |
30 | + 'status', | |
31 | + ], | |
32 | + 'integer', | |
33 | + ], | |
34 | + [ | |
35 | + [ | |
36 | + 'action', | |
37 | + 'fields', | |
38 | + ], | |
39 | + 'safe', | |
40 | + ], | |
41 | + ]; | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * @inheritdoc | |
46 | + */ | |
47 | + public function scenarios() | |
48 | + { | |
49 | + // bypass scenarios() implementation in the parent class | |
50 | + return Model::scenarios(); | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * Creates data provider instance with search query applied | |
55 | + * | |
56 | + * @param array $params | |
57 | + * | |
58 | + * @return ActiveDataProvider | |
59 | + */ | |
60 | + public function search($seo_category_id, $params) | |
61 | + { | |
62 | + $query = SeoDynamic::find(); | |
63 | + | |
64 | + // add conditions that should always apply here | |
65 | + | |
66 | + $dataProvider = new ActiveDataProvider([ | |
67 | + 'query' => $query, | |
68 | + ]); | |
69 | + | |
70 | + $this->load($params); | |
71 | + | |
72 | + if(!$this->validate()) { | |
73 | + // uncomment the following line if you do not want to return any records when validation fails | |
74 | + // $query->where('0=1'); | |
75 | + return $dataProvider; | |
76 | + } | |
77 | + | |
78 | + // grid filtering conditions | |
79 | + $query->andFilterWhere([ | |
80 | + 'seo_dynamic_id' => $this->seo_dynamic_id, | |
81 | + 'seo_category_id' => $seo_category_id, | |
82 | + 'status' => $this->status, | |
83 | + ]); | |
84 | + | |
85 | + $query->andFilterWhere([ | |
86 | + 'like', | |
87 | + 'action', | |
88 | + $this->action, | |
89 | + ]) | |
90 | + ->andFilterWhere([ | |
91 | + 'like', | |
92 | + 'fields', | |
93 | + $this->fields, | |
94 | + ]); | |
95 | + | |
63 | 96 | return $dataProvider; |
64 | 97 | } |
65 | - | |
66 | - // grid filtering conditions | |
67 | - $query->andFilterWhere([ | |
68 | - 'seo_dynamic_id' => $this->seo_dynamic_id, | |
69 | - 'seo_category_id' => $seo_category_id, | |
70 | - 'status' => $this->status, | |
71 | - ]); | |
72 | - | |
73 | - $query->andFilterWhere(['like', 'name', $this->name]) | |
74 | - ->andFilterWhere(['like', 'action', $this->action]) | |
75 | - ->andFilterWhere(['like', 'fields', $this->fields]) | |
76 | - ->andFilterWhere(['like', 'title', $this->title]) | |
77 | - ->andFilterWhere(['like', 'meta', $this->title]) | |
78 | - ->andFilterWhere(['like', 'h1', $this->h1]) | |
79 | - ->andFilterWhere(['like', 'description', $this->description]) | |
80 | - ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | |
81 | - | |
82 | - return $dataProvider; | |
83 | 98 | } |
84 | -} | ... | ... |
common/models/SeoSearch.php
... | ... | @@ -2,10 +2,8 @@ |
2 | 2 | |
3 | 3 | namespace common\models; |
4 | 4 | |
5 | -use Yii; | |
6 | 5 | use yii\base\Model; |
7 | 6 | use yii\data\ActiveDataProvider; |
8 | -use common\models\Seo; | |
9 | 7 | |
10 | 8 | /** |
11 | 9 | * SeoSearch represents the model behind the search form about `common\models\Seo`. |
... | ... | @@ -25,7 +23,7 @@ class SeoSearch extends Seo |
25 | 23 | { |
26 | 24 | return [ |
27 | 25 | [['seo_id'], 'integer'], |
28 | - [['url', 'title', 'meta', 'description', 'h1', 'seo_text'], 'safe'], | |
26 | + [['url'], 'safe'], | |
29 | 27 | ]; |
30 | 28 | } |
31 | 29 | |
... | ... | @@ -68,12 +66,7 @@ class SeoSearch extends Seo |
68 | 66 | 'seo_id' => $this->seo_id, |
69 | 67 | ]); |
70 | 68 | |
71 | - $query->andFilterWhere(['like', 'url', $this->url]) | |
72 | - ->andFilterWhere(['like', 'title', $this->title]) | |
73 | - ->andFilterWhere(['like', 'meta', $this->meta]) | |
74 | - ->andFilterWhere(['like', 'description', $this->description]) | |
75 | - ->andFilterWhere(['like', 'h1', $this->h1]) | |
76 | - ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | |
69 | + $query->andFilterWhere(['like', 'url', $this->url]); | |
77 | 70 | |
78 | 71 | return $dataProvider; |
79 | 72 | } | ... | ... |