Commit f1ec0a0b60a38664a4dc3a745c3feaf4304e1cba
1 parent
d33ff9db
Add object types
Showing
5 changed files
with
80 additions
and
177 deletions
Show diff stats
backend/views/objectkb/_form.php
@@ -42,7 +42,11 @@ | @@ -42,7 +42,11 @@ | ||
42 | ], | 42 | ], |
43 | ] | 43 | ] |
44 | ) ?> | 44 | ) ?> |
45 | - | 45 | + <?= $form->field($model, 'type') |
46 | + ->dropDownList( | ||
47 | + ['Не отображать', 'Для компаний', 'Для частных лиц'] | ||
48 | + | ||
49 | + ) ?> | ||
46 | <?= LanguageForm::widget( | 50 | <?= LanguageForm::widget( |
47 | [ | 51 | [ |
48 | 'modelLangs' => $modelLangs, | 52 | 'modelLangs' => $modelLangs, |
common/models/Objectkb.php
@@ -22,6 +22,10 @@ | @@ -22,6 +22,10 @@ | ||
22 | */ | 22 | */ |
23 | class Objectkb extends ActiveRecord | 23 | class Objectkb extends ActiveRecord |
24 | { | 24 | { |
25 | + const TYPE_DEFAULT = 0; | ||
26 | + const TYPE_COMPANY = 1; | ||
27 | + const TYPE_PRIVATE = 2; | ||
28 | + | ||
25 | /** | 29 | /** |
26 | * @inheritdoc | 30 | * @inheritdoc |
27 | */ | 31 | */ |
@@ -59,6 +63,7 @@ | @@ -59,6 +63,7 @@ | ||
59 | [ | 63 | [ |
60 | 'slider_id', | 64 | 'slider_id', |
61 | 'sort', | 65 | 'sort', |
66 | + 'type' | ||
62 | ], | 67 | ], |
63 | 'integer', | 68 | 'integer', |
64 | ], | 69 | ], |
@@ -94,6 +99,7 @@ | @@ -94,6 +99,7 @@ | ||
94 | 'status' => Yii::t('core', 'Status'), | 99 | 'status' => Yii::t('core', 'Status'), |
95 | 'sort' => Yii::t('core', 'Sort'), | 100 | 'sort' => Yii::t('core', 'Sort'), |
96 | 'image_mini_id' => Yii::t('core', 'Image Mini'), | 101 | 'image_mini_id' => Yii::t('core', 'Image Mini'), |
102 | + 'type' => 'Тип Объекта для главной' | ||
97 | ]; | 103 | ]; |
98 | } | 104 | } |
99 | 105 |
console/migrations/m211110_133857_add_type_column_to_object_table.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +class m211110_133857_add_type_column_to_object_table extends Migration | ||
6 | +{ | ||
7 | + public function up() | ||
8 | + { | ||
9 | + $this->addColumn('object', 'type', $this->smallInteger()); | ||
10 | + } | ||
11 | + | ||
12 | + public function down() | ||
13 | + { | ||
14 | + $this->dropColumn('object', 'type'); | ||
15 | + } | ||
16 | +} |
frontend/controllers/SiteController.php
@@ -74,12 +74,35 @@ | @@ -74,12 +74,35 @@ | ||
74 | ) | 74 | ) |
75 | ->orderBy('id') | 75 | ->orderBy('id') |
76 | ->all(); | 76 | ->all(); |
77 | + $forCompanies = Objectkb::find() | ||
78 | + ->with('lang.alias') | ||
79 | + ->where( | ||
80 | + [ | ||
81 | + 'type' => Objectkb::TYPE_COMPANY | ||
82 | + ] | ||
83 | + ) | ||
84 | + ->orderBy('id') | ||
85 | + ->limit(4) | ||
86 | + ->all(); | ||
87 | + | ||
88 | + $forPrivate = Objectkb::find() | ||
89 | + ->with('lang.alias') | ||
90 | + ->where( | ||
91 | + [ | ||
92 | + 'type' => Objectkb::TYPE_PRIVATE | ||
93 | + ] | ||
94 | + ) | ||
95 | + ->orderBy('id') | ||
96 | + ->limit(4) | ||
97 | + ->all(); | ||
77 | 98 | ||
78 | return $this->render( | 99 | return $this->render( |
79 | 'index', | 100 | 'index', |
80 | [ | 101 | [ |
81 | 'slider' => $slider, | 102 | 'slider' => $slider, |
82 | - 'objects' => $objects, | 103 | + //'objects' => $objects, |
104 | + 'forCompanies'=>$forCompanies, | ||
105 | + 'forPrivate'=>$forPrivate | ||
83 | ] | 106 | ] |
84 | ); | 107 | ); |
85 | } | 108 | } |
frontend/views/site/index.php
@@ -111,106 +111,33 @@ | @@ -111,106 +111,33 @@ | ||
111 | </div> | 111 | </div> |
112 | </div> | 112 | </div> |
113 | <div class="row row-flex"> | 113 | <div class="row row-flex"> |
114 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
115 | - <div class="index-solution__item"> | ||
116 | - <a href="#" class="index-solution__item_img"> | ||
117 | - <!--540x240--> | ||
118 | - <img src="/img/new-index/solution/solution-1.jpg" alt=""> | ||
119 | - </a> | ||
120 | - <div class="index-solution__item_text"> | ||
121 | - <a href="#">Гібридна сонячна електростанція </br> для резервного живлення та продажу електроенергії по "зеленому" тарифу</a> | ||
122 | - <table> | ||
123 | - <tr> | ||
124 | - <td>5,0 кВт</td> | ||
125 | - <td> Номінальна потужність мережевого інвертора</td> | ||
126 | - </tr> | ||
127 | - <tr> | ||
128 | - <td>7,4 кВт</td> | ||
129 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
130 | - </tr> | ||
131 | - <tr> | ||
132 | - <td>8 094 $</td> | ||
133 | - <td>Вартість системи "під ключ"</td> | ||
134 | - </tr> | ||
135 | - </table> | ||
136 | - </div> | ||
137 | - </div> | ||
138 | - </div> | ||
139 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
140 | - <div class="index-solution__item"> | ||
141 | - <a href="#" class="index-solution__item_img"> | ||
142 | - <!--540x240--> | ||
143 | - <img src="/img/new-index/solution/solution-2.jpg" alt=""> | ||
144 | - </a> | ||
145 | - <div class="index-solution__item_text"> | ||
146 | - <a href="#">Мережева фотоелектрична станція </br> під «ЗЕЛЕНИЙ ТАРИФ»</a> | ||
147 | - <table> | ||
148 | - <tr> | ||
149 | - <td>5,0 кВт</td> | ||
150 | - <td> Номінальна потужність мережевого інвертора</td> | ||
151 | - </tr> | ||
152 | - <tr> | ||
153 | - <td>7,4 кВт</td> | ||
154 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
155 | - </tr> | ||
156 | - <tr> | ||
157 | - <td>8 094 $</td> | ||
158 | - <td>Вартість системи "під ключ"</td> | ||
159 | - </tr> | ||
160 | - </table> | ||
161 | - </div> | ||
162 | - </div> | ||
163 | - </div> | ||
164 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | 114 | + <?php foreach ($forPrivate as $object){ ?> |
115 | + <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
165 | <div class="index-solution__item"> | 116 | <div class="index-solution__item"> |
166 | - <a href="#" class="index-solution__item_img"> | ||
167 | - <!--540x240--> | ||
168 | - <img src="/img/new-index/solution/solution-3.jpg" alt=""> | ||
169 | - </a> | ||
170 | - <div class="index-solution__item_text"> | ||
171 | - <a href="#">Мережева фотоелектрична станція під «ЗЕЛЕНИЙ ТАРИФ» з врахуванням власного споживання електроенергії</a> | ||
172 | - <table> | ||
173 | - <tr> | ||
174 | - <td>10,0 кВт</td> | ||
175 | - <td> Номінальна потужність мережевого інвертора</td> | ||
176 | - </tr> | ||
177 | - <tr> | ||
178 | - <td>10,8 кВт</td> | ||
179 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
180 | - </tr> | ||
181 | - <tr> | ||
182 | - <td>5 078 $</td> | ||
183 | - <td>Вартість системи "під ключ"</td> | ||
184 | - </tr> | ||
185 | - </table> | ||
186 | - </div> | ||
187 | - </div> | ||
188 | - </div> | ||
189 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
190 | - <div class="index-solution__item"> | ||
191 | - <a href="#" class="index-solution__item_img"> | ||
192 | - <!--540x240--> | ||
193 | - <img src="/img/new-index/solution/solution-4.jpg" alt=""> | ||
194 | - </a> | ||
195 | - <div class="index-solution__item_text"> | ||
196 | - <a href="#">Мережева фотоелектрична станція під «ЗЕЛЕНИЙ ТАРИФ» з врахуванням власного споживання електроенергії</a> | ||
197 | - <table> | ||
198 | - <tr> | ||
199 | - <td>15,0 кВт</td> | ||
200 | - <td> Номінальна потужність мережевого інвертора</td> | ||
201 | - </tr> | ||
202 | - <tr> | ||
203 | - <td>15,3 кВт</td> | ||
204 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
205 | - </tr> | ||
206 | - <tr> | ||
207 | - <td>6 563 $</td> | ||
208 | - <td>Вартість системи "під ключ"</td> | ||
209 | - </tr> | ||
210 | - </table> | ||
211 | - </div> | ||
212 | - </div> | ||
213 | - </div> | 117 | + <a href="#" class="index-solution__item_img"> |
118 | + <!--540x240--> | ||
119 | + <img src="/img/new-index/solution/solution-5.jpg" alt=""> | ||
120 | + </a> | ||
121 | + <div class="index-solution__item_text"> | ||
122 | + <a href="#"><?=$object->lang->object_name ?></a> | ||
123 | + <table> | ||
124 | + <tr> | ||
125 | + <td>5,0 кВт</td> | ||
126 | + <td> Номінальна потужність мережевого інвертора</td> | ||
127 | + </tr> | ||
128 | + <tr> | ||
129 | + <td>7,4 кВт</td> | ||
130 | + <td>Встановлена потужність фотоелектричних модулів</td> | ||
131 | + </tr> | ||
132 | + <tr> | ||
133 | + <td>8 094 $</td> | ||
134 | + <td>Вартість системи "під ключ"</td> | ||
135 | + </tr> | ||
136 | + </table> | ||
137 | + </div> | ||
138 | + </div> | ||
139 | + </div> | ||
140 | + <?php } ?> | ||
214 | </div> | 141 | </div> |
215 | <div class="row row-flex justify-content-center"> | 142 | <div class="row row-flex justify-content-center"> |
216 | <div class="index-solution__more"> | 143 | <div class="index-solution__more"> |
@@ -298,6 +225,7 @@ | @@ -298,6 +225,7 @@ | ||
298 | </div> | 225 | </div> |
299 | </div> | 226 | </div> |
300 | <div class="row row-flex"> | 227 | <div class="row row-flex"> |
228 | + <?php foreach ($forCompanies as $object){ ?> | ||
301 | <div class="col-xs-12 col-sm-6 index-solution__col"> | 229 | <div class="col-xs-12 col-sm-6 index-solution__col"> |
302 | <div class="index-solution__item"> | 230 | <div class="index-solution__item"> |
303 | <a href="#" class="index-solution__item_img"> | 231 | <a href="#" class="index-solution__item_img"> |
@@ -305,7 +233,7 @@ | @@ -305,7 +233,7 @@ | ||
305 | <img src="/img/new-index/solution/solution-5.jpg" alt=""> | 233 | <img src="/img/new-index/solution/solution-5.jpg" alt=""> |
306 | </a> | 234 | </a> |
307 | <div class="index-solution__item_text"> | 235 | <div class="index-solution__item_text"> |
308 | - <a href="#">Гібридна сонячна електростанція </br> для резервного живлення та продажу електроенергії по "зеленому" тарифу</a> | 236 | + <a href="#"><?=$object->lang->object_name ?></a> |
309 | <table> | 237 | <table> |
310 | <tr> | 238 | <tr> |
311 | <td>5,0 кВт</td> | 239 | <td>5,0 кВт</td> |
@@ -323,81 +251,7 @@ | @@ -323,81 +251,7 @@ | ||
323 | </div> | 251 | </div> |
324 | </div> | 252 | </div> |
325 | </div> | 253 | </div> |
326 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
327 | - <div class="index-solution__item"> | ||
328 | - <a href="#" class="index-solution__item_img"> | ||
329 | - <!--540x240--> | ||
330 | - <img src="/img/new-index/solution/solution-6.jpg" alt=""> | ||
331 | - </a> | ||
332 | - <div class="index-solution__item_text"> | ||
333 | - <a href="#">Мережева фотоелектрична станція </br> під «ЗЕЛЕНИЙ ТАРИФ»</a> | ||
334 | - <table> | ||
335 | - <tr> | ||
336 | - <td>5,0 кВт</td> | ||
337 | - <td> Номінальна потужність мережевого інвертора</td> | ||
338 | - </tr> | ||
339 | - <tr> | ||
340 | - <td>7,4 кВт</td> | ||
341 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
342 | - </tr> | ||
343 | - <tr> | ||
344 | - <td>8 094 $</td> | ||
345 | - <td>Вартість системи "під ключ"</td> | ||
346 | - </tr> | ||
347 | - </table> | ||
348 | - </div> | ||
349 | - </div> | ||
350 | - </div> | ||
351 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
352 | - <div class="index-solution__item"> | ||
353 | - <a href="#" class="index-solution__item_img"> | ||
354 | - <!--540x240--> | ||
355 | - <img src="/img/new-index/solution/solution-7.jpg" alt=""> | ||
356 | - </a> | ||
357 | - <div class="index-solution__item_text"> | ||
358 | - <a href="#">Мережева фотоелектрична станція під «ЗЕЛЕНИЙ ТАРИФ» з врахуванням власного споживання електроенергії</a> | ||
359 | - <table> | ||
360 | - <tr> | ||
361 | - <td>10,0 кВт</td> | ||
362 | - <td> Номінальна потужність мережевого інвертора</td> | ||
363 | - </tr> | ||
364 | - <tr> | ||
365 | - <td>10,8 кВт</td> | ||
366 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
367 | - </tr> | ||
368 | - <tr> | ||
369 | - <td>5 078 $</td> | ||
370 | - <td>Вартість системи "під ключ"</td> | ||
371 | - </tr> | ||
372 | - </table> | ||
373 | - </div> | ||
374 | - </div> | ||
375 | - </div> | ||
376 | - <div class="col-xs-12 col-sm-6 index-solution__col"> | ||
377 | - <div class="index-solution__item"> | ||
378 | - <a href="#" class="index-solution__item_img"> | ||
379 | - <!--540x240--> | ||
380 | - <img src="/img/new-index/solution/solution-8.jpg" alt=""> | ||
381 | - </a> | ||
382 | - <div class="index-solution__item_text"> | ||
383 | - <a href="#">Мережева фотоелектрична станція під «ЗЕЛЕНИЙ ТАРИФ» з врахуванням власного споживання електроенергії</a> | ||
384 | - <table> | ||
385 | - <tr> | ||
386 | - <td>15,0 кВт</td> | ||
387 | - <td> Номінальна потужність мережевого інвертора</td> | ||
388 | - </tr> | ||
389 | - <tr> | ||
390 | - <td>15,3 кВт</td> | ||
391 | - <td>Встановлена потужність фотоелектричних модулів</td> | ||
392 | - </tr> | ||
393 | - <tr> | ||
394 | - <td>6 563 $</td> | ||
395 | - <td>Вартість системи "під ключ"</td> | ||
396 | - </tr> | ||
397 | - </table> | ||
398 | - </div> | ||
399 | - </div> | ||
400 | - </div> | 254 | + <?php } ?> |
401 | </div> | 255 | </div> |
402 | <div class="row row-flex justify-content-center"> | 256 | <div class="row row-flex justify-content-center"> |
403 | <div class="index-solution__more"> | 257 | <div class="index-solution__more"> |