Commit 595ab5a0d91b002424646a6f86a35e1fb0bbf0d7

Authored by Eugeny Galkovskiy
1 parent 1cbe0d9f

Загрузка изображений

common/components/ImageManager.php 0 → 100644
  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 \ No newline at end of file 53 \ No newline at end of file
common/models/Order.php
1 <?php 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 * This is the model class for table "feedback". 9 * This is the model class for table "feedback".
@@ -20,146 +18,20 @@ use yii\db\ActiveRecord; @@ -20,146 +18,20 @@ use yii\db\ActiveRecord;
20 * @property string $url 18 * @property string $url
21 * @property bool $status 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 public function rules() 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 }
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 "minimum-stability": "stable", 18 "minimum-stability": "stable",
19 "require": { 19 "require": {
20 "php": ">=7.0", 20 "php": ">=7.0",
21 - "artweb/artbox-core": "~0.0.1", 21 + "artweb/artbox-core": "@dev",
22 "yiisoft/yii2": "~2.0", 22 "yiisoft/yii2": "~2.0",
23 "yiisoft/yii2-bootstrap": "~2.0", 23 "yiisoft/yii2-bootstrap": "~2.0",
24 "yiisoft/yii2-swiftmailer": "~2.0", 24 "yiisoft/yii2-swiftmailer": "~2.0",
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
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 - "content-hash": "1ad205bd41e4dfbc52bad09c7e6c1677", 7 + "content-hash": "497cd4fa2109f53680f63a074ef3c552",
8 "packages": [ 8 "packages": [
9 { 9 {
10 "name": "2amigos/yii2-tinymce-widget", 10 "name": "2amigos/yii2-tinymce-widget",
@@ -68,11 +68,11 @@ @@ -68,11 +68,11 @@
68 }, 68 },
69 { 69 {
70 "name": "artweb/artbox-core", 70 "name": "artweb/artbox-core",
71 - "version": "v0.0.8-stable", 71 + "version": "dev-master",
72 "source": { 72 "source": {
73 "type": "git", 73 "type": "git",
74 "url": "git@gitlab.artweb.com.ua:yarik.nechyporuk/artbox-core.git", 74 "url": "git@gitlab.artweb.com.ua:yarik.nechyporuk/artbox-core.git",
75 - "reference": "becbaf610b959abbe6693a4b62b6933c3574cb1a" 75 + "reference": "d80f6a3ae32b635fdeb8850f68867a494f59f5d8"
76 }, 76 },
77 "require": { 77 "require": {
78 "2amigos/yii2-tinymce-widget": "~1.0", 78 "2amigos/yii2-tinymce-widget": "~1.0",
@@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
95 "BSD-3-Clause" 95 "BSD-3-Clause"
96 ], 96 ],
97 "description": "Artbox core extension", 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 "name": "bower-asset/amcharts", 101 "name": "bower-asset/amcharts",
@@ -154,7 +154,7 @@ @@ -154,7 +154,7 @@
154 "shasum": "" 154 "shasum": ""
155 }, 155 },
156 "require": { 156 "require": {
157 - "bower-asset/jquery": ">=1.9.1,<=3" 157 + "bower-asset/jquery": ">=1.9.1,<4.0"
158 }, 158 },
159 "type": "bower-asset-library", 159 "type": "bower-asset-library",
160 "extra": { 160 "extra": {
@@ -2422,16 +2422,16 @@ @@ -2422,16 +2422,16 @@
2422 }, 2422 },
2423 { 2423 {
2424 "name": "yiister/yii2-gentelella", 2424 "name": "yiister/yii2-gentelella",
2425 - "version": "1.2.2", 2425 + "version": "1.2.3",
2426 "source": { 2426 "source": {
2427 "type": "git", 2427 "type": "git",
2428 "url": "https://github.com/yiister/yii2-gentelella.git", 2428 "url": "https://github.com/yiister/yii2-gentelella.git",
2429 - "reference": "646ae0053c4a485d6b3d42c4ef67cbee26d74ef7" 2429 + "reference": "ec02c7e89363ee2f2c074588f3f13d3751fea1b5"
2430 }, 2430 },
2431 "dist": { 2431 "dist": {
2432 "type": "zip", 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 "shasum": "" 2435 "shasum": ""
2436 }, 2436 },
2437 "require": { 2437 "require": {
@@ -2476,7 +2476,7 @@ @@ -2476,7 +2476,7 @@
2476 "theme", 2476 "theme",
2477 "yii2" 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 "packages-dev": [ 2482 "packages-dev": [
@@ -3439,16 +3439,16 @@ @@ -3439,16 +3439,16 @@
3439 }, 3439 },
3440 { 3440 {
3441 "name": "phpunit/phpunit", 3441 "name": "phpunit/phpunit",
3442 - "version": "6.2.2", 3442 + "version": "6.2.3",
3443 "source": { 3443 "source": {
3444 "type": "git", 3444 "type": "git",
3445 "url": "https://github.com/sebastianbergmann/phpunit.git", 3445 "url": "https://github.com/sebastianbergmann/phpunit.git",
3446 - "reference": "f2786490399836d2a544a34785c4a8d3ab32cf0e" 3446 + "reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7"
3447 }, 3447 },
3448 "dist": { 3448 "dist": {
3449 "type": "zip", 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 "shasum": "" 3452 "shasum": ""
3453 }, 3453 },
3454 "require": { 3454 "require": {
@@ -3519,20 +3519,20 @@ @@ -3519,20 +3519,20 @@
3519 "testing", 3519 "testing",
3520 "xunit" 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 "name": "phpunit/phpunit-mock-objects", 3525 "name": "phpunit/phpunit-mock-objects",
3526 - "version": "4.0.1", 3526 + "version": "4.0.2",
3527 "source": { 3527 "source": {
3528 "type": "git", 3528 "type": "git",
3529 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 3529 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
3530 - "reference": "eabce450df194817a7d7e27e19013569a903a2bf" 3530 + "reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4"
3531 }, 3531 },
3532 "dist": { 3532 "dist": {
3533 "type": "zip", 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 "shasum": "" 3536 "shasum": ""
3537 }, 3537 },
3538 "require": { 3538 "require": {
@@ -3578,7 +3578,7 @@ @@ -3578,7 +3578,7 @@
3578 "mock", 3578 "mock",
3579 "xunit" 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 "name": "sebastian/code-unit-reverse-lookup", 3584 "name": "sebastian/code-unit-reverse-lookup",
@@ -3743,16 +3743,16 @@ @@ -3743,16 +3743,16 @@
3743 }, 3743 },
3744 { 3744 {
3745 "name": "sebastian/environment", 3745 "name": "sebastian/environment",
3746 - "version": "3.0.4", 3746 + "version": "3.1.0",
3747 "source": { 3747 "source": {
3748 "type": "git", 3748 "type": "git",
3749 "url": "https://github.com/sebastianbergmann/environment.git", 3749 "url": "https://github.com/sebastianbergmann/environment.git",
3750 - "reference": "74776f8dbc081cab9287c2a601c0c1d842568744" 3750 + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5"
3751 }, 3751 },
3752 "dist": { 3752 "dist": {
3753 "type": "zip", 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 "shasum": "" 3756 "shasum": ""
3757 }, 3757 },
3758 "require": { 3758 "require": {
@@ -3764,7 +3764,7 @@ @@ -3764,7 +3764,7 @@
3764 "type": "library", 3764 "type": "library",
3765 "extra": { 3765 "extra": {
3766 "branch-alias": { 3766 "branch-alias": {
3767 - "dev-master": "3.0.x-dev" 3767 + "dev-master": "3.1.x-dev"
3768 } 3768 }
3769 }, 3769 },
3770 "autoload": { 3770 "autoload": {
@@ -3789,7 +3789,7 @@ @@ -3789,7 +3789,7 @@
3789 "environment", 3789 "environment",
3790 "hhvm" 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 "name": "sebastian/exporter", 3795 "name": "sebastian/exporter",
@@ -4186,16 +4186,16 @@ @@ -4186,16 +4186,16 @@
4186 }, 4186 },
4187 { 4187 {
4188 "name": "symfony/browser-kit", 4188 "name": "symfony/browser-kit",
4189 - "version": "v3.3.2", 4189 + "version": "v3.3.4",
4190 "source": { 4190 "source": {
4191 "type": "git", 4191 "type": "git",
4192 "url": "https://github.com/symfony/browser-kit.git", 4192 "url": "https://github.com/symfony/browser-kit.git",
4193 - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1" 4193 + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5"
4194 }, 4194 },
4195 "dist": { 4195 "dist": {
4196 "type": "zip", 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 "shasum": "" 4199 "shasum": ""
4200 }, 4200 },
4201 "require": { 4201 "require": {
@@ -4239,20 +4239,20 @@ @@ -4239,20 +4239,20 @@
4239 ], 4239 ],
4240 "description": "Symfony BrowserKit Component", 4240 "description": "Symfony BrowserKit Component",
4241 "homepage": "https://symfony.com", 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 "name": "symfony/console", 4245 "name": "symfony/console",
4246 - "version": "v3.3.2", 4246 + "version": "v3.3.4",
4247 "source": { 4247 "source": {
4248 "type": "git", 4248 "type": "git",
4249 "url": "https://github.com/symfony/console.git", 4249 "url": "https://github.com/symfony/console.git",
4250 - "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e" 4250 + "reference": "a97e45d98c59510f085fa05225a1acb74dfe0546"
4251 }, 4251 },
4252 "dist": { 4252 "dist": {
4253 "type": "zip", 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 "shasum": "" 4256 "shasum": ""
4257 }, 4257 },
4258 "require": { 4258 "require": {
@@ -4308,11 +4308,11 @@ @@ -4308,11 +4308,11 @@
4308 ], 4308 ],
4309 "description": "Symfony Console Component", 4309 "description": "Symfony Console Component",
4310 "homepage": "https://symfony.com", 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 "name": "symfony/css-selector", 4314 "name": "symfony/css-selector",
4315 - "version": "v3.3.2", 4315 + "version": "v3.3.4",
4316 "source": { 4316 "source": {
4317 "type": "git", 4317 "type": "git",
4318 "url": "https://github.com/symfony/css-selector.git", 4318 "url": "https://github.com/symfony/css-selector.git",
@@ -4365,16 +4365,16 @@ @@ -4365,16 +4365,16 @@
4365 }, 4365 },
4366 { 4366 {
4367 "name": "symfony/debug", 4367 "name": "symfony/debug",
4368 - "version": "v3.3.2", 4368 + "version": "v3.3.4",
4369 "source": { 4369 "source": {
4370 "type": "git", 4370 "type": "git",
4371 "url": "https://github.com/symfony/debug.git", 4371 "url": "https://github.com/symfony/debug.git",
4372 - "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d" 4372 + "reference": "63b85a968486d95ff9542228dc2e4247f16f9743"
4373 }, 4373 },
4374 "dist": { 4374 "dist": {
4375 "type": "zip", 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 "shasum": "" 4378 "shasum": ""
4379 }, 4379 },
4380 "require": { 4380 "require": {
@@ -4417,11 +4417,11 @@ @@ -4417,11 +4417,11 @@
4417 ], 4417 ],
4418 "description": "Symfony Debug Component", 4418 "description": "Symfony Debug Component",
4419 "homepage": "https://symfony.com", 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 "name": "symfony/dom-crawler", 4423 "name": "symfony/dom-crawler",
4424 - "version": "v3.3.2", 4424 + "version": "v3.3.4",
4425 "source": { 4425 "source": {
4426 "type": "git", 4426 "type": "git",
4427 "url": "https://github.com/symfony/dom-crawler.git", 4427 "url": "https://github.com/symfony/dom-crawler.git",
@@ -4477,16 +4477,16 @@ @@ -4477,16 +4477,16 @@
4477 }, 4477 },
4478 { 4478 {
4479 "name": "symfony/event-dispatcher", 4479 "name": "symfony/event-dispatcher",
4480 - "version": "v3.3.2", 4480 + "version": "v3.3.4",
4481 "source": { 4481 "source": {
4482 "type": "git", 4482 "type": "git",
4483 "url": "https://github.com/symfony/event-dispatcher.git", 4483 "url": "https://github.com/symfony/event-dispatcher.git",
4484 - "reference": "4054a102470665451108f9b59305c79176ef98f0" 4484 + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e"
4485 }, 4485 },
4486 "dist": { 4486 "dist": {
4487 "type": "zip", 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 "shasum": "" 4490 "shasum": ""
4491 }, 4491 },
4492 "require": { 4492 "require": {
@@ -4536,11 +4536,11 @@ @@ -4536,11 +4536,11 @@
4536 ], 4536 ],
4537 "description": "Symfony EventDispatcher Component", 4537 "description": "Symfony EventDispatcher Component",
4538 "homepage": "https://symfony.com", 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 "name": "symfony/finder", 4542 "name": "symfony/finder",
4543 - "version": "v3.3.2", 4543 + "version": "v3.3.4",
4544 "source": { 4544 "source": {
4545 "type": "git", 4545 "type": "git",
4546 "url": "https://github.com/symfony/finder.git", 4546 "url": "https://github.com/symfony/finder.git",
@@ -4648,16 +4648,16 @@ @@ -4648,16 +4648,16 @@
4648 }, 4648 },
4649 { 4649 {
4650 "name": "symfony/yaml", 4650 "name": "symfony/yaml",
4651 - "version": "v3.3.2", 4651 + "version": "v3.3.4",
4652 "source": { 4652 "source": {
4653 "type": "git", 4653 "type": "git",
4654 "url": "https://github.com/symfony/yaml.git", 4654 "url": "https://github.com/symfony/yaml.git",
4655 - "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063" 4655 + "reference": "1f93a8d19b8241617f5074a123e282575b821df8"
4656 }, 4656 },
4657 "dist": { 4657 "dist": {
4658 "type": "zip", 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 "shasum": "" 4661 "shasum": ""
4662 }, 4662 },
4663 "require": { 4663 "require": {
@@ -4699,7 +4699,7 @@ @@ -4699,7 +4699,7 @@
4699 ], 4699 ],
4700 "description": "Symfony Yaml Component", 4700 "description": "Symfony Yaml Component",
4701 "homepage": "https://symfony.com", 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 "name": "theseer/tokenizer", 4705 "name": "theseer/tokenizer",
@@ -4942,6 +4942,7 @@ @@ -4942,6 +4942,7 @@
4942 "aliases": [], 4942 "aliases": [],
4943 "minimum-stability": "stable", 4943 "minimum-stability": "stable",
4944 "stability-flags": { 4944 "stability-flags": {
  4945 + "artweb/artbox-core": 20,
4945 "bower-asset/amcharts-stock": 20, 4946 "bower-asset/amcharts-stock": 20,
4946 "kartik-v/yii2-widget-select2": 20 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,6 +2,7 @@
2 namespace frontend\controllers; 2 namespace frontend\controllers;
3 3
4 use artbox\core\models\Feedback; 4 use artbox\core\models\Feedback;
  5 + use common\models\Order;
5 use common\models\Settings; 6 use common\models\Settings;
6 use Yii; 7 use Yii;
7 use yii\web\BadRequestHttpException; 8 use yii\web\BadRequestHttpException;
@@ -104,33 +105,6 @@ @@ -104,33 +105,6 @@
104 if (empty( Yii::$app->request->post() )) { 105 if (empty( Yii::$app->request->post() )) {
105 throw new BadRequestHttpException(); 106 throw new BadRequestHttpException();
106 } else { 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 $model = new Order(); 108 $model = new Order();
135 if ($model->load(Yii::$app->request->post()) && $model->save()) { 109 if ($model->load(Yii::$app->request->post()) && $model->save()) {
136 return [ 110 return [
frontend/views/layouts/main.php
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 AppAsset::register($this); 24 AppAsset::register($this);
25 $user = \Yii::$app->user->identity; 25 $user = \Yii::$app->user->identity;
26 $seo = Yii::$app->get('seo'); 26 $seo = Yii::$app->get('seo');
27 - $feedback = new Feedback(); 27 + $feedback = new \common\models\Order();
28 $settings = Settings::getInstance(); 28 $settings = Settings::getInstance();
29 $controller = Yii::$app->controller; 29 $controller = Yii::$app->controller;
30 $default_controller = Yii::$app->defaultRoute; 30 $default_controller = Yii::$app->defaultRoute;
@@ -407,7 +407,7 @@ _________________________________________________________ --&gt; @@ -407,7 +407,7 @@ _________________________________________________________ --&gt;
407 ] 407 ]
408 ); ?> 408 ); ?>
409 409
410 - <?= $form->field($feedback, 'product') 410 + <?= $form->field($feedback, 'subject')
411 ->hiddenInput(); ?> 411 ->hiddenInput(); ?>
412 412
413 <?= $form->field($feedback, 'name') 413 <?= $form->field($feedback, 'name')
frontend/views/site/contact.php
@@ -105,7 +105,7 @@ JS; @@ -105,7 +105,7 @@ JS;
105 105
106 <div class="col-md-12"> 106 <div class="col-md-12">
107 <div class="heading"> 107 <div class="heading">
108 - <h2> Contact form </h2> 108 + <h2> Напишите нам </h2>
109 </div> 109 </div>
110 </div> 110 </div>
111 111
frontend/views/site/index.php
@@ -125,7 +125,7 @@ _________________________________________________________ --&gt; @@ -125,7 +125,7 @@ _________________________________________________________ --&gt;
125 <li><i class="fa fa-check"></i>Блог с рубриками</li> 125 <li><i class="fa fa-check"></i>Блог с рубриками</li>
126 <li><i class="fa fa-check"></i>SEO-оптимизация + аналитика</li> 126 <li><i class="fa fa-check"></i>SEO-оптимизация + аналитика</li>
127 </ul> 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 <a href="<?=Url::to([ 129 <a href="<?=Url::to([
130 '/page/view', 130 '/page/view',
131 'id' => 3 131 'id' => 3
@@ -151,7 +151,7 @@ _________________________________________________________ --&gt; @@ -151,7 +151,7 @@ _________________________________________________________ --&gt;
151 <li><i class="fa fa-check"></i>Экспорт и импорт товаров</li> 151 <li><i class="fa fa-check"></i>Экспорт и импорт товаров</li>
152 <li><i class="fa fa-check"></i>Обратная связь с клиентами</li> 152 <li><i class="fa fa-check"></i>Обратная связь с клиентами</li>
153 </ul> 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 Выбрать </a> 156 Выбрать </a>
157 <a href="<?=Url::to([ 157 <a href="<?=Url::to([
@@ -178,7 +178,7 @@ _________________________________________________________ --&gt; @@ -178,7 +178,7 @@ _________________________________________________________ --&gt;
178 <li><i class="fa fa-check"></i>Заказы и статусы заказов</li> 178 <li><i class="fa fa-check"></i>Заказы и статусы заказов</li>
179 <li><i class="fa fa-check"></i>Личный кабинет клиента</li> 179 <li><i class="fa fa-check"></i>Личный кабинет клиента</li>
180 </ul> 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 Выбрать </a> 183 Выбрать </a>
184 <a href="<?=Url::to([ 184 <a href="<?=Url::to([