Commit 7832919c344e8ae3bebfbb117b5a2c8ca6c7f01c
1 parent
c805c469
-Ready
Showing
12 changed files
with
468 additions
and
348 deletions
Show diff stats
1.44 KB
composer.json
@@ -31,7 +31,8 @@ | @@ -31,7 +31,8 @@ | ||
31 | "bower-asset/amcharts-stock": "@dev", | 31 | "bower-asset/amcharts-stock": "@dev", |
32 | "speixoto/yii2-amcharts": "^0.1.1", | 32 | "speixoto/yii2-amcharts": "^0.1.1", |
33 | "2amigos/yii2-tinymce-widget": "~1.1", | 33 | "2amigos/yii2-tinymce-widget": "~1.1", |
34 | - "kartik-v/yii2-widget-select2": "@dev" | 34 | + "kartik-v/yii2-widget-select2": "@dev", |
35 | + "phpmailer/phpmailer": "^5.2" | ||
35 | }, | 36 | }, |
36 | "require-dev": { | 37 | "require-dev": { |
37 | "yiisoft/yii2-debug": "~2.0.0", | 38 | "yiisoft/yii2-debug": "~2.0.0", |
composer.lock
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
5 | "This file is @generated automatically" | 5 | "This file is @generated automatically" |
6 | ], | 6 | ], |
7 | - "hash": "b9f0c4f1da5a4f2f939a03b55e9fc2c7", | ||
8 | - "content-hash": "1ad205bd41e4dfbc52bad09c7e6c1677", | 7 | + "hash": "c4717cdb9e018120896d37d79340e280", |
8 | + "content-hash": "81a62fa9cc9a08418dec4f3396afeec0", | ||
9 | "packages": [ | 9 | "packages": [ |
10 | { | 10 | { |
11 | "name": "2amigos/yii2-tinymce-widget", | 11 | "name": "2amigos/yii2-tinymce-widget", |
@@ -1645,6 +1645,82 @@ | @@ -1645,6 +1645,82 @@ | ||
1645 | "time": "2016-11-29 18:17:37" | 1645 | "time": "2016-11-29 18:17:37" |
1646 | }, | 1646 | }, |
1647 | { | 1647 | { |
1648 | + "name": "phpmailer/phpmailer", | ||
1649 | + "version": "v5.2.23", | ||
1650 | + "source": { | ||
1651 | + "type": "git", | ||
1652 | + "url": "https://github.com/PHPMailer/PHPMailer.git", | ||
1653 | + "reference": "7115df4a6f76281109ebe352900c42403b728bb4" | ||
1654 | + }, | ||
1655 | + "dist": { | ||
1656 | + "type": "zip", | ||
1657 | + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/7115df4a6f76281109ebe352900c42403b728bb4", | ||
1658 | + "reference": "7115df4a6f76281109ebe352900c42403b728bb4", | ||
1659 | + "shasum": "" | ||
1660 | + }, | ||
1661 | + "require": { | ||
1662 | + "php": ">=5.0.0" | ||
1663 | + }, | ||
1664 | + "require-dev": { | ||
1665 | + "doctrine/annotations": "1.2.*", | ||
1666 | + "jms/serializer": "0.16.*", | ||
1667 | + "phpdocumentor/phpdocumentor": "2.*", | ||
1668 | + "phpunit/phpunit": "4.8.*", | ||
1669 | + "symfony/debug": "2.8.*", | ||
1670 | + "symfony/filesystem": "2.8.*", | ||
1671 | + "symfony/translation": "2.8.*", | ||
1672 | + "symfony/yaml": "2.8.*", | ||
1673 | + "zendframework/zend-cache": "2.5.1", | ||
1674 | + "zendframework/zend-config": "2.5.1", | ||
1675 | + "zendframework/zend-eventmanager": "2.5.1", | ||
1676 | + "zendframework/zend-filter": "2.5.1", | ||
1677 | + "zendframework/zend-i18n": "2.5.1", | ||
1678 | + "zendframework/zend-json": "2.5.1", | ||
1679 | + "zendframework/zend-math": "2.5.1", | ||
1680 | + "zendframework/zend-serializer": "2.5.*", | ||
1681 | + "zendframework/zend-servicemanager": "2.5.*", | ||
1682 | + "zendframework/zend-stdlib": "2.5.1" | ||
1683 | + }, | ||
1684 | + "suggest": { | ||
1685 | + "league/oauth2-google": "Needed for Google XOAUTH2 authentication" | ||
1686 | + }, | ||
1687 | + "type": "library", | ||
1688 | + "autoload": { | ||
1689 | + "classmap": [ | ||
1690 | + "class.phpmailer.php", | ||
1691 | + "class.phpmaileroauth.php", | ||
1692 | + "class.phpmaileroauthgoogle.php", | ||
1693 | + "class.smtp.php", | ||
1694 | + "class.pop3.php", | ||
1695 | + "extras/EasyPeasyICS.php", | ||
1696 | + "extras/ntlm_sasl_client.php" | ||
1697 | + ] | ||
1698 | + }, | ||
1699 | + "notification-url": "https://packagist.org/downloads/", | ||
1700 | + "license": [ | ||
1701 | + "LGPL-2.1" | ||
1702 | + ], | ||
1703 | + "authors": [ | ||
1704 | + { | ||
1705 | + "name": "Jim Jagielski", | ||
1706 | + "email": "jimjag@gmail.com" | ||
1707 | + }, | ||
1708 | + { | ||
1709 | + "name": "Marcus Bointon", | ||
1710 | + "email": "phpmailer@synchromedia.co.uk" | ||
1711 | + }, | ||
1712 | + { | ||
1713 | + "name": "Andy Prevost", | ||
1714 | + "email": "codeworxtech@users.sourceforge.net" | ||
1715 | + }, | ||
1716 | + { | ||
1717 | + "name": "Brent R. Matzelle" | ||
1718 | + } | ||
1719 | + ], | ||
1720 | + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", | ||
1721 | + "time": "2017-03-15 19:32:56" | ||
1722 | + }, | ||
1723 | + { | ||
1648 | "name": "phpseclib/phpseclib", | 1724 | "name": "phpseclib/phpseclib", |
1649 | "version": "2.0.4", | 1725 | "version": "2.0.4", |
1650 | "source": { | 1726 | "source": { |
frontend/assets/MapAsset.php
@@ -15,7 +15,8 @@ | @@ -15,7 +15,8 @@ | ||
15 | public $baseUrl = '@web'; | 15 | public $baseUrl = '@web'; |
16 | public $css = []; | 16 | public $css = []; |
17 | public $js = [ | 17 | public $js = [ |
18 | - '//maps.googleapis.com/maps/api/js?key=AIzaSyCoR1Jb-mIFUjPwKiuSlmtYBEwnJOBnAgg&callback=initMap', | 18 | + '//maps.googleapis.com/maps/api/js?key=AIzaSyCoR1Jb-mIFUjPwKiuSlmtYBEwnJOBnAgg&callback', |
19 | + 'js/gmaps.js', | ||
19 | 'js/gmaps.init.js', | 20 | 'js/gmaps.init.js', |
20 | ]; | 21 | ]; |
21 | public $depends = [ | 22 | public $depends = [ |
frontend/controllers/SiteController.php
@@ -101,11 +101,12 @@ | @@ -101,11 +101,12 @@ | ||
101 | public function actionFeedback() | 101 | public function actionFeedback() |
102 | { | 102 | { |
103 | Yii::$app->response->format = Response::FORMAT_JSON; | 103 | Yii::$app->response->format = Response::FORMAT_JSON; |
104 | - if (empty( Yii::$app->request->post() )) { | 104 | + if (empty(Yii::$app->request->post())) { |
105 | throw new BadRequestHttpException(); | 105 | throw new BadRequestHttpException(); |
106 | } else { | 106 | } else { |
107 | $model = new Feedback(); | 107 | $model = new Feedback(); |
108 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 108 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
109 | + $this->sendFeedback($model); | ||
109 | return [ | 110 | return [ |
110 | 'success' => true, | 111 | 'success' => true, |
111 | 'message' => 'Success message', | 112 | 'message' => 'Success message', |
@@ -124,4 +125,35 @@ | @@ -124,4 +125,35 @@ | ||
124 | } | 125 | } |
125 | } | 126 | } |
126 | } | 127 | } |
128 | + | ||
129 | + protected function sendFeedback(Feedback $model) | ||
130 | + { | ||
131 | + $settings = Settings::getInstance(); | ||
132 | + | ||
133 | + require_once '../../vendor/phpmailer/phpmailer/PHPMailerAutoload.php'; | ||
134 | + | ||
135 | + $mail = new \PHPMailer(); | ||
136 | + | ||
137 | + //$mail->SMTPDebug = 3; // Enable verbose debug output | ||
138 | + | ||
139 | + $mail->isSMTP(); // Set mailer to use SMTP | ||
140 | + $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers | ||
141 | + $mail->SMTPAuth = true; // Enable SMTP authentication | ||
142 | + $mail->Username = 'hugeloginnamefortest@gmail.com'; // SMTP username | ||
143 | + $mail->Password = 'hugepasswordfortest'; // SMTP password | ||
144 | + $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted | ||
145 | + $mail->Port = 587; // TCP port to connect to | ||
146 | + | ||
147 | + $mail->setFrom('total-automation@mailer.com', 'Mailer'); | ||
148 | + $mail->addAddress($settings->email); // Add a recipient | ||
149 | + | ||
150 | + $mail->isHTML(true); // Set email format to HTML | ||
151 | + | ||
152 | + $mail->Subject = 'Отзыв'; | ||
153 | + $mail->Body = $this->renderPartial('mail', [ | ||
154 | + 'model' => $model, | ||
155 | + ]); | ||
156 | + | ||
157 | + $mail->send(); | ||
158 | + } | ||
127 | } | 159 | } |
frontend/views/layouts/main.php
@@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
42 | 0 | 42 | 0 |
43 | ]) | 43 | ]) |
44 | ->with('lang.alias') | 44 | ->with('lang.alias') |
45 | + ->orderBy('sort') | ||
45 | ->all(); | 46 | ->all(); |
46 | $solutions = Page::find() | 47 | $solutions = Page::find() |
47 | ->where([ 'in_menu' => true ]) | 48 | ->where([ 'in_menu' => true ]) |
@@ -51,6 +52,7 @@ | @@ -51,6 +52,7 @@ | ||
51 | 0 | 52 | 0 |
52 | ]) | 53 | ]) |
53 | ->with('lang.alias') | 54 | ->with('lang.alias') |
55 | + ->orderBy('sort') | ||
54 | ->all(); | 56 | ->all(); |
55 | $about = Page::find() | 57 | $about = Page::find() |
56 | ->where([ 'in_menu' => true ]) | 58 | ->where([ 'in_menu' => true ]) |
@@ -380,61 +382,6 @@ _________________________________________________________ --> | @@ -380,61 +382,6 @@ _________________________________________________________ --> | ||
380 | <!-- *** FeedBack MODAL *** | 382 | <!-- *** FeedBack MODAL *** |
381 | _________________________________________________________ --> | 383 | _________________________________________________________ --> |
382 | 384 | ||
383 | - <div class="modal fade" id="feedback-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true"> | ||
384 | - <div class="modal-dialog"> | ||
385 | - | ||
386 | - <div class="modal-content"> | ||
387 | - <div class="modal-header"> | ||
388 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
389 | - <h3 class="modal-title" id="Login">Feedback</h3> | ||
390 | - </div> | ||
391 | - <div class="modal-body"> | ||
392 | - | ||
393 | - <?php $form = ActiveForm::begin( | ||
394 | - [ | ||
395 | - 'id' => 'feedback-form', | ||
396 | - 'method' => 'POST', | ||
397 | - 'action' => '/site/feedback', | ||
398 | - ] | ||
399 | - ); ?> | ||
400 | - | ||
401 | - <?= $form->field($feedback, 'name') | ||
402 | - ->textInput(); ?> | ||
403 | - | ||
404 | - <?= $form->field($feedback, 'email') | ||
405 | - ->textInput(); ?> | ||
406 | - | ||
407 | - <?= $form->field($feedback, 'phone') | ||
408 | - ->textInput(); ?> | ||
409 | - | ||
410 | - <?= $form->field($feedback, 'message') | ||
411 | - ->textarea( | ||
412 | - [ | ||
413 | - 'rows' => 4, | ||
414 | - ] | ||
415 | - ); ?> | ||
416 | - | ||
417 | - <p class="text-center"> | ||
418 | - <?= Html::submitButton( | ||
419 | - 'Send', | ||
420 | - [ | ||
421 | - 'class' => 'send-form btn btn-lg btn-template-primary', | ||
422 | - ] | ||
423 | - ) ?> | ||
424 | - </p> | ||
425 | - | ||
426 | - <?php ActiveForm::end(); ?> | ||
427 | - | ||
428 | - </div> | ||
429 | - </div> | ||
430 | - </div> | ||
431 | - </div> | ||
432 | - | ||
433 | - <!-- *** FeedBack MODAL END *** --> | ||
434 | - | ||
435 | - <!-- *** FeedBack MODAL *** | ||
436 | -_________________________________________________________ --> | ||
437 | - | ||
438 | <div class="modal fade" id="success-modal" tabindex="-1" role="dialog" aria-labelledby="Success" aria-hidden="true"> | 385 | <div class="modal fade" id="success-modal" tabindex="-1" role="dialog" aria-labelledby="Success" aria-hidden="true"> |
439 | <div class="modal-dialog"> | 386 | <div class="modal-dialog"> |
440 | 387 |
frontend/views/page/view.php
@@ -15,79 +15,26 @@ | @@ -15,79 +15,26 @@ | ||
15 | ?> | 15 | ?> |
16 | 16 | ||
17 | <div id="content"> | 17 | <div id="content"> |
18 | - <div class="container"> | 18 | + <div class="container"> |
19 | + <section> | ||
20 | + <div class="row"> | ||
19 | 21 | ||
20 | - <div class="row"> | 22 | + <div class="col-md-12 clearfix"> |
23 | + | ||
24 | + <div id="text-page"> | ||
21 | 25 | ||
22 | - <!-- *** LEFT COLUMN *** | ||
23 | - _________________________________________________________ --> | ||
24 | - | ||
25 | - <div class="col-md-9 clearfix"> | ||
26 | - <section> | ||
27 | - <div id="text-page"> | ||
28 | - | ||
29 | - <?= $model->lang->body ?> | ||
30 | - | ||
31 | - </div> | ||
32 | - </section> | ||
33 | - | ||
34 | - </div> | ||
35 | - <!-- /.col-md-9 --> | ||
36 | - | ||
37 | - <!-- *** LEFT COLUMN END *** --> | ||
38 | - | ||
39 | - <!-- *** RIGHT COLUMN *** | ||
40 | - _________________________________________________________ --> | ||
41 | - | ||
42 | - <div class="col-sm-3"> | ||
43 | - <!-- *** PAGES MENU *** | ||
44 | - _________________________________________________________ --> | ||
45 | - <div class="panel panel-default sidebar-menu"> | ||
46 | - | ||
47 | - <div class="panel-heading"> | ||
48 | - <h3 class="panel-title">Pages</h3> | ||
49 | - </div> | ||
50 | - | ||
51 | - <div class="panel-body"> | ||
52 | - <ul class="nav nav-pills nav-stacked"> | ||
53 | - <?php | ||
54 | - foreach ($pages as $page) { | ||
55 | - echo Html::tag( | ||
56 | - 'li', | ||
57 | - Html::a( | ||
58 | - $page->lang->title, | ||
59 | - [ | ||
60 | - 'page/view', | ||
61 | - 'id' => $page->id, | ||
62 | - ] | ||
63 | - ) | ||
64 | - ); | ||
65 | - } | ||
66 | - ?> | ||
67 | - </ul> | ||
68 | - | ||
69 | - </div> | ||
70 | - </div> | ||
71 | - | ||
72 | - <!-- *** PAGES MENU END *** --> | ||
73 | - | ||
74 | - | ||
75 | - <div class="banner"> | ||
76 | - <a href="shop-category.html"> | ||
77 | - <img src="/img/banner.jpg" alt="sales 2014" class="img-responsive"> | ||
78 | - </a> | ||
79 | - </div> | ||
80 | - <!-- /.banner --> | ||
81 | - </div> | ||
82 | - <!-- /.col-md-3 --> | ||
83 | - | ||
84 | - <!-- *** RIGHT COLUMN END *** --> | 26 | + <?= $model->lang->body; ?> |
27 | + | ||
28 | + </div> | ||
85 | 29 | ||
86 | 30 | ||
87 | </div> | 31 | </div> |
88 | - <!-- /.row --> | ||
89 | - | ||
90 | - </div> | ||
91 | - <!-- /.container --> | 32 | + <!-- /.col-md-12 --> |
33 | + </div> | ||
34 | + <!-- /.row --> | ||
35 | + </section> | ||
36 | + </div> | ||
37 | + <!-- /.container --> | ||
92 | </div> | 38 | </div> |
39 | + | ||
93 | <!-- /#content --> | 40 | <!-- /#content --> |
frontend/views/site/contact.php
@@ -26,174 +26,166 @@ JS; | @@ -26,174 +26,166 @@ JS; | ||
26 | $this->registerJs($js, View::POS_END); | 26 | $this->registerJs($js, View::POS_END); |
27 | ?> | 27 | ?> |
28 | 28 | ||
29 | + | ||
29 | <div id="content"> | 30 | <div id="content"> |
30 | - <div class="container" id="contact"> | ||
31 | - | ||
32 | - <section> | ||
33 | - | ||
34 | - <div class="row"> | ||
35 | - <div class="col-md-12"> | ||
36 | - <section> | ||
37 | - <div class="heading"> | ||
38 | - <h2>We are here to help you</h2> | ||
39 | - </div> | ||
40 | - | ||
41 | - <p class="lead">Are you curious about something? Do you have some kind of problem with our products? As am hastily invited settled at limited civilly fortune me. Really spring in extent an by. Judge but built gay party world. Of so am | ||
42 | - he remember although required. Bachelor unpacked be advanced at. Confined in declared marianne is vicinity.</p> | ||
43 | - <p>Please feel free to contact us, our customer service center is working for you 24/7.</p> | ||
44 | - </section> | ||
45 | - </div> | 31 | + <div class="container" id="contact"> |
32 | + | ||
33 | + <section> | ||
34 | + | ||
35 | + <div class="row"> | ||
36 | + <div class="col-md-12"> | ||
37 | + <section> | ||
38 | + <div class="heading"> | ||
39 | + <h2>Мы работаем для вас</h2> | ||
46 | </div> | 40 | </div> |
47 | - | ||
48 | - </section> | ||
49 | - <section> | ||
50 | 41 | ||
51 | - <div class="row"> | ||
52 | - <div class="col-md-4"> | ||
53 | - <div class="box-simple"> | ||
54 | - <div class="icon"> | ||
55 | - <i class="fa fa-map-marker"></i> | ||
56 | - </div> | ||
57 | - <h3>Address</h3> | ||
58 | - <p> | ||
59 | - <?php | ||
60 | - if (!empty( $settings->street )) { | ||
61 | - echo $settings->street; | ||
62 | - if (!empty( $settings->house )) { | ||
63 | - echo " " . $settings->house; | ||
64 | - } | ||
65 | - echo Html::tag('br'); | ||
66 | - } | ||
67 | - if (!empty( $settings->city )) { | ||
68 | - echo $settings->city; | ||
69 | - if (!empty( $settings->country )) { | ||
70 | - echo Html::tag('strong', ", " . $settings->country); | ||
71 | - } | ||
72 | - } | ||
73 | - ?> | ||
74 | - </p> | ||
75 | - </div> | ||
76 | - <!-- /.box - simple--> | ||
77 | - </div> | ||
78 | - | ||
79 | - | ||
80 | - <div class="col-md-4"> | ||
81 | - <?php | ||
82 | - if (!empty( $settings->phone )) { | ||
83 | - ?> | ||
84 | - <div class="box-simple"> | ||
85 | - <div class="icon"> | ||
86 | - <i class="fa fa-phone"></i> | ||
87 | - </div> | ||
88 | - <h3> Call center </h3> | ||
89 | - <p class="text-muted"> This number is toll free if calling from Great Britain otherwise we advise you to use the electronic form of communication .</p> | ||
90 | - <p> | ||
91 | - <?php | ||
92 | - echo Html::a(Html::tag('strong', $settings->phone), 'tel:' . $settings->phone); | ||
93 | - ?> | ||
94 | - </p> | ||
95 | - </div> | ||
96 | - <!-- /.box - simple--> | ||
97 | - <?php | ||
98 | - } | ||
99 | - ?> | ||
100 | - </div> | ||
101 | - | ||
102 | - <?php | ||
103 | - if (!empty( $settings->email )) { | ||
104 | - ?> | ||
105 | - <div class="col-md-4"> | ||
106 | - | ||
107 | - <div class="box-simple"> | ||
108 | - <div class="icon"> | ||
109 | - <i class="fa fa-envelope"></i> | ||
110 | - </div> | ||
111 | - <h3> Electronic support </h3> | ||
112 | - <p class="text-muted"> Please feel free to write an email to us or to use our electronic ticketing system .</p> | ||
113 | - <ul class="list-style-none"> | ||
114 | - <li> | ||
115 | - <?php | ||
116 | - echo Html::a( | ||
117 | - Html::tag('strong', $settings->email), | ||
118 | - 'mailto:' . $settings->email | ||
119 | - ); | ||
120 | - ?> | ||
121 | - </li> | ||
122 | - </ul> | ||
123 | - </div> | ||
124 | - <!-- /.box - simple--> | ||
125 | - </div> | ||
126 | - <?php | 42 | + <p class="lead">Мы всегда готовы помочь вам выбрать оптимальный вариант оборудования, который покроет ваши потребности и не ударит по карману. Также будем рады ответить на все возникшие вопросы.</p> |
43 | + <p>Пожалуйста, оставьте ваши данные и мы свяжемся с вами в ближайшее время.</p> | ||
44 | + </section> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + | ||
48 | + </section> | ||
49 | + | ||
50 | + <section> | ||
51 | + | ||
52 | + <div class="row"> | ||
53 | + <div class="col-md-4"> | ||
54 | + <div class="box-simple"> | ||
55 | + <div class="icon"> | ||
56 | + <i class="fa fa-map-marker"></i> | ||
57 | + </div> | ||
58 | + <h3>Адрес</h3> | ||
59 | + <p><?php if (!empty($settings->street)) { | ||
60 | + echo $settings->street . ','; | ||
61 | + } ?> <?php | ||
62 | + if (!empty($settings->house)) { | ||
63 | + echo $settings->house; | ||
127 | } | 64 | } |
128 | ?> | 65 | ?> |
66 | + <br/><?php if (!empty($settings->index)) { | ||
67 | + echo $settings->index . ','; | ||
68 | + } ?> | ||
69 | + <br/><?php | ||
70 | + if (!empty($settings->city)) { | ||
71 | + echo $settings->city . ','; | ||
72 | + } | ||
73 | + ?> <strong><?php if (!empty($settings->country)) { | ||
74 | + echo $settings->country; | ||
75 | + } ?></strong> | ||
76 | + </p> | ||
77 | + </div> | ||
78 | + <!-- /.box-simple --> | ||
79 | + </div> | ||
80 | + | ||
81 | + | ||
82 | + <div class="col-md-4"> | ||
83 | + | ||
84 | + <div class="box-simple"> | ||
85 | + <div class="icon"> | ||
86 | + <i class="fa fa-phone"></i> | ||
87 | + </div> | ||
88 | + <h3>Телефоны</h3> | ||
89 | + <p><strong><?php if (!empty($settings->phone)) { | ||
90 | + echo $settings->phone; | ||
91 | + } ?></strong> | ||
92 | + <p><strong><?php if (!empty($settings->phone2)) { | ||
93 | + echo $settings->phone2; | ||
94 | + } ?></strong> | ||
95 | + </p> | ||
96 | + </div> | ||
97 | + <!-- /.box-simple --> | ||
98 | + | ||
99 | + </div> | ||
100 | + | ||
101 | + <div class="col-md-4"> | ||
102 | + | ||
103 | + <div class="box-simple"> | ||
104 | + <div class="icon"> | ||
105 | + <i class="fa fa-envelope"></i> | ||
129 | </div> | 106 | </div> |
107 | + <h3>Электронный адрес</h3> | ||
108 | + <ul class="list-style-none" style="padding-left: 0"> | ||
109 | + <?php if (!empty($settings->email)) { ?> | ||
110 | + <li><strong><a href="mailto:<?= $settings->email; ?>"><?= $settings->email; ?></a></strong> | ||
111 | + </li> | ||
112 | + <?php } ?> | ||
113 | + </ul> | ||
114 | + </div> | ||
115 | + <!-- /.box-simple --> | ||
116 | + </div> | ||
117 | + </div> | ||
118 | + | ||
119 | + </section> | ||
120 | + | ||
121 | + <section> | ||
122 | + | ||
123 | + <div class="row"> | ||
130 | 124 | ||
131 | - </section> | 125 | + <div class="col-md-12 text-center"> |
126 | + <div class="heading"> | ||
127 | + <h2>Возникли вопросы или предложения?</h2> | ||
128 | + </div> | ||
129 | + </div> | ||
132 | 130 | ||
133 | - <section> | 131 | + <div class="col-md-8 col-md-offset-2"> |
132 | + <?php $form = ActiveForm::begin( | ||
133 | + [ | ||
134 | + 'id' => 'contact-form', | ||
135 | + 'method' => 'POST', | ||
136 | + 'action' => '/site/feedback', | ||
137 | + ] | ||
138 | + ); ?> | ||
139 | + <div class="row"> | ||
140 | + <div class="col-sm-12 col-xs-12"> | ||
141 | + <?= $form->field($contact, 'name') | ||
142 | + ->textInput(); ?> | ||
143 | + </div> | ||
144 | + | ||
145 | + <div class="col-sm-12 col-xs-12"> | ||
146 | + <?= $form->field($contact, 'email') | ||
147 | + ->textInput(); ?> | ||
148 | + </div> | ||
149 | + | ||
150 | + <div class="col-sm-12 col-xs-12"> | ||
151 | + <?= $form->field($contact, 'phone') | ||
152 | + ->textInput(); ?> | ||
153 | + </div> | ||
154 | + | ||
155 | + <div class="col-sm-12 col-xs-12"> | ||
156 | + <?= $form->field($contact, 'message') | ||
157 | + ->textarea( | ||
158 | + [ | ||
159 | + 'rows' => 3, | ||
160 | + ] | ||
161 | + ) ?> | ||
162 | + </div> | ||
134 | 163 | ||
135 | - <div class="row text-center"> | ||
136 | - | ||
137 | - <div class="col-md-12"> | ||
138 | - <div class="heading"> | ||
139 | - <h2> Contact form </h2> | ||
140 | - </div> | ||
141 | - </div> | ||
142 | - | ||
143 | - <div class="col-md-8 col-md-offset-2"> | ||
144 | - <?php $form = ActiveForm::begin( | 164 | + <div class="col-sm-12 col-xs-12 text-center"> |
165 | + <?php | ||
166 | + echo Html::submitButton( | ||
167 | + Html::tag('i', '', [ 'class' => 'fa fa-envelope-o' ]) . ' Отправить', | ||
145 | [ | 168 | [ |
146 | - 'id' => 'contact-form', | ||
147 | - 'method' => 'POST', | ||
148 | - 'action' => '/site/feedback', | 169 | + 'class' => 'btn btn-template-main', |
149 | ] | 170 | ] |
150 | - ); ?> | ||
151 | - <div class="row"> | ||
152 | - <div class="col-sm-12"> | ||
153 | - <?= $form->field($contact, 'name') | ||
154 | - ->textInput(); ?> | ||
155 | - </div> | ||
156 | - | ||
157 | - <div class="col-sm-6"> | ||
158 | - <?= $form->field($contact, 'email') | ||
159 | - ->textInput(); ?> | ||
160 | - </div> | ||
161 | - <div class="col-sm-6"> | ||
162 | - <?= $form->field($contact, 'phone') | ||
163 | - ->textInput(); ?> | ||
164 | - </div> | ||
165 | - <div class="col-sm-12"> | ||
166 | - <?= $form->field($contact, 'message') | ||
167 | - ->textarea( | ||
168 | - [ | ||
169 | - 'rows' => 3, | ||
170 | - ] | ||
171 | - ); ?> | ||
172 | - </div> | ||
173 | - | ||
174 | - <div class="col-sm-12 text-center"> | ||
175 | - <?= Html::submitButton( | ||
176 | - '<i class="fa fa-envelope-o"></i> Send message', | ||
177 | - [ | ||
178 | - 'class' => 'btn btn-template-main', | ||
179 | - ] | ||
180 | - ) ?> | ||
181 | - | ||
182 | - </div> | ||
183 | - </div> | ||
184 | - <!-- /.row --> | ||
185 | - <?php ActiveForm::end(); ?> | ||
186 | - </div> | 171 | + ) |
172 | + ?> | ||
187 | </div> | 173 | </div> |
188 | - <!-- /.row --> | 174 | + </div> |
175 | + <!-- /.row --> | ||
176 | + <?php $form::end(); ?> | ||
189 | 177 | ||
190 | - </section> | ||
191 | - | 178 | + |
179 | + </div> | ||
180 | + </div> | ||
181 | + <!-- /.row --> | ||
192 | 182 | ||
193 | - </div> | ||
194 | - <!-- /#contact.container --> | 183 | + </section> |
184 | + | ||
185 | + | ||
186 | + </div> | ||
187 | + <!-- /#contact.container --> | ||
195 | </div> | 188 | </div> |
196 | -<!-- /#content --> | ||
197 | 189 | ||
198 | <div id="map"> | 190 | <div id="map"> |
199 | 191 |
frontend/views/site/index.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | /* @var $this yii\web\View */ | 3 | /* @var $this yii\web\View */ |
4 | - | ||
5 | -$this->title = 'My Yii Application'; | 4 | + |
5 | + use artbox\core\models\Feedback; | ||
6 | + use yii\helpers\Html; | ||
7 | + use yii\widgets\ActiveForm; | ||
8 | + | ||
9 | + $this->title = 'My Yii Application'; | ||
10 | + | ||
11 | + $feedback = new Feedback(); | ||
6 | ?> | 12 | ?> |
7 | 13 | ||
8 | 14 | ||
@@ -309,43 +315,42 @@ _________________________________________________________ --> | @@ -309,43 +315,42 @@ _________________________________________________________ --> | ||
309 | <h4 class="modal-title">Возникли вопросы или предложения?</h4> | 315 | <h4 class="modal-title">Возникли вопросы или предложения?</h4> |
310 | </div> | 316 | </div> |
311 | <div class="modal-body"> | 317 | <div class="modal-body"> |
312 | - <form> | 318 | + <?php $form = ActiveForm::begin( |
319 | + [ | ||
320 | + 'id' => 'feedback-form', | ||
321 | + 'method' => 'POST', | ||
322 | + 'action' => '/site/feedback', | ||
323 | + ] | ||
324 | + ); ?> | ||
313 | <div class="row"> | 325 | <div class="row"> |
314 | <div class="col-xs-12 col-sm-12"> | 326 | <div class="col-xs-12 col-sm-12"> |
315 | - <div class="form-group"> | ||
316 | - <label for="firstname">Имя</label> | ||
317 | - <input type="text" class="form-control" id="firstname"> | ||
318 | - </div> | 327 | + <?= $form->field($feedback, 'name')->textInput();?> |
319 | </div> | 328 | </div> |
320 | 329 | ||
321 | <div class="col-xs-12 col-sm-12"> | 330 | <div class="col-xs-12 col-sm-12"> |
322 | - <div class="form-group"> | ||
323 | - <label for="email">Email</label> | ||
324 | - <input type="text" class="form-control" id="email"> | ||
325 | - </div> | 331 | + <?= $form->field($feedback, 'email')->textInput();?> |
326 | </div> | 332 | </div> |
327 | 333 | ||
328 | <div class="col-sm-12 col-xs-12"> | 334 | <div class="col-sm-12 col-xs-12"> |
329 | - <div class="form-group"> | ||
330 | - <label for="phones">Телефон</label> | ||
331 | - <input type="text" class="form-control" id="phones"> | ||
332 | - </div> | 335 | + <?= $form->field($feedback, 'phone')->textInput();?> |
333 | </div> | 336 | </div> |
334 | 337 | ||
335 | <div class="col-xs-12 col-sm-12"> | 338 | <div class="col-xs-12 col-sm-12"> |
336 | - <div class="form-group"> | ||
337 | - <label for="message">Сообщение</label> | ||
338 | - <textarea id="message" class="form-control"></textarea> | ||
339 | - </div> | 339 | + <?= $form->field($feedback, 'message')->textarea([ |
340 | + 'rows' => 4, | ||
341 | + ])?> | ||
340 | </div> | 342 | </div> |
341 | 343 | ||
342 | <div class="col-sm-12 text-center"> | 344 | <div class="col-sm-12 text-center"> |
343 | - <button type="submit" class="btn btn-template-main"><i class="fa fa-envelope-o"></i> отправить</button> | ||
344 | - | 345 | + <?php |
346 | + echo Html::submitButton('<i class="fa fa-envelope-o"></i> отправить', [ | ||
347 | + 'class' => 'btn btn-template-main', | ||
348 | + ]); | ||
349 | + ?> | ||
345 | </div> | 350 | </div> |
346 | </div> | 351 | </div> |
347 | <!-- /.row --> | 352 | <!-- /.row --> |
348 | - </form> | 353 | + <?php ActiveForm::end(); ?> |
349 | </div> | 354 | </div> |
350 | </div> | 355 | </div> |
351 | </div> | 356 | </div> |
1 | +<?php | ||
2 | + | ||
3 | + use artbox\core\models\Feedback; | ||
4 | + use yii\web\View; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var View $this | ||
8 | + * @var Feedback $model | ||
9 | + */ | ||
10 | + | ||
11 | + ?> | ||
12 | + | ||
13 | +<table> | ||
14 | + <tr><td><b>Имя :</b></td><td><?= $model->name;?></td></tr> | ||
15 | + <tr><td><b>Email :</b></td><td><?= $model->email; ?></td></tr> | ||
16 | + <tr><td><b>Телефон :</b></td><td><?= $model->phone; ?></td></tr> | ||
17 | + <tr><td><b>Сообщение :</b></td><td><?= $model->message ?></td></tr> | ||
18 | +</table> |
1 | -$(function () { | 1 | +$( |
2 | + function() { | ||
2 | 3 | ||
3 | - map(); | 4 | + function initMap() { |
5 | + var newLat = window.lat; | ||
6 | + var lng = window.lon; | ||
7 | + var styles = [{ | ||
8 | + stylers: [ | ||
9 | + { saturation: -100 } | ||
10 | + ] | ||
11 | + }]; | ||
12 | + map = new GMaps({ | ||
13 | + el: '#map', | ||
14 | + lat: newLat, | ||
15 | + lng: lng, | ||
16 | + zoomControl: true, | ||
17 | + zoomControlOpt: { | ||
18 | + style: 'SMALL', | ||
19 | + position: 'TOP_LEFT' | ||
20 | + }, | ||
21 | + panControl: false, | ||
22 | + streetViewControl: false, | ||
23 | + mapTypeControl: false, | ||
24 | + overviewMapControl: false, | ||
25 | + scrollwheel: false, | ||
26 | + draggable: false, | ||
27 | + styles: styles, | ||
28 | + zoom: 14 | ||
29 | + }); | ||
4 | 30 | ||
5 | -}); | 31 | + var image = '/img/marker2.png'; |
6 | 32 | ||
7 | -/* map */ | 33 | + map.addMarker({ |
34 | + lat: newLat, | ||
35 | + lng: lng, | ||
36 | + icon: image | ||
37 | + }); | ||
38 | + } | ||
8 | 39 | ||
9 | -function map() { | ||
10 | - var newLat = 50.4534482; | ||
11 | - var lng = 30.4249462; | ||
12 | - // var styles = [{"featureType": "landscape", "stylers": [{"saturation": -100}, {"lightness": 65}, {"visibility": "on"}]}, {"featureType": "poi", "stylers": [{"saturation": -100}, {"lightness": 51}, {"visibility": "simplified"}]}, {"featureType": "road.highway", "stylers": [{"saturation": -100}, {"visibility": "simplified"}]}, {"featureType": "road.arterial", "stylers": [{"saturation": -100}, {"lightness": 30}, {"visibility": "on"}]}, {"featureType": "road.local", "stylers": [{"saturation": -100}, {"lightness": 40}, {"visibility": "on"}]}, {"featureType": "transit", "stylers": [{"saturation": -100}, {"visibility": "simplified"}]}, {"featureType": "administrative.province", "stylers": [{"visibility": "off"}]}, {"featureType": "water", "elementType": "labels", "stylers": [{"visibility": "on"}, {"lightness": -25}, {"saturation": -100}]}, {"featureType": "water", "elementType": "geometry", "stylers": [{"hue": "#ffff00"}, {"lightness": -25}, {"saturation": -97}]}]; | ||
13 | - var styles = [{ | ||
14 | - stylers: [ | ||
15 | - { saturation: -100 } | ||
16 | - ] | ||
17 | - }]; | ||
18 | - map = new GMaps({ | ||
19 | - el: '#map', | ||
20 | - lat: newLat, | ||
21 | - lng: lng, | ||
22 | - zoomControl: true, | ||
23 | - zoomControlOpt: { | ||
24 | - style: 'SMALL', | ||
25 | - position: 'TOP_LEFT' | ||
26 | - }, | ||
27 | - panControl: false, | ||
28 | - streetViewControl: false, | ||
29 | - mapTypeControl: false, | ||
30 | - overviewMapControl: false, | ||
31 | - scrollwheel: false, | ||
32 | - draggable: false, | ||
33 | - styles: styles, | ||
34 | - zoom: 14 | ||
35 | - }); | ||
36 | - | ||
37 | - var image = 'img/marker2.png'; | ||
38 | - | ||
39 | - map.addMarker({ | ||
40 | - lat: newLat, | ||
41 | - lng: lng, | ||
42 | - icon: image/* , | ||
43 | - title: '', | ||
44 | - infoWindow: { | ||
45 | - content: '<p>HTML Content</p>' | ||
46 | - }*/ | ||
47 | - }); | ||
48 | -} | ||
49 | \ No newline at end of file | 40 | \ No newline at end of file |
41 | + window.initMap = initMap(); | ||
42 | + } | ||
43 | +); |
1 | +$( | ||
2 | + function() { | ||
3 | + | ||
4 | + /** | ||
5 | + * Modal form submit code | ||
6 | + */ | ||
7 | + $(document) | ||
8 | + .on( | ||
9 | + 'beforeSubmit', '#feedback-form', function(e) { | ||
10 | + var f = this; | ||
11 | + var form = $(this); | ||
12 | + var formData = form.serialize(); | ||
13 | + $.ajax( | ||
14 | + { | ||
15 | + url: form.attr("action"), | ||
16 | + type: form.attr("method"), | ||
17 | + data: formData, | ||
18 | + success: function(data) { | ||
19 | + f.reset(); | ||
20 | + $('#myModal') | ||
21 | + .modal('hide'); | ||
22 | + $('#success-modal') | ||
23 | + .modal('show'); | ||
24 | + }, | ||
25 | + error: function() { | ||
26 | + $('#feedback-modal') | ||
27 | + .modal('hide'); | ||
28 | + } | ||
29 | + } | ||
30 | + ); | ||
31 | + } | ||
32 | + ) | ||
33 | + .on( | ||
34 | + 'submit', '#feedback-form', function(e) { | ||
35 | + e.preventDefault(); | ||
36 | + } | ||
37 | + ); | ||
38 | + | ||
39 | + /** | ||
40 | + * Contact form submitting | ||
41 | + */ | ||
42 | + $(document) | ||
43 | + .on( | ||
44 | + 'beforeSubmit', '#contact-form', function(e) { | ||
45 | + var f = this; | ||
46 | + var form = $(this); | ||
47 | + var formData = form.serialize(); | ||
48 | + $.ajax( | ||
49 | + { | ||
50 | + url: form.attr("action"), | ||
51 | + type: form.attr("method"), | ||
52 | + data: formData, | ||
53 | + success: function(data) { | ||
54 | + f.reset(); | ||
55 | + form.replaceWith(data.alert) | ||
56 | + }, | ||
57 | + error: function() { | ||
58 | + | ||
59 | + } | ||
60 | + } | ||
61 | + ); | ||
62 | + } | ||
63 | + ) | ||
64 | + .on( | ||
65 | + 'submit', '#contact-form', function(e) { | ||
66 | + e.preventDefault(); | ||
67 | + } | ||
68 | + ); | ||
69 | + | ||
70 | + /** | ||
71 | + * Button UP code | ||
72 | + */ | ||
73 | + if ($('#back-to-top').length) { | ||
74 | + var scrollTrigger = 100, // px | ||
75 | + backToTop = function() { | ||
76 | + var scrollTop = $(window) | ||
77 | + .scrollTop(); | ||
78 | + if (scrollTop > scrollTrigger) { | ||
79 | + $('#back-to-top') | ||
80 | + .addClass('show'); | ||
81 | + } else { | ||
82 | + $('#back-to-top') | ||
83 | + .removeClass('show'); | ||
84 | + } | ||
85 | + }; | ||
86 | + backToTop(); | ||
87 | + $(window) | ||
88 | + .on( | ||
89 | + 'scroll', function() { | ||
90 | + backToTop(); | ||
91 | + } | ||
92 | + ); | ||
93 | + $('#back-to-top') | ||
94 | + .on( | ||
95 | + 'click', function(e) { | ||
96 | + e.preventDefault(); | ||
97 | + $('html,body') | ||
98 | + .animate( | ||
99 | + { | ||
100 | + scrollTop: 0 | ||
101 | + }, 700 | ||
102 | + ); | ||
103 | + } | ||
104 | + ); | ||
105 | + } | ||
106 | + } | ||
107 | +); | ||
0 | \ No newline at end of file | 108 | \ No newline at end of file |