Commit 623f54821f388fd95fc3a744d72ce41d417d0641
Merge branch 'master' of gitlab.artweb.com.ua:root/test_1
Showing
11 changed files
with
353 additions
and
67 deletions
Show diff stats
backend/components/ImgResizer.php
@@ -98,28 +98,6 @@ class ImgResizer extends Widget | @@ -98,28 +98,6 @@ class ImgResizer extends Widget | ||
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | - public function getImgSize($width,$height,$e){ | ||
102 | - if($e>1){ | ||
103 | - if($height>$width){ | ||
104 | - $this->width = $width; | ||
105 | - $this->height = $height/$e; | ||
106 | - } else { | ||
107 | - $this->height = $height; | ||
108 | - $this->width= $width/$e; | ||
109 | - } | ||
110 | - | ||
111 | - } else { | ||
112 | - if($width >$height ){ | ||
113 | - $this->height = $height; | ||
114 | - $this->width = $width*$e; | ||
115 | - } else { | ||
116 | - $this->width = $width; | ||
117 | - $this->height = $height*$e; | ||
118 | - } | ||
119 | - | ||
120 | - } | ||
121 | - } | ||
122 | - | ||
123 | 101 | ||
124 | 102 | ||
125 | 103 | ||
@@ -132,40 +110,29 @@ class ImgResizer extends Widget | @@ -132,40 +110,29 @@ class ImgResizer extends Widget | ||
132 | $width = $size->getWidth(); | 110 | $width = $size->getWidth(); |
133 | $height = $size->getHeight(); | 111 | $height = $size->getHeight(); |
134 | 112 | ||
135 | - $e = $w/$h; | ||
136 | - | ||
137 | - if($this->isBigger($width,$height,$w,$h)){ | ||
138 | - if($height > $width) { | ||
139 | - | ||
140 | - $x = 0; | ||
141 | - $y = ($height - $width) / 2; | ||
142 | - $e1 = $width/$height; | ||
143 | - | ||
144 | - $height = $height*($e1/$e); | 113 | + $e_width = $w/$h; |
114 | + $e_height = $h/$w; | ||
145 | 115 | ||
146 | - }else if($height == $width){ | ||
147 | - $x = 0; | ||
148 | - $y = ($height - $width) / 2; | 116 | + $e1_width = $width/$height; |
117 | + $e1_height = $height/$width; | ||
149 | 118 | ||
150 | - | ||
151 | - $height = $height/$e; | 119 | + if($this->isBigger($width,$height,$w,$h)){ |
120 | + if($e_width<$e1_width){ | ||
121 | + $new_width = $width*($e_width/$e1_width); | ||
122 | + $width = $new_width; | ||
152 | }else { | 123 | }else { |
153 | - $y = 0; | ||
154 | - $x = ($width - $height) / 2; | ||
155 | - $e1 = $width/$height; | ||
156 | - | ||
157 | - $width = $width*($e/$e1); | 124 | + $new_height = $height*($e_height/$e1_height); |
125 | + $height = $new_height; | ||
158 | } | 126 | } |
127 | + | ||
128 | + | ||
159 | } else { | 129 | } else { |
160 | $img->save($imageAliasSave, array('flatten' => false)); | 130 | $img->save($imageAliasSave, array('flatten' => false)); |
161 | return true; | 131 | return true; |
162 | } | 132 | } |
163 | 133 | ||
164 | 134 | ||
165 | - | ||
166 | - | ||
167 | - | ||
168 | - Image::crop($imageAlias, $width, $height,[$x,$y]) | 135 | + Image::crop($imageAlias, $width, $height,[0,0]) |
169 | ->save(Yii::getAlias($imageAliasSave), ['quality' => | 136 | ->save(Yii::getAlias($imageAliasSave), ['quality' => |
170 | 100]); | 137 | 100]); |
171 | 138 |
backend/controllers/NewsController.php
@@ -131,4 +131,22 @@ class NewsController extends Controller | @@ -131,4 +131,22 @@ class NewsController extends Controller | ||
131 | echo ImgResizer::widget(); | 131 | echo ImgResizer::widget(); |
132 | 132 | ||
133 | } | 133 | } |
134 | + | ||
135 | + public function actionPriceListUpload(){ | ||
136 | + | ||
137 | + $model = new ImageSizerForm(); | ||
138 | + | ||
139 | + if (Yii::$app->request->isPost) { | ||
140 | + $model->file = UploadedFile::getInstance($model, 'price_list'); | ||
141 | + | ||
142 | + if ($model->validate()) { | ||
143 | + $rout =Yii::getAlias( '@storage/files/file/' . time(). '.' . $model->file->extension); | ||
144 | + $model->file->saveAs($rout); | ||
145 | + $rout = '/storage/files/file/' . time(). '.' . $model->file->extension; | ||
146 | + return json_encode(['name' =>$rout,]); | ||
147 | + | ||
148 | + } | ||
149 | + } | ||
150 | + | ||
151 | + } | ||
134 | } | 152 | } |
backend/views/news/_form.php
@@ -73,6 +73,8 @@ use \yii\helpers\Url; | @@ -73,6 +73,8 @@ use \yii\helpers\Url; | ||
73 | 73 | ||
74 | ]);?> | 74 | ]);?> |
75 | 75 | ||
76 | + <?= Html::activeHiddenInput($model, 'price_list');?> | ||
77 | + | ||
76 | <?= $form->field(new \backend\models\ImageSizerForm(), 'price_list')->widget(FileInput::classname(), [ | 78 | <?= $form->field(new \backend\models\ImageSizerForm(), 'price_list')->widget(FileInput::classname(), [ |
77 | 'name' => 'file', | 79 | 'name' => 'file', |
78 | 'options' => [ | 80 | 'options' => [ |
@@ -82,13 +84,14 @@ use \yii\helpers\Url; | @@ -82,13 +84,14 @@ use \yii\helpers\Url; | ||
82 | 'initialPreview'=>[ | 84 | 'initialPreview'=>[ |
83 | Html::img($model->price_list, ['class'=>'file-preview-image']), | 85 | Html::img($model->price_list, ['class'=>'file-preview-image']), |
84 | ], | 86 | ], |
85 | - 'uploadUrl' => Url::to(['/news/file-upload']), | 87 | + 'showPreview'=> false, |
88 | + 'uploadUrl' => Url::to(['/news/price-list-upload']), | ||
86 | 'overwriteInitial'=>true, | 89 | 'overwriteInitial'=>true, |
87 | 'uploadExtraData'=> ['width' => 240, 'height' => 160] | 90 | 'uploadExtraData'=> ['width' => 240, 'height' => 160] |
88 | 91 | ||
89 | ], | 92 | ], |
90 | 'pluginEvents' => [ | 93 | 'pluginEvents' => [ |
91 | - 'fileuploaded' => 'function(event, key) { document.getElementsByName("News[img]")[0].value = key.response.name }', | 94 | + 'fileuploaded' => 'function(event, key) { document.getElementsByName("News[price_list]")[0].value = key.response.name }', |
92 | ] | 95 | ] |
93 | 96 | ||
94 | 97 |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\components; | ||
4 | +require( __DIR__.'/../../vendor/phpmailer/phpmailer/PHPMailerAutoload.php'); | ||
5 | +use yii\base\Widget; | ||
6 | +use yii\helpers\Html; | ||
7 | + | ||
8 | +class MailWidget extends Widget{ | ||
9 | + public $message; | ||
10 | + public $email; | ||
11 | + public $text; | ||
12 | + public $subject; | ||
13 | + | ||
14 | + public function init(){ | ||
15 | + | ||
16 | + parent::init(); | ||
17 | + | ||
18 | + } | ||
19 | + | ||
20 | + public function run(){ | ||
21 | + | ||
22 | + $mail = new \PHPMailer; | ||
23 | + | ||
24 | + $mail->IsSMTP(); | ||
25 | + | ||
26 | + $mail->CharSet = 'UTF-8'; | ||
27 | + | ||
28 | + $mail->Username = "dockdep@gmail.com"; | ||
29 | + $mail->Password = "k0l0b04eg"; | ||
30 | + $mail->SetFrom($this->email); | ||
31 | + $mail->Subject = $this->subject; | ||
32 | + $mail->MsgHTML($this->text); | ||
33 | + $address = "dockdep@gmail.com"; | ||
34 | + $mail->AddAddress($address); | ||
35 | + | ||
36 | + if(!$mail->send()) { | ||
37 | + return 'Mailer Error: ' . $mail->ErrorInfo; | ||
38 | + } else { | ||
39 | + return 'Message has been sent'; | ||
40 | + } | ||
41 | + } | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | +} | ||
46 | + |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "{{%callback}}". | ||
9 | + * | ||
10 | + * @property integer $id | ||
11 | + * @property string $name | ||
12 | + * @property string $phone_num | ||
13 | + */ | ||
14 | +class Callback extends \yii\db\ActiveRecord | ||
15 | +{ | ||
16 | + /** | ||
17 | + * @inheritdoc | ||
18 | + */ | ||
19 | + public static function tableName() | ||
20 | + { | ||
21 | + return 'w_callback'; | ||
22 | + } | ||
23 | + | ||
24 | + /** | ||
25 | + * @inheritdoc | ||
26 | + */ | ||
27 | + public function rules() | ||
28 | + { | ||
29 | + return [ | ||
30 | + [['name', 'phone_num'], 'required'], | ||
31 | + [['name', 'phone_num'], 'string', 'max' => 45] | ||
32 | + ]; | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * @inheritdoc | ||
37 | + */ | ||
38 | + public function attributeLabels() | ||
39 | + { | ||
40 | + return [ | ||
41 | + 'id' => 'ID', | ||
42 | + 'name' => 'Имя', | ||
43 | + 'phone_num' => 'Номер телефона', | ||
44 | + ]; | ||
45 | + } | ||
46 | +} |
composer.json
@@ -26,7 +26,8 @@ | @@ -26,7 +26,8 @@ | ||
26 | "codeception/codeception": "*", | 26 | "codeception/codeception": "*", |
27 | "2amigos/yii2-ckeditor-widget": "~1.0", | 27 | "2amigos/yii2-ckeditor-widget": "~1.0", |
28 | "mihaildev/yii2-ckeditor": "*", | 28 | "mihaildev/yii2-ckeditor": "*", |
29 | - "kartik-v/yii2-widget-fileinput": "@dev" | 29 | + "kartik-v/yii2-widget-fileinput": "@dev", |
30 | + "phpmailer/phpmailer": "^5.2" | ||
30 | }, | 31 | }, |
31 | "require-dev": { | 32 | "require-dev": { |
32 | "yiisoft/yii2-codeception": "*", | 33 | "yiisoft/yii2-codeception": "*", |
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": "ee02abda5c7b7eca736817c3c0fc97c9", | ||
8 | - "content-hash": "859f6a13927c8412991c47d4b2b7db86", | 7 | + "hash": "730e64078443048be45853b3c5138188", |
8 | + "content-hash": "82756055d7c5fb8a9d26bafc73ae0131", | ||
9 | "packages": [ | 9 | "packages": [ |
10 | { | 10 | { |
11 | "name": "2amigos/yii2-ckeditor-widget", | 11 | "name": "2amigos/yii2-ckeditor-widget", |
@@ -822,6 +822,54 @@ | @@ -822,6 +822,54 @@ | ||
822 | "time": "2013-07-10 17:25:36" | 822 | "time": "2013-07-10 17:25:36" |
823 | }, | 823 | }, |
824 | { | 824 | { |
825 | + "name": "kartik-v/bootstrap-fileinput", | ||
826 | + "version": "v4.2.7", | ||
827 | + "source": { | ||
828 | + "type": "git", | ||
829 | + "url": "https://github.com/kartik-v/bootstrap-fileinput.git", | ||
830 | + "reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78" | ||
831 | + }, | ||
832 | + "dist": { | ||
833 | + "type": "zip", | ||
834 | + "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/0468bbba9c28c1250aca83eba9b33e32ec135f78", | ||
835 | + "reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78", | ||
836 | + "shasum": "" | ||
837 | + }, | ||
838 | + "type": "library", | ||
839 | + "autoload": { | ||
840 | + "psr-4": { | ||
841 | + "kartik\\plugins\\fileinput\\": "" | ||
842 | + } | ||
843 | + }, | ||
844 | + "notification-url": "https://packagist.org/downloads/", | ||
845 | + "license": [ | ||
846 | + "BSD-3-Clause" | ||
847 | + ], | ||
848 | + "authors": [ | ||
849 | + { | ||
850 | + "name": "Kartik Visweswaran", | ||
851 | + "email": "kartikv2@gmail.com", | ||
852 | + "homepage": "http://www.krajee.com/" | ||
853 | + } | ||
854 | + ], | ||
855 | + "description": "An enhanced HTML 5 file input for Bootstrap 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.", | ||
856 | + "homepage": "https://github.com/kartik-v/bootstrap-fileinput", | ||
857 | + "keywords": [ | ||
858 | + "ajax", | ||
859 | + "bootstrap", | ||
860 | + "delete", | ||
861 | + "file", | ||
862 | + "image", | ||
863 | + "input", | ||
864 | + "jquery", | ||
865 | + "multiple", | ||
866 | + "preview", | ||
867 | + "progress", | ||
868 | + "upload" | ||
869 | + ], | ||
870 | + "time": "2015-09-13 17:39:44" | ||
871 | + }, | ||
872 | + { | ||
825 | "name": "kartik-v/php-date-formatter", | 873 | "name": "kartik-v/php-date-formatter", |
826 | "version": "v1.3.1", | 874 | "version": "v1.3.1", |
827 | "source": { | 875 | "source": { |
@@ -1060,6 +1108,56 @@ | @@ -1060,6 +1108,56 @@ | ||
1060 | "time": "2015-07-19 04:49:03" | 1108 | "time": "2015-07-19 04:49:03" |
1061 | }, | 1109 | }, |
1062 | { | 1110 | { |
1111 | + "name": "kartik-v/yii2-widget-fileinput", | ||
1112 | + "version": "dev-master", | ||
1113 | + "source": { | ||
1114 | + "type": "git", | ||
1115 | + "url": "https://github.com/kartik-v/yii2-widget-fileinput.git", | ||
1116 | + "reference": "084447f095888ddb09a95a1a363842ca87e01c9d" | ||
1117 | + }, | ||
1118 | + "dist": { | ||
1119 | + "type": "zip", | ||
1120 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-fileinput/zipball/084447f095888ddb09a95a1a363842ca87e01c9d", | ||
1121 | + "reference": "084447f095888ddb09a95a1a363842ca87e01c9d", | ||
1122 | + "shasum": "" | ||
1123 | + }, | ||
1124 | + "require": { | ||
1125 | + "kartik-v/bootstrap-fileinput": "~4.2", | ||
1126 | + "kartik-v/yii2-krajee-base": "~1.7" | ||
1127 | + }, | ||
1128 | + "type": "yii2-extension", | ||
1129 | + "autoload": { | ||
1130 | + "psr-4": { | ||
1131 | + "kartik\\file\\": "" | ||
1132 | + } | ||
1133 | + }, | ||
1134 | + "notification-url": "https://packagist.org/downloads/", | ||
1135 | + "license": [ | ||
1136 | + "BSD-3-Clause" | ||
1137 | + ], | ||
1138 | + "authors": [ | ||
1139 | + { | ||
1140 | + "name": "Kartik Visweswaran", | ||
1141 | + "email": "kartikv2@gmail.com", | ||
1142 | + "homepage": "http://www.krajee.com/" | ||
1143 | + } | ||
1144 | + ], | ||
1145 | + "description": "An enhanced FileInput widget for Bootstrap 3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)", | ||
1146 | + "homepage": "https://github.com/kartik-v/yii2-widget-fileinput", | ||
1147 | + "keywords": [ | ||
1148 | + "extension", | ||
1149 | + "file", | ||
1150 | + "form", | ||
1151 | + "input", | ||
1152 | + "jquery", | ||
1153 | + "plugin", | ||
1154 | + "upload", | ||
1155 | + "widget", | ||
1156 | + "yii2" | ||
1157 | + ], | ||
1158 | + "time": "2015-08-17 13:03:50" | ||
1159 | + }, | ||
1160 | + { | ||
1063 | "name": "mihaildev/yii2-ckeditor", | 1161 | "name": "mihaildev/yii2-ckeditor", |
1064 | "version": "1.0.1", | 1162 | "version": "1.0.1", |
1065 | "source": { | 1163 | "source": { |
@@ -1160,6 +1258,67 @@ | @@ -1160,6 +1258,67 @@ | ||
1160 | "time": "2015-02-03 12:10:50" | 1258 | "time": "2015-02-03 12:10:50" |
1161 | }, | 1259 | }, |
1162 | { | 1260 | { |
1261 | + "name": "phpmailer/phpmailer", | ||
1262 | + "version": "v5.2.14", | ||
1263 | + "source": { | ||
1264 | + "type": "git", | ||
1265 | + "url": "https://github.com/PHPMailer/PHPMailer.git", | ||
1266 | + "reference": "e774bc9152de85547336e22b8926189e582ece95" | ||
1267 | + }, | ||
1268 | + "dist": { | ||
1269 | + "type": "zip", | ||
1270 | + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e774bc9152de85547336e22b8926189e582ece95", | ||
1271 | + "reference": "e774bc9152de85547336e22b8926189e582ece95", | ||
1272 | + "shasum": "" | ||
1273 | + }, | ||
1274 | + "require": { | ||
1275 | + "php": ">=5.0.0" | ||
1276 | + }, | ||
1277 | + "require-dev": { | ||
1278 | + "phpdocumentor/phpdocumentor": "*", | ||
1279 | + "phpunit/phpunit": "4.7.*" | ||
1280 | + }, | ||
1281 | + "suggest": { | ||
1282 | + "league/oauth2-client": "Needed for XOAUTH2 authentication", | ||
1283 | + "league/oauth2-google": "Needed for Gmail XOAUTH2" | ||
1284 | + }, | ||
1285 | + "type": "library", | ||
1286 | + "autoload": { | ||
1287 | + "classmap": [ | ||
1288 | + "class.phpmailer.php", | ||
1289 | + "class.phpmaileroauth.php", | ||
1290 | + "class.phpmaileroauthgoogle.php", | ||
1291 | + "class.smtp.php", | ||
1292 | + "class.pop3.php", | ||
1293 | + "extras/EasyPeasyICS.php", | ||
1294 | + "extras/ntlm_sasl_client.php" | ||
1295 | + ] | ||
1296 | + }, | ||
1297 | + "notification-url": "https://packagist.org/downloads/", | ||
1298 | + "license": [ | ||
1299 | + "LGPL-2.1" | ||
1300 | + ], | ||
1301 | + "authors": [ | ||
1302 | + { | ||
1303 | + "name": "Jim Jagielski", | ||
1304 | + "email": "jimjag@gmail.com" | ||
1305 | + }, | ||
1306 | + { | ||
1307 | + "name": "Marcus Bointon", | ||
1308 | + "email": "phpmailer@synchromedia.co.uk" | ||
1309 | + }, | ||
1310 | + { | ||
1311 | + "name": "Andy Prevost", | ||
1312 | + "email": "codeworxtech@users.sourceforge.net" | ||
1313 | + }, | ||
1314 | + { | ||
1315 | + "name": "Brent R. Matzelle" | ||
1316 | + } | ||
1317 | + ], | ||
1318 | + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", | ||
1319 | + "time": "2015-11-01 10:15:28" | ||
1320 | + }, | ||
1321 | + { | ||
1163 | "name": "phpspec/prophecy", | 1322 | "name": "phpspec/prophecy", |
1164 | "version": "v1.5.0", | 1323 | "version": "v1.5.0", |
1165 | "source": { | 1324 | "source": { |
@@ -3016,7 +3175,8 @@ | @@ -3016,7 +3175,8 @@ | ||
3016 | "minimum-stability": "stable", | 3175 | "minimum-stability": "stable", |
3017 | "stability-flags": { | 3176 | "stability-flags": { |
3018 | "artweb/yii2-multiparser": 20, | 3177 | "artweb/yii2-multiparser": 20, |
3019 | - "kartik-v/yii2-datecontrol": 20 | 3178 | + "kartik-v/yii2-datecontrol": 20, |
3179 | + "kartik-v/yii2-widget-fileinput": 20 | ||
3020 | }, | 3180 | }, |
3021 | "prefer-stable": false, | 3181 | "prefer-stable": false, |
3022 | "prefer-lowest": false, | 3182 | "prefer-lowest": false, |
frontend/controllers/SiteController.php
@@ -12,7 +12,8 @@ use yii\web\BadRequestHttpException; | @@ -12,7 +12,8 @@ use yii\web\BadRequestHttpException; | ||
12 | use yii\web\Controller; | 12 | use yii\web\Controller; |
13 | use yii\filters\VerbFilter; | 13 | use yii\filters\VerbFilter; |
14 | use yii\filters\AccessControl; | 14 | use yii\filters\AccessControl; |
15 | - | 15 | +use common\models\Callback; |
16 | +use common\components\MailWidget; | ||
16 | /** | 17 | /** |
17 | * Site controller | 18 | * Site controller |
18 | */ | 19 | */ |
@@ -74,6 +75,20 @@ class SiteController extends Controller | @@ -74,6 +75,20 @@ class SiteController extends Controller | ||
74 | public function actionIndex() | 75 | public function actionIndex() |
75 | { | 76 | { |
76 | $this->layout = '/outer'; | 77 | $this->layout = '/outer'; |
78 | + | ||
79 | + if (Yii::$app->request->post()) { | ||
80 | + | ||
81 | + $post = Yii::$app->request->post(); | ||
82 | + if(isset($post['Callback'])){ | ||
83 | + $text = "Имя: ".$post['Callback']['name'].'<br>'; | ||
84 | + $text .= "Телефон: ".$post['Callback']['phone_num']; | ||
85 | + $model = new Callback(); | ||
86 | + $model->load(Yii::$app->request->post()); | ||
87 | + $model->save(); | ||
88 | + MailWidget::widget(['email' => 'opel-master@test.com', 'text' => $text, 'subject' => 'Обратный звонок']); | ||
89 | + } | ||
90 | + | ||
91 | + } | ||
77 | return $this->render('index'); | 92 | return $this->render('index'); |
78 | } | 93 | } |
79 | 94 |
frontend/views/layouts/main.php
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | /* @var $content string */ | 4 | /* @var $content string */ |
5 | 5 | ||
6 | use yii\helpers\Html; | 6 | use yii\helpers\Html; |
7 | +use yii\widgets\ActiveForm; | ||
7 | use yii\bootstrap\Nav; | 8 | use yii\bootstrap\Nav; |
8 | use yii\bootstrap\NavBar; | 9 | use yii\bootstrap\NavBar; |
9 | use yii\widgets\Breadcrumbs; | 10 | use yii\widgets\Breadcrumbs; |
@@ -11,7 +12,7 @@ use frontend\assets\AppAsset; | @@ -11,7 +12,7 @@ use frontend\assets\AppAsset; | ||
11 | use common\widgets\Alert; | 12 | use common\widgets\Alert; |
12 | use \yii\widgets\Menu; | 13 | use \yii\widgets\Menu; |
13 | use \yii\helpers\Url; | 14 | use \yii\helpers\Url; |
14 | - | 15 | +use common\models\Callback; |
15 | ?> | 16 | ?> |
16 | <?php $this->beginPage() ?> | 17 | <?php $this->beginPage() ?> |
17 | <!DOCTYPE html> | 18 | <!DOCTYPE html> |
@@ -114,6 +115,35 @@ use \yii\helpers\Url; | @@ -114,6 +115,35 @@ use \yii\helpers\Url; | ||
114 | 115 | ||
115 | <input type="telephone" placeholder="(0XX) XXX-XX-XX" id='get_telephone'> | 116 | <input type="telephone" placeholder="(0XX) XXX-XX-XX" id='get_telephone'> |
116 | <button class="orange" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" id='get_user_number'>Обратный звонок</button> | 117 | <button class="orange" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" id='get_user_number'>Обратный звонок</button> |
118 | + | ||
119 | + | ||
120 | + | ||
121 | + | ||
122 | + <div class="modal fade" id="registrationForm" tabindex="-1" > | ||
123 | + <div class="modal-dialog"> | ||
124 | + <div class="modal-content"> | ||
125 | + <div class="modal-header"> | ||
126 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
127 | + <h4 class="modal-title">Быстрый заказ СТО</h4> | ||
128 | + </div> | ||
129 | + <div class="form"> | ||
130 | + | ||
131 | + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'action' => '/']); ?> | ||
132 | + | ||
133 | + <?= $form->field(new Callback(), 'name')->textInput(['maxlength' => 255]) ?> | ||
134 | + | ||
135 | + <?= $form->field(new Callback(), 'phone_num')->textInput(['maxlength' => 255]) ?> | ||
136 | + | ||
137 | + <input type="submit" class="yellow_button" value="Заказать"> | ||
138 | + | ||
139 | + <?php ActiveForm::end(); ?> | ||
140 | + </div><!-- form --> | ||
141 | + </div> | ||
142 | + </div> | ||
143 | + </div> | ||
144 | + | ||
145 | + | ||
146 | + | ||
117 | <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | 147 | <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
118 | <div class="modal-dialog" role="document"> | 148 | <div class="modal-dialog" role="document"> |
119 | <div class="modal-content" > | 149 | <div class="modal-content" > |
@@ -123,20 +153,17 @@ use \yii\helpers\Url; | @@ -123,20 +153,17 @@ use \yii\helpers\Url; | ||
123 | <div class="modal-body"> | 153 | <div class="modal-body"> |
124 | <div id="modal_form_call" > | 154 | <div id="modal_form_call" > |
125 | 155 | ||
126 | - <form method="get" class="cmxform" action="" id="call_form"> | ||
127 | - <fieldset> | ||
128 | - <h3>Обратный звонок</h3> | ||
129 | 156 | ||
157 | + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','id'=>'call_form'], 'action' => '/']); ?> | ||
158 | + <fieldset> | ||
159 | + <h3>Обратный звонок</h3> | ||
160 | + <?= $form->field(new Callback(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?><span class='star'>*</span> | ||
130 | 161 | ||
162 | + <?= $form->field(new Callback(), 'phone_num')->textInput(['maxlength' => 45,'placeholder'=>'Телефон','class'=>'form-control telephone_registration'])->label(false) ?><span class='star1'>*</span> | ||
131 | 163 | ||
132 | - <input name="name" id="name" placeholder="Имя" minlength="2" type="text" required=""><span class='star'>*</span> | ||
133 | - <input type="phone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required=""><span class='star1'>*</span> | ||
134 | - <button class="purple" type="submit" value="Submit">Запросить</button> | ||
135 | - | ||
136 | - </fieldset> | ||
137 | - </form> | ||
138 | - | ||
139 | - | 164 | + <button class="purple" type="submit" value="Submit">Запросить</button> |
165 | + </fieldset> | ||
166 | + <?php ActiveForm::end(); ?> | ||
140 | 167 | ||
141 | </div> | 168 | </div> |
142 | </div> | 169 | </div> |
@@ -144,6 +171,9 @@ use \yii\helpers\Url; | @@ -144,6 +171,9 @@ use \yii\helpers\Url; | ||
144 | </div> | 171 | </div> |
145 | </div> | 172 | </div> |
146 | </div> | 173 | </div> |
174 | + | ||
175 | + | ||
176 | + | ||
147 | <div class="user"> | 177 | <div class="user"> |
148 | <img src="/images/user.png"> | 178 | <img src="/images/user.png"> |
149 | <p>Войти</p> | 179 | <p>Войти</p> |
frontend/views/news/view.php
@@ -15,7 +15,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -15,7 +15,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
15 | <?= $model->content ?> | 15 | <?= $model->content ?> |
16 | <div class="download_catalog"> | 16 | <div class="download_catalog"> |
17 | <img src="/images/ico_exel.png"> | 17 | <img src="/images/ico_exel.png"> |
18 | - <a href="">Скачать список товаров</a> | 18 | + <a href="<?= $model->price_list ?>">Скачать список товаров</a> |
19 | </div> | 19 | </div> |
20 | <div class='long_line'></div> | 20 | <div class='long_line'></div> |
21 | <div class="go_news"> | 21 | <div class="go_news"> |
frontend/web/js/script.js
@@ -854,7 +854,7 @@ $(document).ready(function(){ | @@ -854,7 +854,7 @@ $(document).ready(function(){ | ||
854 | $("#get_user_number").click(function(){ | 854 | $("#get_user_number").click(function(){ |
855 | var inputdata = $("#get_telephone").val(); | 855 | var inputdata = $("#get_telephone").val(); |
856 | if(inputdata != ''){ | 856 | if(inputdata != ''){ |
857 | - $("#telephone_registration").val(inputdata);; | 857 | + $(".telephone_registration").val(inputdata);; |
858 | } | 858 | } |
859 | }); | 859 | }); |
860 | 860 |