Commit 95054735483f24257ff1557efc226e2aa9a78c25
Merge branch 'master' of gitlab.artweb.com.ua:steska/clinica into 5953b4f
# Conflicts: # frontend/views/layouts/main.php
Showing
12 changed files
with
355 additions
and
230 deletions
Show diff stats
common/config/main.php
frontend/assets/AppAsset.php
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | public $baseUrl = '@web'; |
14 | 14 | public $css = [ |
15 | 15 | 'css/style.css', |
16 | - '//fonts.googleapis.com/css?family=Ubuntu:400,500,700&subset=cyrillic,cyrillic-ext,latin-ext' | |
16 | +// '//fonts.googleapis.com/css?family=Ubuntu:400,500,700&subset=cyrillic,cyrillic-ext,latin-ext' | |
17 | 17 | ]; |
18 | 18 | public $js = [ |
19 | 19 | 'js/script.js', | ... | ... |
frontend/config/main.php
... | ... | @@ -192,7 +192,7 @@ |
192 | 192 | document.getElementById("comment-form").reset(); |
193 | 193 | var data = $("#comment-form").data(\'yiiActiveForm\'); |
194 | 194 | $("#comment-form").find(".submit-close-c-a span").click(); |
195 | - $("#comment-form").parent().parent().parent().find(".service-c-a-btns").after("<p>Ваш отзыв появиться после проверки модератором</p>") | |
195 | + $("#comment-form").parent().parent().parent().find(".service-c-a-btns").after("<p>Ваш отзыв появится после проверки модератором</p>") | |
196 | 196 | data.validated = false; |
197 | 197 | }', |
198 | 198 | ... | ... |
frontend/controllers/ServiceController.php
... | ... | @@ -20,14 +20,14 @@ |
20 | 20 | public function actionView($id){ |
21 | 21 | $model = $this->findModel($id); |
22 | 22 | if ($model->parent_id == null){ |
23 | - $others = Service::find()->where(['parent_id' => $model->id])->with('services.language.alias')->all(); | |
23 | + $others = Service::find()->where(['parent_id' => $model->id])->with(['services.language.alias', 'language.alias'])->all(); | |
24 | 24 | if (empty($others)){ |
25 | - $others = Service::find()->where(['parent_id' => null, 'status' => true])->all(); | |
25 | + $others = Service::find()->where(['parent_id' => null, 'status' => true])->with(['services.language.alias', 'language.alias'])->all(); | |
26 | 26 | } |
27 | 27 | }elseif ($model->level == 1){ |
28 | - $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services.language.alias')->all(); | |
28 | + $others = Service::find()->where(['parent_id' => $model->parent_id])->with(['services.language.alias', 'language.alias'])->all(); | |
29 | 29 | }else{ |
30 | - $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with('services.language.alias')->all(); | |
30 | + $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with(['services.language.alias', 'language.alias'])->all(); | |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
... | ... | @@ -82,13 +82,13 @@ |
82 | 82 | $model = Service::find() |
83 | 83 | ->where(['id' => $id, 'status' => true]) |
84 | 84 | ->with(['language.alias', 'prices' => function (ActiveQuery $query){ |
85 | - $query->where(['status' => true])->orderBy('sort'); | |
85 | + $query->where(['status' => true])->with('language')->orderBy('sort'); | |
86 | 86 | }, 'comments' => function (ActiveQuery $query){ |
87 | 87 | $query->where(['status' => true]); |
88 | 88 | }, 'questions' => function (ActiveQuery $query){ |
89 | 89 | $query->where(['status' => true])->with('doctor'); |
90 | 90 | },'packages' => function (ActiveQuery $query){ |
91 | - $query->with(['image', 'language'])->where(['status' => true]); | |
91 | + $query->with(['image', 'language.alias'])->where(['status' => true]); | |
92 | 92 | }])->one(); |
93 | 93 | if (empty($model)){ |
94 | 94 | throw new NotFoundHttpException('Model not found'); | ... | ... |
frontend/controllers/SiteController.php
1 | 1 | <?php |
2 | + | |
2 | 3 | namespace frontend\controllers; |
3 | 4 | |
4 | 5 | use artbox\core\models\Alias; |
... | ... | @@ -15,13 +16,11 @@ |
15 | 16 | use yii\db\ActiveQuery; |
16 | 17 | use yii\db\Expression; |
17 | 18 | use yii\filters\VerbFilter; |
18 | - use yii\helpers\ArrayHelper; | |
19 | 19 | use yii\helpers\Json; |
20 | 20 | use yii\swiftmailer\Mailer; |
21 | 21 | use yii\web\BadRequestHttpException; |
22 | 22 | use yii\web\Controller; |
23 | 23 | use yii\web\Response; |
24 | - use yii\helpers\VarDumper as d; | |
25 | 24 | |
26 | 25 | /** |
27 | 26 | * Site controller |
... | ... | @@ -62,34 +61,70 @@ |
62 | 61 | */ |
63 | 62 | public function actionIndex() |
64 | 63 | { |
65 | - $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->with('language.image')->all(); | |
66 | - $services = Service::find()->where(['is not' ,'image_id', NULL])->andWhere( | |
64 | + $slides = Slide::find() | |
65 | + ->with('language') | |
66 | + ->where([ 'status' => true ]) | |
67 | + ->orderBy('sort') | |
68 | + ->with('language.image') | |
69 | + ->all(); | |
70 | + $services = Service::find() | |
71 | + ->where( | |
72 | + [ | |
73 | + 'is not', | |
74 | + 'image_id', | |
75 | + null, | |
76 | + ] | |
77 | + ) | |
78 | + ->andWhere( | |
79 | + [ | |
80 | + 'status' => true, | |
81 | + 'level' => 0, | |
82 | + ] | |
83 | + ) | |
84 | + ->with( | |
85 | + [ | |
86 | + 'image', | |
87 | + 'language.alias', | |
88 | + 'services' => function (ActiveQuery $query) { | |
89 | + $query->where([ 'status' => true ]) | |
90 | + ->with([ 'language.alias' ]); | |
91 | + }, | |
92 | + ] | |
93 | + ) | |
94 | + ->orderBy([ new Expression('sort ASC NULLS LAST') ]) | |
95 | + ->all(); | |
96 | + $comments = Comment::find() | |
97 | + ->where( | |
98 | + [ | |
99 | + 'status' => true, | |
100 | + 'on_main' => true, | |
101 | + ] | |
102 | + ) | |
103 | + ->limit(6) | |
104 | + ->all(); | |
105 | + | |
106 | + $package = Package::find() | |
107 | + ->with( | |
108 | + [ | |
109 | + 'language.alias', | |
110 | + 'image', | |
111 | + ] | |
112 | + ) | |
113 | + ->where([ 'status' => true ]) | |
114 | + ->orderBy('sort') | |
115 | + ->limit(3) | |
116 | + ->all(); | |
117 | + $settings = Settings::getInstance(); | |
118 | + return $this->render( | |
119 | + 'index', | |
67 | 120 | [ |
68 | - 'status' => true, | |
69 | - 'level' => 0, | |
121 | + 'slides' => $slides, | |
122 | + 'services' => $services, | |
123 | + 'comments' => $comments, | |
124 | + 'settings' => $settings, | |
125 | + 'package' => $package, | |
70 | 126 | ] |
71 | - ) | |
72 | - ->with( | |
73 | - [ | |
74 | - 'image', | |
75 | - 'language.alias', | |
76 | - 'services' => function (ActiveQuery $query) { | |
77 | - $query->where(['status' => true])->with(['language.alias']); | |
78 | - }, | |
79 | - ] | |
80 | - )->orderBy([ new Expression('sort ASC NULLS LAST') ]) | |
81 | - ->all(); | |
82 | - $comments = Comment::find()->where(['status' => true, 'on_main' => true])->limit(6)->all(); | |
83 | - | |
84 | - $package = Package::find()->with(['language.alias'])->where(['status' => true])->orderBy('sort')->limit(3)->all(); | |
85 | - $settings = Settings::getInstance(); | |
86 | - return $this->render('index', [ | |
87 | - 'slides' => $slides, | |
88 | - 'services' => $services, | |
89 | - 'comments' => $comments, | |
90 | - 'settings' => $settings, | |
91 | - 'package' => $package | |
92 | - ]); | |
127 | + ); | |
93 | 128 | } |
94 | 129 | |
95 | 130 | /** |
... | ... | @@ -104,8 +139,8 @@ |
104 | 139 | return $this->render( |
105 | 140 | 'contact', |
106 | 141 | [ |
107 | - 'contact' => $contact, | |
108 | - 'settings' => $settings | |
142 | + 'contact' => $contact, | |
143 | + 'settings' => $settings, | |
109 | 144 | ] |
110 | 145 | ); |
111 | 146 | } |
... | ... | @@ -186,115 +221,157 @@ |
186 | 221 | } |
187 | 222 | } |
188 | 223 | } |
189 | - public function actionPrices(){ | |
190 | - $services = Service::find()->innerJoinWith(['prices' => function (ActiveQuery $query){ | |
191 | - $query->where(['price.status' => true]); | |
192 | - }])->all(); | |
224 | + public function actionPrices() | |
225 | + { | |
226 | + $services = Service::find() | |
227 | + ->innerJoinWith( | |
228 | + [ | |
229 | + 'prices' => function (ActiveQuery $query) { | |
230 | + $query->where([ 'price.status' => true ]) | |
231 | + ->with('language'); | |
232 | + }, | |
233 | + ] | |
234 | + ) | |
235 | + ->with('language.alias') | |
236 | + ->all(); | |
193 | 237 | |
194 | - return $this->render('prices', [ | |
195 | - 'services' => $services, | |
196 | - ]); | |
238 | + return $this->render( | |
239 | + 'prices', | |
240 | + [ | |
241 | + 'services' => $services, | |
242 | + ] | |
243 | + ); | |
197 | 244 | } |
198 | 245 | |
199 | - | |
200 | - public function actionPage1(){ | |
246 | + public function actionPage1() | |
247 | + { | |
201 | 248 | return $this->render('page1'); |
202 | 249 | } |
203 | - | |
204 | - public function actionPage2(){ | |
250 | + | |
251 | + public function actionPage2() | |
252 | + { | |
205 | 253 | return $this->render('page2'); |
206 | 254 | } |
207 | - | |
208 | - public function actionPage22(){ | |
255 | + | |
256 | + public function actionPage22() | |
257 | + { | |
209 | 258 | return $this->render('page2-2'); |
210 | 259 | } |
211 | - | |
212 | - public function actionPage23(){ | |
260 | + | |
261 | + public function actionPage23() | |
262 | + { | |
213 | 263 | return $this->render('page2-3'); |
214 | 264 | } |
215 | - | |
216 | - public function actionPage3(){ | |
265 | + | |
266 | + public function actionPage3() | |
267 | + { | |
217 | 268 | return $this->render('page3'); |
218 | 269 | } |
219 | - | |
220 | - public function actionPage4(){ | |
270 | + | |
271 | + public function actionPage4() | |
272 | + { | |
221 | 273 | return $this->render('page4'); |
222 | 274 | } |
223 | - | |
224 | - public function actionPage5(){ | |
275 | + | |
276 | + public function actionPage5() | |
277 | + { | |
225 | 278 | return $this->render('page5'); |
226 | 279 | } |
227 | - | |
228 | - public function actionPage6(){ | |
280 | + | |
281 | + public function actionPage6() | |
282 | + { | |
229 | 283 | return $this->render('page6'); |
230 | 284 | } |
231 | - | |
232 | 285 | |
233 | - | |
234 | 286 | # Вопрос/ответ |
235 | - public function actionQuestions($service_id = null){ | |
287 | + public function actionQuestions($service_id = null) | |
288 | + { | |
236 | 289 | Language::getCurrent(); |
237 | 290 | |
238 | - if (\Yii::$app->request->isAjax){ | |
291 | + if (\Yii::$app->request->isAjax) { | |
239 | 292 | Yii::$app->response->format = Response::FORMAT_JSON; |
240 | 293 | $model = new Question(); |
241 | 294 | $model->scenario = Question::SCENARIO_QUESTION; |
242 | - if ($model->load(\Yii::$app->request->post()) and $model->save()){ | |
295 | + if ($model->load(\Yii::$app->request->post()) and $model->save()) { | |
243 | 296 | return [ |
244 | - 'status' => true, | |
245 | - 'message' => 'Спасибо за Ваш вопрос' | |
297 | + 'status' => true, | |
298 | + 'message' => 'Спасибо за Ваш вопрос', | |
246 | 299 | ]; |
247 | - }else{ | |
300 | + } else { | |
248 | 301 | return [ |
249 | - 'status' => false, | |
250 | - 'message' => 'Ошибка' | |
302 | + 'status' => false, | |
303 | + 'message' => 'Ошибка', | |
251 | 304 | ]; |
252 | 305 | } |
253 | 306 | } |
254 | - $dataProvider = new ActiveDataProvider([ | |
255 | - 'query' => Question::find()->where(['status' => true])->andFilterWhere(['service_id' => $service_id])->with(['doctor.language']), | |
256 | - 'pagination' => [ | |
257 | - 'pageSize' => 10, | |
258 | - ], | |
259 | - ]); | |
260 | - $services = Service::find()->where(['status' => true])->andWhere(['parent_id' => null])->all(); | |
307 | + $dataProvider = new ActiveDataProvider( | |
308 | + [ | |
309 | + 'query' => Question::find() | |
310 | + ->where([ 'status' => true ]) | |
311 | + ->andFilterWhere([ 'service_id' => $service_id ]) | |
312 | + ->with([ 'doctor.language' ]), | |
313 | + 'pagination' => [ | |
314 | + 'pageSize' => 10, | |
315 | + ], | |
316 | + ] | |
317 | + ); | |
318 | + $services = Service::find() | |
319 | + ->where([ 'status' => true ]) | |
320 | + ->andWhere([ 'parent_id' => null ]) | |
321 | + ->with('language') | |
322 | + ->all(); | |
261 | 323 | $route = []; |
262 | - foreach ($services as $service){ | |
263 | - $route[] = Json::encode(['site/questions', 'service_id' => $service->id]); | |
324 | + foreach ($services as $service) { | |
325 | + $route[] = Json::encode( | |
326 | + [ | |
327 | + 'site/questions', | |
328 | + 'service_id' => $service->id, | |
329 | + ] | |
330 | + ); | |
264 | 331 | } |
265 | 332 | $route [] = '{"0":"site/questions"}'; |
266 | - $alias = Alias::find()->where(['route' => $route])->andWhere(['language_id' => Language::getCurrent()->id])->indexBy('route')->asArray()->all(); | |
267 | - return $this->render('questions', [ | |
268 | - 'dataProvider' => $dataProvider, | |
269 | - 'services' => $services, | |
270 | - 'service_id' => $service_id, | |
271 | - 'alias' => $alias | |
272 | - ]); | |
333 | + $alias = Alias::find() | |
334 | + ->where([ 'route' => $route ]) | |
335 | + ->andWhere([ 'language_id' => Language::getCurrent()->id ]) | |
336 | + ->indexBy('route') | |
337 | + ->asArray() | |
338 | + ->all(); | |
339 | + return $this->render( | |
340 | + 'questions', | |
341 | + [ | |
342 | + 'dataProvider' => $dataProvider, | |
343 | + 'services' => $services, | |
344 | + 'service_id' => $service_id, | |
345 | + 'alias' => $alias, | |
346 | + ] | |
347 | + ); | |
273 | 348 | } |
274 | - | |
275 | - public function actionComments($service_id = null){ | |
276 | - | |
277 | - if (\Yii::$app->request->isAjax){ | |
349 | + | |
350 | + public function actionComments($service_id = null) | |
351 | + { | |
352 | + | |
353 | + if (\Yii::$app->request->isAjax) { | |
278 | 354 | Yii::$app->response->format = Response::FORMAT_JSON; |
279 | 355 | $model = new Comment(); |
280 | 356 | #if ($model->load(\Yii::$app->request->post()) and $model->save()){ |
281 | - if ($model->load(\Yii::$app->request->post())){ | |
282 | - if(!$model->entity_id)$model->entity_id=0; | |
283 | - $model->entity=Service::className(); | |
357 | + if ($model->load(\Yii::$app->request->post())) { | |
358 | + if (!$model->entity_id) { | |
359 | + $model->entity_id = 0; | |
360 | + } | |
361 | + $model->entity = Service::className(); | |
284 | 362 | $model->save(); |
285 | 363 | return [ |
286 | - 'status' => true, | |
287 | - 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появиться на сайте' | |
364 | + 'status' => true, | |
365 | + 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появится на сайте', | |
288 | 366 | ]; |
289 | - }else{ | |
367 | + } else { | |
290 | 368 | return [ |
291 | - 'status' => false, | |
292 | - 'message' => 'Ошибка' | |
369 | + 'status' => false, | |
370 | + 'message' => 'Ошибка', | |
293 | 371 | ]; |
294 | 372 | } |
295 | 373 | } |
296 | - | |
297 | - | |
374 | + | |
298 | 375 | # подкоректировал логику для сохранрения в БД/выдачи вопросов с категории "Общие вопросы" |
299 | 376 | # закрепил за ними entity_id=0 |
300 | 377 | if($service_id==null)$service_id=0; | ... | ... |
frontend/microdata/MicrodataFabric.php
1 | 1 | <?php |
2 | -namespace frontend\microdata; | |
3 | - | |
4 | -use frontend\microdata\Microdata; | |
5 | - | |
6 | - | |
7 | - | |
8 | - | |
9 | -class MicrodataFabric extends Microdata | |
10 | -{ | |
11 | - public static function createJsonFromProduct($product) | |
2 | + | |
3 | + namespace frontend\microdata; | |
4 | + | |
5 | + use frontend\microdata\Microdata; | |
6 | + | |
7 | + class MicrodataFabric extends Microdata | |
12 | 8 | { |
13 | - return ($product==null)? | |
14 | - new ProductMicrodata(array_merge(['url'=>123],self::getDefaultSettings())) | |
15 | - : | |
16 | - new ProductMicrodata(array_merge($product,['url'=>123],self::getDefaultSettings())); | |
17 | - } | |
18 | - public static function createJsonFromArticle($article=null) | |
19 | - { | |
20 | - | |
21 | - return ($article==null)? | |
22 | - new ArticleMicrodata(array_merge(['url'=>123],self::getDefaultSettings())) | |
23 | - : | |
24 | - new ArticleMicrodata(array_merge($article,['url'=>123],self::getDefaultSettings())); | |
25 | - } | |
26 | - public static function createJsonFromOrganization($article=null) | |
27 | - { | |
28 | - | |
29 | - return ($article==null)? | |
30 | - new OrganizationMicrodata(array_merge(self::getDefaultSettings())) | |
31 | - : | |
32 | - #die(var_dump(self::getDefaultSettings())); | |
33 | - #die(var_dump(array_merge($article,self::getDefaultSettings()))); | |
34 | - new OrganizationMicrodata(array_merge($article, | |
35 | - self::getDefaultSettings())); | |
36 | - } | |
37 | - | |
38 | - | |
39 | - | |
40 | - | |
41 | - | |
42 | - | |
43 | - protected static function getDefaultSettings(){ | |
44 | - return [ | |
45 | - 'context'=>"http://schema.org", | |
46 | - | |
47 | - ]; | |
48 | - | |
49 | - | |
50 | - | |
51 | - } | |
52 | - | |
53 | -} | |
54 | 9 | \ No newline at end of file |
10 | + public static function createJsonFromProduct($product) | |
11 | + { | |
12 | + return ( $product == null ) ? new ProductMicrodata( | |
13 | + array_merge([ 'url' => 123 ], self::getDefaultSettings()) | |
14 | + ) : new ProductMicrodata(array_merge($product, [ 'url' => 123 ], self::getDefaultSettings())); | |
15 | + } | |
16 | + public static function createJsonFromArticle($article = null) | |
17 | + { | |
18 | + | |
19 | + return ( $article == null ) ? new ArticleMicrodata( | |
20 | + array_merge([ 'url' => 123 ], self::getDefaultSettings()) | |
21 | + ) : new ArticleMicrodata(array_merge($article, [ 'url' => 123 ], self::getDefaultSettings())); | |
22 | + } | |
23 | + public static function createJsonFromOrganization($article = null) | |
24 | + { | |
25 | + | |
26 | + return ( $article == null ) ? new OrganizationMicrodata( | |
27 | + array_merge(self::getDefaultSettings()) | |
28 | + ) : #die(var_dump(self::getDefaultSettings())); | |
29 | + #die(var_dump(array_merge($article,self::getDefaultSettings()))); | |
30 | + new OrganizationMicrodata( | |
31 | + array_merge( | |
32 | + $article, | |
33 | + self::getDefaultSettings() | |
34 | + ) | |
35 | + ); | |
36 | + } | |
37 | + | |
38 | + protected static function getDefaultSettings() | |
39 | + { | |
40 | + return [ | |
41 | + 'context' => "http://schema.org", | |
42 | + | |
43 | + ]; | |
44 | + | |
45 | + } | |
46 | + | |
47 | + } | |
55 | 48 | \ No newline at end of file | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -55,7 +55,14 @@ |
55 | 55 | [ |
56 | 56 | 'language.alias', |
57 | 57 | 'services' => function (ActiveQuery $query) { |
58 | - $query->where(['status' => true])->with(['language.alias']); | |
58 | + $query->where(['status' => true])->with( | |
59 | + [ | |
60 | + 'language.alias', | |
61 | + 'services' => function (ActiveQuery $query) { | |
62 | + $query->where(['status' => true])->with(['language.alias']); | |
63 | + }, | |
64 | + ] | |
65 | + ); | |
59 | 66 | }, |
60 | 67 | ] |
61 | 68 | )->orderBy('sort') |
... | ... | @@ -133,39 +140,56 @@ $this->registerMetaTag( |
133 | 140 | <?php $this->beginPage() ?> |
134 | 141 | <!DOCTYPE html > |
135 | 142 | <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>"> |
136 | - <head> | |
143 | + <head> | |
144 | + | |
145 | + <script type="text/javascript"> | |
146 | + WebFontConfig = { | |
147 | + google: {families: [ 'Ubuntu:400,500,700' ]} | |
148 | + }; | |
149 | + (function() { | |
150 | + var wf = document.createElement('script'); | |
151 | + wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js'; | |
152 | + wf.type = 'text/javascript'; | |
153 | + wf.async = 'true'; | |
154 | + var s = document.getElementsByTagName('script')[ 0 ]; | |
155 | + s.parentNode.insertBefore(wf, s); | |
156 | + })(); </script> | |
157 | + | |
158 | + <script> | |
137 | 159 | |
138 | - <meta charset="utf-8"> | |
139 | 160 | <!-- Global site tag (gtag.js) - Google Analytics --> |
140 | 161 | <script async src="https://www.googletagmanager.com/gtag/js?id=UA-120861020-1"></script> |
141 | - <script> | |
142 | - window.dataLayer = window.dataLayer || []; | |
143 | - function gtag(){dataLayer.push(arguments);} | |
144 | - gtag('js', new Date()); | |
145 | - | |
146 | - gtag('config', 'UA-120861020-1'); | |
147 | - </script> | |
148 | - <!-- Google Tag Manager --> | |
149 | - <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
150 | - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
151 | - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
152 | - 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
153 | - })(window,document,'script','dataLayer','GTM-N6R7982');</script> | |
154 | - <!-- End Google Tag Manager --> | |
155 | - <meta charset="<?= \Yii::$app->charset ?>"> | |
156 | - <meta name="viewport" content="width=device-width"> | |
157 | - <link type="image/x-icon" href="favicon.ico" rel="icon"> | |
158 | - <?= Html::csrfMetaTags() ?> | |
159 | - <title><?=Html::encode($seo->title)?></title> | |
160 | - <div class="row"> | |
161 | - <?php $this->head() ?> | |
162 | - </head> | |
162 | + <script> | |
163 | + window.dataLayer = window.dataLayer || []; | |
164 | + function gtag(){dataLayer.push(arguments);} | |
165 | + gtag('js', new Date()); | |
166 | + | |
167 | + gtag('config', 'UA-120861020-1'); | |
168 | + </script> | |
169 | + <!-- Google Tag Manager --> | |
170 | + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
171 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
172 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
173 | + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
174 | + })(window,document,'script','dataLayer','GTM-N6R7982');</script> | |
175 | + <!-- End Google Tag Manager --> | |
176 | + <meta charset="<?= \Yii::$app->charset ?>"> | |
177 | + <meta name="viewport" content="width=device-width"> | |
178 | + <link type="image/x-icon" href="favicon.ico" rel="icon"> | |
179 | + <?= Html::csrfMetaTags() ?> | |
180 | + <title><?=Html::encode($seo->title)?></title> | |
181 | + <?php $this->head() ?> | |
182 | + </head> | |
163 | 183 | <body id="body"> |
164 | 184 | <!-- Google Tag Manager (noscript) --> |
165 | 185 | <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982" |
166 | 186 | height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> |
167 | 187 | <!-- End Google Tag Manager (noscript) --> |
168 | 188 | <?php $this->beginBody() ?> |
189 | + <!-- Google Tag Manager (noscript) --> | |
190 | + <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982" | |
191 | + height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | |
192 | + <!-- End Google Tag Manager (noscript) --> | |
169 | 193 | <div class="transition-loader"> |
170 | 194 | <div class="transition-loader-inner"> |
171 | 195 | <label></label> |
... | ... | @@ -283,41 +307,14 @@ $this->registerMetaTag( |
283 | 307 | 'url' => Url::to(['package/index']), |
284 | 308 | ]; |
285 | 309 | |
286 | - # определяю, кому из итемов присвоить class="active' | |
287 | - $itemKey=0; | |
288 | - $test=[]; | |
289 | - foreach ($items as $key => $item) | |
290 | - { | |
291 | - | |
292 | - if(strpos(\Yii::$app->request->url,$item['url'])!==false ) | |
293 | - { | |
294 | - $test[$key]['label']=$item['label']; | |
295 | - $test[$key]['options'] = [ 'class' => 'active' ]; | |
296 | - $test[$key]['url']= false; | |
297 | - | |
298 | - | |
299 | - } | |
300 | - elseif( \Yii::$app->request->url=='/' && $item['label']==\Yii::t('app', 'Prices')) | |
301 | - { | |
302 | - $test[$key]['label']=$item['label']; | |
303 | - $test[$key]['options'] = [ 'class' => 'active' ]; | |
304 | - $test[$key]['url']= Url::to(['site/prices']); | |
305 | 310 | |
306 | - } | |
307 | - else | |
308 | - { | |
309 | - $test[$key]['label']=$item['label']; | |
310 | - $test[$key]['url']=$item['url']; | |
311 | - } | |
312 | - | |
313 | - } | |
314 | 311 | |
315 | 312 | |
316 | 313 | ?> |
317 | 314 | |
318 | 315 | <?php echo Nav::widget( |
319 | 316 | [ |
320 | - 'items' => $test, | |
317 | + 'items' => $items, | |
321 | 318 | 'activateItems' => false, |
322 | 319 | ] |
323 | 320 | ); ?> | ... | ... |
frontend/views/package/view.php
... | ... | @@ -4,10 +4,21 @@ |
4 | 4 | * @var \yii\web\View $this; |
5 | 5 | */ |
6 | 6 | use common\models\Package; |
7 | + use yii\web\View; | |
8 | + | |
7 | 9 | $seo = \Yii::$app->get('seo'); |
8 | 10 | $this->params[ 'entity'] = Package::className(); |
9 | 11 | $this->params['entity_id'] = $package->id; |
10 | 12 | $this->params['breadcrumbs'][] = (!empty($seo->h1)) ? $seo->h1 :$package->title; |
13 | + | |
14 | + $js = <<<JS | |
15 | + $(document).on('beforeSubmit', '#visit-form', function() { | |
16 | + dataLayer.push({'event': 'formsend_package'}); | |
17 | + console.log('push'); | |
18 | + return true; | |
19 | + }); | |
20 | +JS; | |
21 | + $this->registerJs($js, View::POS_LOAD); | |
11 | 22 | ?> |
12 | 23 | |
13 | 24 | ... | ... |
frontend/views/service/view.php
... | ... | @@ -9,11 +9,11 @@ |
9 | 9 | */ |
10 | 10 | use artbox\core\helpers\ImageHelper; |
11 | 11 | use artbox\core\helpers\Url; |
12 | - use common\models\Service; | |
13 | 12 | use artbox\core\models\Alias; |
14 | - use artbox\core\models\Language; | |
15 | - | |
16 | - | |
13 | + use common\models\Language; | |
14 | + use common\models\Service; | |
15 | + use yii\web\View; | |
16 | + | |
17 | 17 | $seo = \Yii::$app->get('seo'); |
18 | 18 | $this->params['entity'] = Service::className(); |
19 | 19 | $this->params['entity_id'] = $model->id; |
... | ... | @@ -49,7 +49,53 @@ |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | + | |
52 | 53 | $aliases = Alias::find()->where(['route' => '{"0":"site/questions"}'])->indexBy('route')->andWhere(['language_id' => Language::getCurrent()->id])->asArray()->all(); |
54 | + | |
55 | + | |
56 | + $js = <<<JS | |
57 | + $(document).on('beforeSubmit', '#comment-form', function() { | |
58 | + dataLayer.push({'event': 'formsend_review'}); | |
59 | + console.log('push'); | |
60 | + return true; | |
61 | + }); | |
62 | + | |
63 | +$(document).on('beforeSubmit', '#question-form', function() { | |
64 | + dataLayer.push({'event': 'formsend_question'}); | |
65 | + console.log('push'); | |
66 | + return true; | |
67 | + }); | |
68 | + | |
69 | + | |
70 | + $(document).on('beforeSubmit', '#visit-form', function() { | |
71 | + var service_id = {$model->id}; | |
72 | + var parent_id = {$model->parent_id}; | |
73 | + if (service_id == 4 || parent_id == 4){ | |
74 | + window.dataLayer.push({'event': 'formsend_dermatologiya'}); | |
75 | + } | |
76 | + if (service_id == 16 || parent_id == 16){ | |
77 | + dataLayer.push({'event': 'formsend_vedenie-beremennosti'}); | |
78 | + } | |
79 | + if (service_id == 22 || parent_id == 22){ | |
80 | + dataLayer.push({'event': 'formsend_lechenie-besplodiya'}); | |
81 | + } | |
82 | + if (service_id == 21 || parent_id == 21){ | |
83 | + dataLayer.push({'event': 'formsend_labioplastika'}); | |
84 | + } | |
85 | + if (service_id == 19 || parent_id == 19){ | |
86 | + dataLayer.push({'event': 'formsend_zabolevaniya-sheyki-matki'}); | |
87 | + } | |
88 | + if (service_id == 20 || parent_id == 20){ | |
89 | + dataLayer.push({'event': 'formsend_polovye-infekcii'}); | |
90 | + } | |
91 | + console.log('push'); | |
92 | + return true; | |
93 | + }); | |
94 | +JS; | |
95 | + | |
96 | + $this->registerJs($js, View::POS_LOAD); | |
97 | + | |
98 | + | |
53 | 99 | $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; |
54 | 100 | ?> |
55 | 101 | <?=$microdata;?> | ... | ... |
frontend/views/site/index.php
... | ... | @@ -76,7 +76,7 @@ JS; |
76 | 76 | <!--размер img 1920x556--> |
77 | 77 | <?=ImageHelper::set($slide->language->image->getPath()) |
78 | 78 | ->cropResize(1920, 556) |
79 | - ->quality(84) | |
79 | + ->quality(82) | |
80 | 80 | ->renderImage()?> |
81 | 81 | </a> |
82 | 82 | </div> |
... | ... | @@ -98,9 +98,8 @@ JS; |
98 | 98 | <!--263x146px--> |
99 | 99 | <?=ImageHelper::set($service->image->getPath()) |
100 | 100 | ->cropResize(263, 146) |
101 | - ->quality(84) | |
102 | - ->renderImage(['alt'=>ucfirst($service->title).' - Консультация врача и лечение заболеваний', | |
103 | - 'title'=>ucfirst($service->title).' - Консультация врача и лечение заболеваний'])?> | |
101 | + ->quality(82) | |
102 | + ->renderImage()?> | |
104 | 103 | </div> |
105 | 104 | <div class="style categories-home-links-wr"> |
106 | 105 | <div class="style categories-home-links-title"> |
... | ... | @@ -162,16 +161,14 @@ JS; |
162 | 161 | <div class="row"> |
163 | 162 | <?php foreach ($package as $item){?> |
164 | 163 | <div class="col-xs-12 col-sm-4 package-offers-wr"> |
165 | - <a href="<?=Url::to(['alias' => $item->alias])?>"> | |
166 | - <div class="img"> | |
167 | - <?php #die(var_dump($item->language->attributes)); ?> | |
168 | - <?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) | |
164 | + <a href="<?=Url::to(['alias' => $item->language->alias])?>"> | |
165 | + <div class="img"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) | |
169 | 166 | ->cropResize(388, 240) |
170 | - ->quality(84) | |
167 | + ->quality(82) | |
171 | 168 | ->renderImage()?></div> |
172 | 169 | <div class="rotate"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) |
173 | 170 | ->cropResize(388, 240) |
174 | - ->quality(84) | |
171 | + ->quality(82) | |
175 | 172 | ->renderImage()?></div> |
176 | 173 | <p><?=$item->title?></p> |
177 | 174 | <span class="btn_"><?=\Yii::t('app','Buy')?></span> | ... | ... |
frontend/web/js/script.js
... | ... | @@ -143,24 +143,21 @@ $(document).ready(function() { |
143 | 143 | }) |
144 | 144 | |
145 | 145 | } |
146 | - | |
146 | + | |
147 | 147 | |
148 | 148 | |
149 | 149 | function phoneMask() { |
150 | 150 | var phoneInput = '.phones_mask input' |
151 | 151 | |
152 | - if($('body').find('.phones_mask').find('input').length>0){ | |
153 | - $(phoneInput).mask('(000) 000-00-00',{placeholder:'(0__)___-__-__'}); | |
152 | + if($('body').find(phoneInput).length>0){ | |
153 | + $(phoneInput).mask('+38(000)000-00-00',{placeholder:'+38(000)000-00-00'}); | |
154 | 154 | $(phoneInput).focus(function () { |
155 | - | |
156 | - var text = $(this).val(); | |
157 | - $(this).val(text); | |
158 | - if(($(this).val())== '') {$(this).val('(0')} | |
159 | - }); | |
155 | + if(($(this).val())== '') {$(this).val('+38(0')} | |
156 | + }) | |
160 | 157 | $(phoneInput).focusout(function () { |
161 | 158 | var phoneVal = $(this).val() |
162 | 159 | //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')} |
163 | - if(phoneVal.length <15) {$(this).val('')} | |
160 | + if(phoneVal.length <17) {$(this).val('')} | |
164 | 161 | }) |
165 | 162 | } |
166 | 163 | } |
... | ... | @@ -381,7 +378,7 @@ $(document).ready(function() { |
381 | 378 | $('.categories-home .img').click(function () { |
382 | 379 | var link = $(this).parent().find('.categories-home-links-title a').attr('href'); |
383 | 380 | document.location.href = link; |
384 | - }) | |
381 | + }); | |
385 | 382 | var scrollPos = $(window).scrollTop(); |
386 | 383 | var windHeight = $(window).height(); |
387 | 384 | var bl = $('.section-box-2'); |
... | ... | @@ -460,6 +457,13 @@ $(document).ready(function() { |
460 | 457 | var form = $(this); |
461 | 458 | var id = form.attr('id'); |
462 | 459 | var url = form.attr('action'); |
460 | + if (id == 'total_question_form'){ | |
461 | + dataLayer.push({'event': 'formsend_question'}); | |
462 | + console.log('formsend_question'); | |
463 | + }else{ | |
464 | + dataLayer.push({'event': 'formsend_review'}); | |
465 | + console.log('formsend_review'); | |
466 | + } | |
463 | 467 | $.post( |
464 | 468 | $(this).attr("action"), $(this).serialize(), function(data) { |
465 | 469 | document.getElementById(id).reset(); | ... | ... |
No preview for this file type