Commit 595ab5a0d91b002424646a6f86a35e1fb0bbf0d7
1 parent
1cbe0d9f
Загрузка изображений
Showing
9 changed files
with
151 additions
and
227 deletions
Show diff stats
1 | +<?php | |
2 | + | |
3 | +namespace common\components; | |
4 | + | |
5 | + | |
6 | +use artbox\core\components\imagemanager\components\ImageManagerGetPath; | |
7 | + | |
8 | +/** | |
9 | + * Class ImageManager | |
10 | + * @package common\components | |
11 | + */ | |
12 | +class ImageManager extends ImageManagerGetPath | |
13 | +{ | |
14 | + /** | |
15 | + * @inheritdoc | |
16 | + */ | |
17 | + public function getImagePath($ImageManager_id, $width = 400, $height = 400, $thumbnailMode = "outbound") | |
18 | + { | |
19 | + //default return | |
20 | + $return = null; | |
21 | + $mImageManager = ImageManager::findOne($ImageManager_id); | |
22 | + | |
23 | + //check if not empty | |
24 | + if ($mImageManager !== null) { | |
25 | + //set crop mode | |
26 | + $mode = $thumbnailMode == "outbound" ? "outbound" : "inset"; | |
27 | + | |
28 | + $sMediaPath = null; | |
29 | + if ($this->mediaPath !== null) { | |
30 | + $sMediaPath = $this->mediaPath; | |
31 | + } | |
32 | + | |
33 | + $sFileExtension = pathinfo($mImageManager->fileName, PATHINFO_EXTENSION); | |
34 | + //get image file path | |
35 | + $sImageFilePath = $sMediaPath . '/' . $mImageManager->id . '_' . $mImageManager->fileHash . '.' . $sFileExtension; | |
36 | + //check file exists | |
37 | + if (file_exists($sImageFilePath)) { | |
38 | + $return = \Yii::$app->imageresize->getUrl( | |
39 | + $sImageFilePath, | |
40 | + $width, | |
41 | + $height, | |
42 | + $mode, | |
43 | + 100, | |
44 | + $mImageManager->fileName | |
45 | + ); | |
46 | + } else { | |
47 | + $return = null; //isset(\Yii::$app->controller->module->assetPublishedUrl) ? \Yii::$app->controller->module->assetPublishedUrl. "/img/img_no-image.png" : null; | |
48 | + } | |
49 | + } | |
50 | + return $return; | |
51 | + } | |
52 | +} | |
0 | 53 | \ No newline at end of file | ... | ... |
common/models/Order.php
1 | 1 | <?php |
2 | 2 | |
3 | -namespace artbox\core\models; | |
3 | +namespace common\models; | |
4 | + | |
5 | +use artbox\core\models\Feedback; | |
4 | 6 | |
5 | -use Yii; | |
6 | -use yii\behaviors\AttributeBehavior; | |
7 | -use yii\behaviors\TimestampBehavior; | |
8 | -use yii\db\ActiveRecord; | |
9 | 7 | |
10 | 8 | /** |
11 | 9 | * This is the model class for table "feedback". |
... | ... | @@ -20,146 +18,20 @@ use yii\db\ActiveRecord; |
20 | 18 | * @property string $url |
21 | 19 | * @property bool $status |
22 | 20 | */ |
23 | -class Order extends ActiveRecord | |
21 | +class Order extends Feedback | |
24 | 22 | { |
25 | - | |
26 | - const SCENARIO_FEEDBACK = 'feedback'; | |
27 | - const SCENARIO_CALLBACK = 'callback'; | |
28 | - | |
29 | - public $returnUrl; | |
30 | - | |
31 | - /** | |
32 | - * @inheritdoc | |
33 | - */ | |
34 | - public static function tableName() | |
35 | - { | |
36 | - return 'feedback'; | |
37 | - } | |
38 | - | |
39 | - /** | |
40 | - * @inheritdoc | |
41 | - */ | |
42 | - public function scenarios() | |
43 | - { | |
44 | - $scenarios = parent::scenarios(); | |
45 | - $scenarios = array_merge( | |
46 | - $scenarios, | |
47 | - [ | |
48 | - self::SCENARIO_FEEDBACK => [ | |
49 | - 'product', | |
50 | - 'name', | |
51 | - 'email', | |
52 | - 'message', | |
53 | - ], | |
54 | - self::SCENARIO_CALLBACK => [ | |
55 | - 'product', | |
56 | - 'name', | |
57 | - 'phone', | |
58 | - 'message', | |
59 | - 'returnUrl', | |
60 | - ], | |
61 | - ] | |
62 | - ); | |
63 | - return $scenarios; | |
64 | - } | |
65 | - | |
66 | - /** | |
67 | - * @inheritdoc | |
68 | - */ | |
69 | - public function behaviors() | |
70 | - { | |
71 | - return [ | |
72 | - [ | |
73 | - 'class' => TimestampBehavior::className(), | |
74 | - 'updatedAtAttribute' => false, | |
75 | - ], | |
76 | - [ | |
77 | - 'class' => AttributeBehavior::className(), | |
78 | - 'attributes' => [ | |
79 | - ActiveRecord::EVENT_BEFORE_INSERT => 'ip', | |
80 | - ], | |
81 | - 'value' => function ($event) { | |
82 | - return \Yii::$app->request->userIP; | |
83 | - }, | |
84 | - ], | |
85 | - [ | |
86 | - 'class' => AttributeBehavior::className(), | |
87 | - 'attributes' => [ | |
88 | - ActiveRecord::EVENT_BEFORE_INSERT => 'url', | |
89 | - ], | |
90 | - 'value' => function ($event) { | |
91 | - return \Yii::$app->request->referrer; | |
92 | - }, | |
93 | - ], | |
94 | - ]; | |
95 | - } | |
96 | - | |
97 | - /** | |
98 | - * @inheritdoc | |
99 | - */ | |
100 | 23 | public function rules() |
101 | 24 | { |
102 | - return [ | |
25 | + return array_merge(parent::rules(), [ | |
103 | 26 | [ |
104 | - [ | |
105 | - 'product', | |
106 | - 'phone', | |
107 | - 'name', | |
108 | - 'email', | |
109 | - ], | |
110 | - 'required', | |
111 | - ], | |
112 | - [ | |
113 | - [ 'email' ], | |
114 | - 'email', | |
115 | - ], | |
116 | - // [ | |
117 | - // [ 'phone' ], | |
118 | - // 'match', | |
119 | - // 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/', | |
120 | - // ], | |
121 | - [ | |
122 | - [ | |
123 | - 'product', | |
124 | - 'name', | |
125 | - 'phone', | |
126 | - 'email', | |
127 | - ], | |
128 | - 'string', | |
129 | - 'max' => 255, | |
130 | - ], | |
131 | - [ | |
132 | - [ | |
133 | - 'message', | |
134 | - 'returnUrl,', | |
135 | - ], | |
136 | - 'string', | |
137 | - ], | |
138 | - [ | |
139 | - [ | |
140 | - 'status', | |
141 | - ], | |
142 | - 'boolean', | |
143 | - ], | |
144 | - ]; | |
27 | + ['subject'], | |
28 | + 'string' | |
29 | + ] | |
30 | + ]); | |
145 | 31 | } |
146 | 32 | |
147 | - /** | |
148 | - * @inheritdoc | |
149 | - */ | |
150 | - public function attributeLabels() | |
33 | + public function scenarios() | |
151 | 34 | { |
152 | - return [ | |
153 | - 'product' => Yii::t('core', 'product'), | |
154 | - 'id' => Yii::t('core', 'id'), | |
155 | - 'name' => Yii::t('core', 'name'), | |
156 | - 'phone' => Yii::t('core', 'phone'), | |
157 | - 'created_at' => Yii::t('core', 'created_at'), | |
158 | - 'ip' => Yii::t('core', 'ip'), | |
159 | - 'url' => Yii::t('core', 'url'), | |
160 | - 'status' => Yii::t('core', 'status'), | |
161 | - 'message' => Yii::t('core', 'message'), | |
162 | - 'email' => Yii::t('core', 'email'), | |
163 | - ]; | |
35 | + return []; | |
164 | 36 | } |
165 | 37 | } | ... | ... |
composer.json
composer.lock
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
5 | 5 | "This file is @generated automatically" |
6 | 6 | ], |
7 | - "content-hash": "1ad205bd41e4dfbc52bad09c7e6c1677", | |
7 | + "content-hash": "497cd4fa2109f53680f63a074ef3c552", | |
8 | 8 | "packages": [ |
9 | 9 | { |
10 | 10 | "name": "2amigos/yii2-tinymce-widget", |
... | ... | @@ -68,11 +68,11 @@ |
68 | 68 | }, |
69 | 69 | { |
70 | 70 | "name": "artweb/artbox-core", |
71 | - "version": "v0.0.8-stable", | |
71 | + "version": "dev-master", | |
72 | 72 | "source": { |
73 | 73 | "type": "git", |
74 | 74 | "url": "git@gitlab.artweb.com.ua:yarik.nechyporuk/artbox-core.git", |
75 | - "reference": "becbaf610b959abbe6693a4b62b6933c3574cb1a" | |
75 | + "reference": "d80f6a3ae32b635fdeb8850f68867a494f59f5d8" | |
76 | 76 | }, |
77 | 77 | "require": { |
78 | 78 | "2amigos/yii2-tinymce-widget": "~1.0", |
... | ... | @@ -95,7 +95,7 @@ |
95 | 95 | "BSD-3-Clause" |
96 | 96 | ], |
97 | 97 | "description": "Artbox core extension", |
98 | - "time": "2017-06-23T12:25:08+00:00" | |
98 | + "time": "2017-07-07 12:33:25" | |
99 | 99 | }, |
100 | 100 | { |
101 | 101 | "name": "bower-asset/amcharts", |
... | ... | @@ -154,7 +154,7 @@ |
154 | 154 | "shasum": "" |
155 | 155 | }, |
156 | 156 | "require": { |
157 | - "bower-asset/jquery": ">=1.9.1,<=3" | |
157 | + "bower-asset/jquery": ">=1.9.1,<4.0" | |
158 | 158 | }, |
159 | 159 | "type": "bower-asset-library", |
160 | 160 | "extra": { |
... | ... | @@ -2422,16 +2422,16 @@ |
2422 | 2422 | }, |
2423 | 2423 | { |
2424 | 2424 | "name": "yiister/yii2-gentelella", |
2425 | - "version": "1.2.2", | |
2425 | + "version": "1.2.3", | |
2426 | 2426 | "source": { |
2427 | 2427 | "type": "git", |
2428 | 2428 | "url": "https://github.com/yiister/yii2-gentelella.git", |
2429 | - "reference": "646ae0053c4a485d6b3d42c4ef67cbee26d74ef7" | |
2429 | + "reference": "ec02c7e89363ee2f2c074588f3f13d3751fea1b5" | |
2430 | 2430 | }, |
2431 | 2431 | "dist": { |
2432 | 2432 | "type": "zip", |
2433 | - "url": "https://api.github.com/repos/yiister/yii2-gentelella/zipball/646ae0053c4a485d6b3d42c4ef67cbee26d74ef7", | |
2434 | - "reference": "646ae0053c4a485d6b3d42c4ef67cbee26d74ef7", | |
2433 | + "url": "https://api.github.com/repos/yiister/yii2-gentelella/zipball/ec02c7e89363ee2f2c074588f3f13d3751fea1b5", | |
2434 | + "reference": "ec02c7e89363ee2f2c074588f3f13d3751fea1b5", | |
2435 | 2435 | "shasum": "" |
2436 | 2436 | }, |
2437 | 2437 | "require": { |
... | ... | @@ -2476,7 +2476,7 @@ |
2476 | 2476 | "theme", |
2477 | 2477 | "yii2" |
2478 | 2478 | ], |
2479 | - "time": "2017-05-22T11:24:30+00:00" | |
2479 | + "time": "2017-07-04T05:05:27+00:00" | |
2480 | 2480 | } |
2481 | 2481 | ], |
2482 | 2482 | "packages-dev": [ |
... | ... | @@ -3439,16 +3439,16 @@ |
3439 | 3439 | }, |
3440 | 3440 | { |
3441 | 3441 | "name": "phpunit/phpunit", |
3442 | - "version": "6.2.2", | |
3442 | + "version": "6.2.3", | |
3443 | 3443 | "source": { |
3444 | 3444 | "type": "git", |
3445 | 3445 | "url": "https://github.com/sebastianbergmann/phpunit.git", |
3446 | - "reference": "f2786490399836d2a544a34785c4a8d3ab32cf0e" | |
3446 | + "reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7" | |
3447 | 3447 | }, |
3448 | 3448 | "dist": { |
3449 | 3449 | "type": "zip", |
3450 | - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f2786490399836d2a544a34785c4a8d3ab32cf0e", | |
3451 | - "reference": "f2786490399836d2a544a34785c4a8d3ab32cf0e", | |
3450 | + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa5711d0559fc4b64deba0702be52d41434cbcb7", | |
3451 | + "reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7", | |
3452 | 3452 | "shasum": "" |
3453 | 3453 | }, |
3454 | 3454 | "require": { |
... | ... | @@ -3519,20 +3519,20 @@ |
3519 | 3519 | "testing", |
3520 | 3520 | "xunit" |
3521 | 3521 | ], |
3522 | - "time": "2017-06-13T14:07:07+00:00" | |
3522 | + "time": "2017-07-03T15:54:24+00:00" | |
3523 | 3523 | }, |
3524 | 3524 | { |
3525 | 3525 | "name": "phpunit/phpunit-mock-objects", |
3526 | - "version": "4.0.1", | |
3526 | + "version": "4.0.2", | |
3527 | 3527 | "source": { |
3528 | 3528 | "type": "git", |
3529 | 3529 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", |
3530 | - "reference": "eabce450df194817a7d7e27e19013569a903a2bf" | |
3530 | + "reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4" | |
3531 | 3531 | }, |
3532 | 3532 | "dist": { |
3533 | 3533 | "type": "zip", |
3534 | - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/eabce450df194817a7d7e27e19013569a903a2bf", | |
3535 | - "reference": "eabce450df194817a7d7e27e19013569a903a2bf", | |
3534 | + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4", | |
3535 | + "reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4", | |
3536 | 3536 | "shasum": "" |
3537 | 3537 | }, |
3538 | 3538 | "require": { |
... | ... | @@ -3578,7 +3578,7 @@ |
3578 | 3578 | "mock", |
3579 | 3579 | "xunit" |
3580 | 3580 | ], |
3581 | - "time": "2017-03-03T06:30:20+00:00" | |
3581 | + "time": "2017-06-30T08:15:21+00:00" | |
3582 | 3582 | }, |
3583 | 3583 | { |
3584 | 3584 | "name": "sebastian/code-unit-reverse-lookup", |
... | ... | @@ -3743,16 +3743,16 @@ |
3743 | 3743 | }, |
3744 | 3744 | { |
3745 | 3745 | "name": "sebastian/environment", |
3746 | - "version": "3.0.4", | |
3746 | + "version": "3.1.0", | |
3747 | 3747 | "source": { |
3748 | 3748 | "type": "git", |
3749 | 3749 | "url": "https://github.com/sebastianbergmann/environment.git", |
3750 | - "reference": "74776f8dbc081cab9287c2a601c0c1d842568744" | |
3750 | + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" | |
3751 | 3751 | }, |
3752 | 3752 | "dist": { |
3753 | 3753 | "type": "zip", |
3754 | - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/74776f8dbc081cab9287c2a601c0c1d842568744", | |
3755 | - "reference": "74776f8dbc081cab9287c2a601c0c1d842568744", | |
3754 | + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", | |
3755 | + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", | |
3756 | 3756 | "shasum": "" |
3757 | 3757 | }, |
3758 | 3758 | "require": { |
... | ... | @@ -3764,7 +3764,7 @@ |
3764 | 3764 | "type": "library", |
3765 | 3765 | "extra": { |
3766 | 3766 | "branch-alias": { |
3767 | - "dev-master": "3.0.x-dev" | |
3767 | + "dev-master": "3.1.x-dev" | |
3768 | 3768 | } |
3769 | 3769 | }, |
3770 | 3770 | "autoload": { |
... | ... | @@ -3789,7 +3789,7 @@ |
3789 | 3789 | "environment", |
3790 | 3790 | "hhvm" |
3791 | 3791 | ], |
3792 | - "time": "2017-06-20T16:25:05+00:00" | |
3792 | + "time": "2017-07-01T08:51:00+00:00" | |
3793 | 3793 | }, |
3794 | 3794 | { |
3795 | 3795 | "name": "sebastian/exporter", |
... | ... | @@ -4186,16 +4186,16 @@ |
4186 | 4186 | }, |
4187 | 4187 | { |
4188 | 4188 | "name": "symfony/browser-kit", |
4189 | - "version": "v3.3.2", | |
4189 | + "version": "v3.3.4", | |
4190 | 4190 | "source": { |
4191 | 4191 | "type": "git", |
4192 | 4192 | "url": "https://github.com/symfony/browser-kit.git", |
4193 | - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1" | |
4193 | + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5" | |
4194 | 4194 | }, |
4195 | 4195 | "dist": { |
4196 | 4196 | "type": "zip", |
4197 | - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", | |
4198 | - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", | |
4197 | + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/3a4435e79a8401746e8525e98039199d0924b4e5", | |
4198 | + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5", | |
4199 | 4199 | "shasum": "" |
4200 | 4200 | }, |
4201 | 4201 | "require": { |
... | ... | @@ -4239,20 +4239,20 @@ |
4239 | 4239 | ], |
4240 | 4240 | "description": "Symfony BrowserKit Component", |
4241 | 4241 | "homepage": "https://symfony.com", |
4242 | - "time": "2017-04-12T14:14:56+00:00" | |
4242 | + "time": "2017-06-24T09:29:48+00:00" | |
4243 | 4243 | }, |
4244 | 4244 | { |
4245 | 4245 | "name": "symfony/console", |
4246 | - "version": "v3.3.2", | |
4246 | + "version": "v3.3.4", | |
4247 | 4247 | "source": { |
4248 | 4248 | "type": "git", |
4249 | 4249 | "url": "https://github.com/symfony/console.git", |
4250 | - "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e" | |
4250 | + "reference": "a97e45d98c59510f085fa05225a1acb74dfe0546" | |
4251 | 4251 | }, |
4252 | 4252 | "dist": { |
4253 | 4253 | "type": "zip", |
4254 | - "url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e", | |
4255 | - "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e", | |
4254 | + "url": "https://api.github.com/repos/symfony/console/zipball/a97e45d98c59510f085fa05225a1acb74dfe0546", | |
4255 | + "reference": "a97e45d98c59510f085fa05225a1acb74dfe0546", | |
4256 | 4256 | "shasum": "" |
4257 | 4257 | }, |
4258 | 4258 | "require": { |
... | ... | @@ -4308,11 +4308,11 @@ |
4308 | 4308 | ], |
4309 | 4309 | "description": "Symfony Console Component", |
4310 | 4310 | "homepage": "https://symfony.com", |
4311 | - "time": "2017-06-02T19:24:58+00:00" | |
4311 | + "time": "2017-07-03T13:19:36+00:00" | |
4312 | 4312 | }, |
4313 | 4313 | { |
4314 | 4314 | "name": "symfony/css-selector", |
4315 | - "version": "v3.3.2", | |
4315 | + "version": "v3.3.4", | |
4316 | 4316 | "source": { |
4317 | 4317 | "type": "git", |
4318 | 4318 | "url": "https://github.com/symfony/css-selector.git", |
... | ... | @@ -4365,16 +4365,16 @@ |
4365 | 4365 | }, |
4366 | 4366 | { |
4367 | 4367 | "name": "symfony/debug", |
4368 | - "version": "v3.3.2", | |
4368 | + "version": "v3.3.4", | |
4369 | 4369 | "source": { |
4370 | 4370 | "type": "git", |
4371 | 4371 | "url": "https://github.com/symfony/debug.git", |
4372 | - "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d" | |
4372 | + "reference": "63b85a968486d95ff9542228dc2e4247f16f9743" | |
4373 | 4373 | }, |
4374 | 4374 | "dist": { |
4375 | 4375 | "type": "zip", |
4376 | - "url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d", | |
4377 | - "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d", | |
4376 | + "url": "https://api.github.com/repos/symfony/debug/zipball/63b85a968486d95ff9542228dc2e4247f16f9743", | |
4377 | + "reference": "63b85a968486d95ff9542228dc2e4247f16f9743", | |
4378 | 4378 | "shasum": "" |
4379 | 4379 | }, |
4380 | 4380 | "require": { |
... | ... | @@ -4417,11 +4417,11 @@ |
4417 | 4417 | ], |
4418 | 4418 | "description": "Symfony Debug Component", |
4419 | 4419 | "homepage": "https://symfony.com", |
4420 | - "time": "2017-06-01T21:01:25+00:00" | |
4420 | + "time": "2017-07-05T13:02:37+00:00" | |
4421 | 4421 | }, |
4422 | 4422 | { |
4423 | 4423 | "name": "symfony/dom-crawler", |
4424 | - "version": "v3.3.2", | |
4424 | + "version": "v3.3.4", | |
4425 | 4425 | "source": { |
4426 | 4426 | "type": "git", |
4427 | 4427 | "url": "https://github.com/symfony/dom-crawler.git", |
... | ... | @@ -4477,16 +4477,16 @@ |
4477 | 4477 | }, |
4478 | 4478 | { |
4479 | 4479 | "name": "symfony/event-dispatcher", |
4480 | - "version": "v3.3.2", | |
4480 | + "version": "v3.3.4", | |
4481 | 4481 | "source": { |
4482 | 4482 | "type": "git", |
4483 | 4483 | "url": "https://github.com/symfony/event-dispatcher.git", |
4484 | - "reference": "4054a102470665451108f9b59305c79176ef98f0" | |
4484 | + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e" | |
4485 | 4485 | }, |
4486 | 4486 | "dist": { |
4487 | 4487 | "type": "zip", |
4488 | - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4054a102470665451108f9b59305c79176ef98f0", | |
4489 | - "reference": "4054a102470665451108f9b59305c79176ef98f0", | |
4488 | + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/67535f1e3fd662bdc68d7ba317c93eecd973617e", | |
4489 | + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e", | |
4490 | 4490 | "shasum": "" |
4491 | 4491 | }, |
4492 | 4492 | "require": { |
... | ... | @@ -4536,11 +4536,11 @@ |
4536 | 4536 | ], |
4537 | 4537 | "description": "Symfony EventDispatcher Component", |
4538 | 4538 | "homepage": "https://symfony.com", |
4539 | - "time": "2017-06-04T18:15:29+00:00" | |
4539 | + "time": "2017-06-09T14:53:08+00:00" | |
4540 | 4540 | }, |
4541 | 4541 | { |
4542 | 4542 | "name": "symfony/finder", |
4543 | - "version": "v3.3.2", | |
4543 | + "version": "v3.3.4", | |
4544 | 4544 | "source": { |
4545 | 4545 | "type": "git", |
4546 | 4546 | "url": "https://github.com/symfony/finder.git", |
... | ... | @@ -4648,16 +4648,16 @@ |
4648 | 4648 | }, |
4649 | 4649 | { |
4650 | 4650 | "name": "symfony/yaml", |
4651 | - "version": "v3.3.2", | |
4651 | + "version": "v3.3.4", | |
4652 | 4652 | "source": { |
4653 | 4653 | "type": "git", |
4654 | 4654 | "url": "https://github.com/symfony/yaml.git", |
4655 | - "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063" | |
4655 | + "reference": "1f93a8d19b8241617f5074a123e282575b821df8" | |
4656 | 4656 | }, |
4657 | 4657 | "dist": { |
4658 | 4658 | "type": "zip", |
4659 | - "url": "https://api.github.com/repos/symfony/yaml/zipball/9752a30000a8ca9f4b34b5227d15d0101b96b063", | |
4660 | - "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063", | |
4659 | + "url": "https://api.github.com/repos/symfony/yaml/zipball/1f93a8d19b8241617f5074a123e282575b821df8", | |
4660 | + "reference": "1f93a8d19b8241617f5074a123e282575b821df8", | |
4661 | 4661 | "shasum": "" |
4662 | 4662 | }, |
4663 | 4663 | "require": { |
... | ... | @@ -4699,7 +4699,7 @@ |
4699 | 4699 | ], |
4700 | 4700 | "description": "Symfony Yaml Component", |
4701 | 4701 | "homepage": "https://symfony.com", |
4702 | - "time": "2017-06-02T22:05:06+00:00" | |
4702 | + "time": "2017-06-15T12:58:50+00:00" | |
4703 | 4703 | }, |
4704 | 4704 | { |
4705 | 4705 | "name": "theseer/tokenizer", |
... | ... | @@ -4942,6 +4942,7 @@ |
4942 | 4942 | "aliases": [], |
4943 | 4943 | "minimum-stability": "stable", |
4944 | 4944 | "stability-flags": { |
4945 | + "artweb/artbox-core": 20, | |
4945 | 4946 | "bower-asset/amcharts-stock": 20, |
4946 | 4947 | "kartik-v/yii2-widget-select2": 20 |
4947 | 4948 | }, | ... | ... |
console/migrations/m170707_104149_add_subject_column_to_feedback_table.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Handles adding subject to table `feedback`. | |
7 | + */ | |
8 | +class m170707_104149_add_subject_column_to_feedback_table extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * @inheritdoc | |
12 | + */ | |
13 | + public function up() | |
14 | + { | |
15 | + $this->addColumn('feedback', 'subject', $this->string()); | |
16 | + } | |
17 | + | |
18 | + /** | |
19 | + * @inheritdoc | |
20 | + */ | |
21 | + public function down() | |
22 | + { | |
23 | + $this->dropColumn('feedback'); | |
24 | + } | |
25 | +} | ... | ... |
frontend/controllers/SiteController.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | 4 | use artbox\core\models\Feedback; |
5 | + use common\models\Order; | |
5 | 6 | use common\models\Settings; |
6 | 7 | use Yii; |
7 | 8 | use yii\web\BadRequestHttpException; |
... | ... | @@ -104,33 +105,6 @@ |
104 | 105 | if (empty( Yii::$app->request->post() )) { |
105 | 106 | throw new BadRequestHttpException(); |
106 | 107 | } else { |
107 | - $model = new Feedback(); | |
108 | - if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
109 | - return [ | |
110 | - 'success' => true, | |
111 | - 'message' => 'Success message', | |
112 | - 'alert' => '<div class="alert alert-success"> | |
113 | - <h3>Success</h3> | |
114 | - <p> | |
115 | - Success text | |
116 | - </p> | |
117 | - </div>', | |
118 | - ]; | |
119 | - } else { | |
120 | - return [ | |
121 | - 'success' => false, | |
122 | - 'error' => $model->errors, | |
123 | - ]; | |
124 | - } | |
125 | - } | |
126 | - } | |
127 | - | |
128 | - public function actionOrder() | |
129 | - { | |
130 | - Yii::$app->response->format = Response::FORMAT_JSON; | |
131 | - if (empty( Yii::$app->request->post() )) { | |
132 | - throw new BadRequestHttpException(); | |
133 | - } else { | |
134 | 108 | $model = new Order(); |
135 | 109 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
136 | 110 | return [ | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | AppAsset::register($this); |
25 | 25 | $user = \Yii::$app->user->identity; |
26 | 26 | $seo = Yii::$app->get('seo'); |
27 | - $feedback = new Feedback(); | |
27 | + $feedback = new \common\models\Order(); | |
28 | 28 | $settings = Settings::getInstance(); |
29 | 29 | $controller = Yii::$app->controller; |
30 | 30 | $default_controller = Yii::$app->defaultRoute; |
... | ... | @@ -407,7 +407,7 @@ _________________________________________________________ --> |
407 | 407 | ] |
408 | 408 | ); ?> |
409 | 409 | |
410 | - <?= $form->field($feedback, 'product') | |
410 | + <?= $form->field($feedback, 'subject') | |
411 | 411 | ->hiddenInput(); ?> |
412 | 412 | |
413 | 413 | <?= $form->field($feedback, 'name') | ... | ... |
frontend/views/site/contact.php
frontend/views/site/index.php
... | ... | @@ -125,7 +125,7 @@ _________________________________________________________ --> |
125 | 125 | <li><i class="fa fa-check"></i>Блог с рубриками</li> |
126 | 126 | <li><i class="fa fa-check"></i>SEO-оптимизация + аналитика</li> |
127 | 127 | </ul> |
128 | - <a href="#" class="btn btn-template-primary">Выбрать</a> | |
128 | + <a href="#" class="btn btn-template-primary" data-toggle="modal" data-target="#order-modal">Выбрать</a> | |
129 | 129 | <a href="<?=Url::to([ |
130 | 130 | '/page/view', |
131 | 131 | 'id' => 3 |
... | ... | @@ -151,7 +151,7 @@ _________________________________________________________ --> |
151 | 151 | <li><i class="fa fa-check"></i>Экспорт и импорт товаров</li> |
152 | 152 | <li><i class="fa fa-check"></i>Обратная связь с клиентами</li> |
153 | 153 | </ul> |
154 | - <a href="#" class="btn btn-template-primary"> | |
154 | + <a href="#" class="btn btn-template-primary" data-toggle="modal" data-target="#order-modal"> | |
155 | 155 | |
156 | 156 | Выбрать </a> |
157 | 157 | <a href="<?=Url::to([ |
... | ... | @@ -178,7 +178,7 @@ _________________________________________________________ --> |
178 | 178 | <li><i class="fa fa-check"></i>Заказы и статусы заказов</li> |
179 | 179 | <li><i class="fa fa-check"></i>Личный кабинет клиента</li> |
180 | 180 | </ul> |
181 | - <a href="#" class="btn btn-template-primary"> | |
181 | + <a href="#" class="btn btn-template-primary" data-toggle="modal" data-target="#order-modal"> | |
182 | 182 | |
183 | 183 | Выбрать </a> |
184 | 184 | <a href="<?=Url::to([ | ... | ... |