Commit 16b1b04da2101d6b038f1e8ad58b0c25435f31da
Merge branch 'master' of gitlab.artweb.com.ua:root/baucenter
Showing
54 changed files
with
1338 additions
and
276 deletions
Show diff stats
.gitignore
backend/controllers/SeoDynamicController.php
... | ... | @@ -36,7 +36,7 @@ class SeoDynamicController extends Controller |
36 | 36 | public function actionIndex($seo_category_id) |
37 | 37 | { |
38 | 38 | $searchModel = new SeoDynamicSearch(); |
39 | - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
39 | + $dataProvider = $searchModel->search($seo_category_id,Yii::$app->request->queryParams); | |
40 | 40 | |
41 | 41 | return $this->render('index', [ |
42 | 42 | 'searchModel' => $searchModel, | ... | ... |
backend/views/seo-dynamic/_form.php
... | ... | @@ -16,6 +16,10 @@ use yii\widgets\ActiveForm; |
16 | 16 | |
17 | 17 | <?= $form->field($model, 'action')->textInput(['maxlength' => true]) ?> |
18 | 18 | |
19 | + <?= $form->field($model, 'param')->textInput(['maxlength' => true]) ?> | |
20 | + | |
21 | + <?= $form->field($model, 'key')->textInput(['maxlength' => true]) ?> | |
22 | + | |
19 | 23 | <?= $form->field($model, 'fields')->textInput(['maxlength' => true]) ?> |
20 | 24 | |
21 | 25 | <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\components; | |
4 | +use PHPMailer\PHPMailer\PHPMailer; | |
5 | +use yii\base\Widget; | |
6 | + | |
7 | +class Mailer extends Widget{ | |
8 | + public $message; | |
9 | + public $email = 'dockdep@gmail.com'; | |
10 | + public $text; | |
11 | + public $subject; | |
12 | + | |
13 | + public function init(){ | |
14 | + | |
15 | + parent::init(); | |
16 | + | |
17 | + } | |
18 | + | |
19 | + public function run(){ | |
20 | + | |
21 | + $mail = new PHPMailer(); | |
22 | + | |
23 | + $mail->IsSMTP(); | |
24 | + | |
25 | + $mail->CharSet = 'UTF-8'; | |
26 | + $mail->Username = "dockdep@gmail.com"; | |
27 | + $mail->Password = "k0l0b04eg"; | |
28 | + $mail->SetFrom('dockdep@gmail.com'); | |
29 | + $mail->Subject = $this->subject; | |
30 | + $mail->MsgHTML($this->text); | |
31 | + $address = "dockdep@gmail.com"; | |
32 | + $mail->AddAddress($address); | |
33 | + if(!$mail->send()) { | |
34 | + \Yii::$app->getSession()->setFlash('error', 'Mailer Error: ' . $mail->ErrorInfo); | |
35 | + return 'Mailer Error: ' . $mail->ErrorInfo; | |
36 | + } else { | |
37 | + \Yii::$app->getSession()->setFlash('success', 'Мастер-приемщик свяжется с вами в ближайшее время'); | |
38 | + return 'Message has been sent'; | |
39 | + } | |
40 | + } | |
41 | + | |
42 | +} | |
43 | + | ... | ... |
common/config/main.php
common/models/Banner.php
... | ... | @@ -47,14 +47,14 @@ class Banner extends \yii\db\ActiveRecord |
47 | 47 | public function attributeLabels() |
48 | 48 | { |
49 | 49 | return [ |
50 | - 'banner_id' => Yii::t('app', 'Banner ID'), | |
51 | - 'image' => Yii::t('app', 'Image'), | |
52 | - 'alt' => Yii::t('app', 'Alt'), | |
53 | - 'title' => Yii::t('app', 'Title'), | |
54 | - 'url' => Yii::t('app', 'Url'), | |
55 | - 'status' => Yii::t('app', 'Status'), | |
56 | - 'width' => Yii::t('app', 'Width'), | |
57 | - 'height' => Yii::t('app', 'Height'), | |
50 | + 'banner_id' => Yii::t('app', 'status'), | |
51 | + 'image' => Yii::t('app', 'image'), | |
52 | + 'alt' => Yii::t('app', 'alt'), | |
53 | + 'title' => Yii::t('app', 'title'), | |
54 | + 'url' => Yii::t('app', 'url'), | |
55 | + 'status' => Yii::t('app', 'status'), | |
56 | + 'width' => Yii::t('app', 'width'), | |
57 | + 'height' => Yii::t('app', 'height'), | |
58 | 58 | ]; |
59 | 59 | } |
60 | 60 | } | ... | ... |
common/models/Blog.php
... | ... | @@ -93,15 +93,15 @@ |
93 | 93 | public function attributeLabels() |
94 | 94 | { |
95 | 95 | return [ |
96 | - 'blog_id' => Yii::t('app', 'Blog ID'), | |
97 | - 'user_id' => Yii::t('app', 'User ID'), | |
98 | - 'name' => Yii::t('app', 'Название'), | |
99 | - 'link' => Yii::t('app', 'URL'), | |
100 | - 'date_add' => Yii::t('app', 'Дата добавления'), | |
101 | - 'user_add_id' => Yii::t('app', 'User Add ID'), | |
102 | - 'view_count' => Yii::t('app', 'Количество просмотров'), | |
103 | - 'description' => Yii::t('app', 'Описание'), | |
104 | - 'cover' => Yii::t('app', 'Фото главное'), | |
96 | + 'blog_id' => Yii::t('app', 'blog_id'), | |
97 | + 'user_id' => Yii::t('app', 'user_id'), | |
98 | + 'name' => Yii::t('app', 'name'), | |
99 | + 'link' => Yii::t('app', 'link'), | |
100 | + 'date_add' => Yii::t('app', 'date_add'), | |
101 | + 'user_add_id' => Yii::t('app', 'user_add_id'), | |
102 | + 'view_count' => Yii::t('app', 'view_count'), | |
103 | + 'description' => Yii::t('app', 'description'), | |
104 | + 'cover' => Yii::t('app', 'cover'), | |
105 | 105 | ]; |
106 | 106 | } |
107 | 107 | } | ... | ... |
common/models/Customers.php
... | ... | @@ -79,16 +79,16 @@ class Customers extends User |
79 | 79 | { |
80 | 80 | return [ |
81 | 81 | 'id' => Yii::t('app', 'ID'), |
82 | - 'username' => Yii::t('app', 'Username'), | |
83 | - 'surname' => Yii::t('app', 'Surname'), | |
84 | - 'auth_key' => Yii::t('app', 'Auth Key'), | |
85 | - 'password_hash' => Yii::t('app', 'Password Hash'), | |
86 | - 'password_reset_token' => Yii::t('app', 'Password Reset Token'), | |
87 | - 'email' => Yii::t('app', 'Email'), | |
88 | - 'phone' => Yii::t('app', 'Phone'), | |
89 | - 'status' => Yii::t('app', 'Status'), | |
90 | - 'created_at' => Yii::t('app', 'Created At'), | |
91 | - 'updated_at' => Yii::t('app', 'Updated At'), | |
82 | + 'username' => Yii::t('app', 'username'), | |
83 | + 'surname' => Yii::t('app', 'surname'), | |
84 | + 'auth_key' => Yii::t('app', 'auth_key'), | |
85 | + 'password_hash' => Yii::t('app', 'password_hash'), | |
86 | + 'password_reset_token' => Yii::t('app', 'password_reset_token'), | |
87 | + 'email' => Yii::t('app', 'email'), | |
88 | + 'phone' => Yii::t('app', 'phone'), | |
89 | + 'status' => Yii::t('app', 'status'), | |
90 | + 'created_at' => Yii::t('app', 'created_at'), | |
91 | + 'updated_at' => Yii::t('app', 'updated_at'), | |
92 | 92 | ]; |
93 | 93 | } |
94 | 94 | } | ... | ... |
common/models/Event.php
... | ... | @@ -85,18 +85,18 @@ class Event extends \yii\db\ActiveRecord |
85 | 85 | public function attributeLabels() |
86 | 86 | { |
87 | 87 | return [ |
88 | - 'event_id' => Yii::t('app', 'Event ID'), | |
89 | - 'name' => Yii::t('app', 'Name'), | |
90 | - 'alias' => Yii::t('app', 'Alias'), | |
91 | - 'body' => Yii::t('app', 'Body'), | |
92 | - 'image' => Yii::t('app', 'Image'), | |
93 | - 'meta_title' => Yii::t('app', 'Meta Title'), | |
94 | - 'description' => Yii::t('app', 'Description'), | |
95 | - 'h1' => Yii::t('app', 'H1'), | |
96 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
97 | - 'created_at' => Yii::t('app', 'Created At'), | |
98 | - 'updated_at' => Yii::t('app', 'Updated At'), | |
99 | - 'end_at' => Yii::t('app', 'End At'), | |
88 | + 'event_id' => Yii::t('app', 'event_id'), | |
89 | + 'name' => Yii::t('app', 'name'), | |
90 | + 'alias' => Yii::t('app', 'alias'), | |
91 | + 'body' => Yii::t('app', 'body'), | |
92 | + 'image' => Yii::t('app', 'image'), | |
93 | + 'meta_title' => Yii::t('app', 'meta_title'), | |
94 | + 'description' => Yii::t('app', 'description'), | |
95 | + 'h1' => Yii::t('app', 'h1'), | |
96 | + 'seo_text' => Yii::t('app', 'seo_text'), | |
97 | + 'created_at' => Yii::t('app', 'created_at'), | |
98 | + 'updated_at' => Yii::t('app', 'updated_at'), | |
99 | + 'end_at' => Yii::t('app', 'end_at'), | |
100 | 100 | ]; |
101 | 101 | } |
102 | 102 | } | ... | ... |
common/models/OrderItems.php
... | ... | @@ -46,11 +46,11 @@ class OrderItems extends \yii\db\ActiveRecord |
46 | 46 | public function attributeLabels() |
47 | 47 | { |
48 | 48 | return [ |
49 | - 'order_items_id' => Yii::t('app', 'Order Items ID'), | |
50 | - 'order_id' => Yii::t('app', 'Order ID'), | |
51 | - 'item_id' => Yii::t('app', 'Item ID'), | |
52 | - 'item_count' => Yii::t('app', 'Item Count'), | |
53 | - 'price' => Yii::t('app', 'Price'), | |
49 | + 'order_items_id' => Yii::t('app', 'order_items_id'), | |
50 | + 'order_id' => Yii::t('app', 'order_id'), | |
51 | + 'item_id' => Yii::t('app', 'item_id'), | |
52 | + 'item_count' => Yii::t('app', 'item_count'), | |
53 | + 'price' => Yii::t('app', 'price'), | |
54 | 54 | ]; |
55 | 55 | } |
56 | 56 | ... | ... |
common/models/Orders.php
... | ... | @@ -82,17 +82,17 @@ class Orders extends \yii\db\ActiveRecord |
82 | 82 | public function attributeLabels() |
83 | 83 | { |
84 | 84 | return [ |
85 | - 'order_id' => Yii::t('app', 'Order ID'), | |
86 | - 'customer_id' => Yii::t('app', 'Customer ID'), | |
87 | - 'name' => Yii::t('app', 'Name'), | |
88 | - 'email' => Yii::t('app', 'Email'), | |
89 | - 'phone' => Yii::t('app', 'Phone'), | |
90 | - 'delivery' => Yii::t('app', 'Delivery'), | |
91 | - 'payment' => Yii::t('app', 'Payment'), | |
92 | - 'code' => Yii::t('app', 'Code'), | |
93 | - 'status' => Yii::t('app', 'Status'), | |
94 | - 'created_at' => Yii::t('app', 'Created At'), | |
95 | - 'updated_at' => Yii::t('app', 'Updated At'), | |
85 | + 'order_id' => Yii::t('app', 'order_id'), | |
86 | + 'customer_id' => Yii::t('app', 'customer_id'), | |
87 | + 'name' => Yii::t('app', 'name'), | |
88 | + 'email' => Yii::t('app', 'email'), | |
89 | + 'phone' => Yii::t('app', 'phone'), | |
90 | + 'delivery' => Yii::t('app', 'delivery'), | |
91 | + 'payment' => Yii::t('app', 'payment'), | |
92 | + 'code' => Yii::t('app', 'code'), | |
93 | + 'status' => Yii::t('app', 'status'), | |
94 | + 'created_at' => Yii::t('app', 'created_at'), | |
95 | + 'updated_at' => Yii::t('app', 'updated_at'), | |
96 | 96 | ]; |
97 | 97 | } |
98 | 98 | ... | ... |
common/models/Page.php
... | ... | @@ -46,15 +46,15 @@ class Page extends \yii\db\ActiveRecord |
46 | 46 | public function attributeLabels() |
47 | 47 | { |
48 | 48 | return [ |
49 | - 'id' => 'ID', | |
50 | - 'name' => 'Название', | |
51 | - 'alias' => 'alias', | |
52 | - 'title' => 'Title', | |
53 | - 'body' => 'Body', | |
54 | - 'meta_title' => 'Meta Title', | |
55 | - 'description' => 'Description', | |
56 | - 'h1' => 'H1', | |
57 | - 'seo_text' => 'Seo Text', | |
49 | + 'id' => Yii::t('app', 'id'), | |
50 | + 'name' => Yii::t('app', 'name'), | |
51 | + 'alias' => Yii::t('app', 'alias'), | |
52 | + 'title' => Yii::t('app', 'title'), | |
53 | + 'body' => Yii::t('app', 'body'), | |
54 | + 'meta_title' => Yii::t('app', 'meta_title'), | |
55 | + 'description' => Yii::t('app', 'description'), | |
56 | + 'h1' =>Yii::t('app', 'h1'), | |
57 | + 'seo_text' => Yii::t('app', 'seo_text'), | |
58 | 58 | ]; |
59 | 59 | } |
60 | 60 | ... | ... |
common/models/Seo.php
... | ... | @@ -42,12 +42,12 @@ class Seo extends \yii\db\ActiveRecord |
42 | 42 | public function attributeLabels() |
43 | 43 | { |
44 | 44 | return [ |
45 | - 'seo_id' => Yii::t('app', 'Seo ID'), | |
46 | - 'url' => Yii::t('app', 'Url'), | |
47 | - 'title' => Yii::t('app', 'Title'), | |
48 | - 'description' => Yii::t('app', 'Description'), | |
49 | - 'h1' => Yii::t('app', 'H1'), | |
50 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
45 | + 'seo_id' => Yii::t('app', 'seo_id'), | |
46 | + 'url' => Yii::t('app', 'url'), | |
47 | + 'title' => Yii::t('app', 'title'), | |
48 | + 'description' => Yii::t('app', 'description'), | |
49 | + 'h1' => Yii::t('app', 'h1'), | |
50 | + 'seo_text' => Yii::t('app', 'seo_text'), | |
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | } | ... | ... |
common/models/SeoCategory.php
... | ... | @@ -42,10 +42,10 @@ class SeoCategory extends \yii\db\ActiveRecord |
42 | 42 | public function attributeLabels() |
43 | 43 | { |
44 | 44 | return [ |
45 | - 'seo_category_id' => Yii::t('app', 'Seo Category ID'), | |
46 | - 'name' => Yii::t('app', 'Name'), | |
47 | - 'controller' => Yii::t('app', 'Controller'), | |
48 | - 'status' => Yii::t('app', 'Status'), | |
45 | + 'seo_category_id' => Yii::t('app', 'seo_category_id'), | |
46 | + 'name' => Yii::t('app', 'name'), | |
47 | + 'controller' => Yii::t('app', 'controller'), | |
48 | + 'status' => Yii::t('app', 'status'), | |
49 | 49 | ]; |
50 | 50 | } |
51 | 51 | ... | ... |
common/models/SeoDynamic.php
... | ... | @@ -15,8 +15,10 @@ use Yii; |
15 | 15 | * @property string $title |
16 | 16 | * @property string $h1 |
17 | 17 | * @property string $description |
18 | - * @property string $seo-text | |
18 | + * @property string $seo_text | |
19 | 19 | * @property integer $status |
20 | + * @property string $param | |
21 | + * @property string $key | |
20 | 22 | * |
21 | 23 | * @property SeoCategory $seoCategory |
22 | 24 | */ |
... | ... | @@ -39,7 +41,7 @@ class SeoDynamic extends \yii\db\ActiveRecord |
39 | 41 | [['seo_category_id', 'status'], 'integer'], |
40 | 42 | [['seo_text'], 'string'], |
41 | 43 | [['name', 'action'], 'string', 'max' => 200], |
42 | - [['fields', 'title', 'h1', 'description'], 'string', 'max' => 255], | |
44 | + [['fields', 'title', 'h1', 'description', 'param', 'key'], 'string', 'max' => 255], | |
43 | 45 | [['seo_category_id'], 'exist', 'skipOnError' => true, 'targetClass' => SeoCategory::className(), 'targetAttribute' => ['seo_category_id' => 'seo_category_id']], |
44 | 46 | ]; |
45 | 47 | } |
... | ... | @@ -50,16 +52,18 @@ class SeoDynamic extends \yii\db\ActiveRecord |
50 | 52 | public function attributeLabels() |
51 | 53 | { |
52 | 54 | return [ |
53 | - 'seo_dynamic_id' => Yii::t('app', 'Seo Dynamic ID'), | |
54 | - 'seo_category_id' => Yii::t('app', 'Seo Category ID'), | |
55 | - 'name' => Yii::t('app', 'Name'), | |
56 | - 'action' => Yii::t('app', 'Action'), | |
57 | - 'fields' => Yii::t('app', 'Fields'), | |
58 | - 'title' => Yii::t('app', 'Title'), | |
59 | - 'h1' => Yii::t('app', 'H1'), | |
60 | - 'description' => Yii::t('app', 'Description'), | |
61 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
62 | - 'status' => Yii::t('app', 'Status'), | |
55 | + 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), | |
56 | + 'seo_category_id' => Yii::t('app', 'seo_category_id'), | |
57 | + 'name' => Yii::t('app', 'name'), | |
58 | + 'action' => Yii::t('app', 'action'), | |
59 | + 'fields' => Yii::t('app', 'fields'), | |
60 | + 'title' => Yii::t('app', 'title'), | |
61 | + 'h1' => Yii::t('app', 'h1'), | |
62 | + 'description' => Yii::t('app', 'description'), | |
63 | + 'seo_text' => Yii::t('app', 'seo_text'), | |
64 | + 'status' => Yii::t('app', 'status'), | |
65 | + 'param' => Yii::t('app', 'param'), | |
66 | + 'key' => Yii::t('app', 'key'), | |
63 | 67 | ]; |
64 | 68 | } |
65 | 69 | ... | ... |
common/models/SeoDynamicSearch.php
... | ... | @@ -39,7 +39,7 @@ class SeoDynamicSearch extends SeoDynamic |
39 | 39 | * |
40 | 40 | * @return ActiveDataProvider |
41 | 41 | */ |
42 | - public function search($params) | |
42 | + public function search($seo_category_id, $params) | |
43 | 43 | { |
44 | 44 | $query = SeoDynamic::find(); |
45 | 45 | |
... | ... | @@ -60,7 +60,7 @@ class SeoDynamicSearch extends SeoDynamic |
60 | 60 | // grid filtering conditions |
61 | 61 | $query->andFilterWhere([ |
62 | 62 | 'seo_dynamic_id' => $this->seo_dynamic_id, |
63 | - 'seo_category_id' => $this->seo_category_id, | |
63 | + 'seo_category_id' => $seo_category_id, | |
64 | 64 | 'status' => $this->status, |
65 | 65 | ]); |
66 | 66 | ... | ... |
common/models/Service.php
... | ... | @@ -65,17 +65,17 @@ class Service extends \yii\db\ActiveRecord |
65 | 65 | public function attributeLabels() |
66 | 66 | { |
67 | 67 | return [ |
68 | - 'service_id' => Yii::t('app', 'Service ID'), | |
69 | - 'name' => Yii::t('app', 'Name'), | |
70 | - 'alias' => Yii::t('app', 'Alias'), | |
71 | - 'body' => Yii::t('app', 'Body'), | |
72 | - 'image' => Yii::t('app', 'Image'), | |
73 | - 'meta_title' => Yii::t('app', 'Meta Title'), | |
74 | - 'description' => Yii::t('app', 'Description'), | |
75 | - 'h1' => Yii::t('app', 'H1'), | |
76 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
77 | - 'created_at' => Yii::t('app', 'Created At'), | |
78 | - 'updated_at' => Yii::t('app', 'Updated At'), | |
68 | + 'service_id' => Yii::t('app', 'service_id'), | |
69 | + 'name' => Yii::t('app', 'name'), | |
70 | + 'alias' => Yii::t('app', 'alias'), | |
71 | + 'body' => Yii::t('app', 'body'), | |
72 | + 'image' => Yii::t('app', 'image'), | |
73 | + 'meta_title' => Yii::t('app', 'meta_title'), | |
74 | + 'description' => Yii::t('app', 'description'), | |
75 | + 'h1' => Yii::t('app', 'h1'), | |
76 | + 'seo_text' => Yii::t('app', 'seo_text'), | |
77 | + 'created_at' => Yii::t('app', 'created_at'), | |
78 | + 'updated_at' => Yii::t('app', 'updated_at'), | |
79 | 79 | ]; |
80 | 80 | } |
81 | 81 | } | ... | ... |
common/models/Slider.php
... | ... | @@ -48,13 +48,13 @@ class Slider extends \yii\db\ActiveRecord |
48 | 48 | public function attributeLabels() |
49 | 49 | { |
50 | 50 | return [ |
51 | - 'slider_id' => Yii::t('app', 'Slider ID'), | |
52 | - 'speed' => Yii::t('app', 'Speed'), | |
53 | - 'duration' => Yii::t('app', 'Duration'), | |
54 | - 'title' => Yii::t('app', 'Title'), | |
55 | - 'status' => Yii::t('app', 'Status'), | |
56 | - 'width' => Yii::t('app', 'Width'), | |
57 | - 'height' => Yii::t('app', 'Height'), | |
51 | + 'slider_id' => Yii::t('app', 'slider_id'), | |
52 | + 'speed' => Yii::t('app', 'speed'), | |
53 | + 'duration' => Yii::t('app', 'duration'), | |
54 | + 'title' => Yii::t('app', 'title'), | |
55 | + 'status' => Yii::t('app', 'status'), | |
56 | + 'width' => Yii::t('app', 'width'), | |
57 | + 'height' => Yii::t('app', 'height'), | |
58 | 58 | ]; |
59 | 59 | } |
60 | 60 | ... | ... |
common/models/SliderImage.php
... | ... | @@ -48,15 +48,15 @@ class SliderImage extends \yii\db\ActiveRecord |
48 | 48 | public function attributeLabels() |
49 | 49 | { |
50 | 50 | return [ |
51 | - 'slider_image_id' => Yii::t('app', 'Slider Image ID'), | |
52 | - 'slider_id' => Yii::t('app', 'Slider ID'), | |
53 | - 'image' => Yii::t('app', 'Image'), | |
54 | - 'alt' => Yii::t('app', 'Alt'), | |
55 | - 'title' => Yii::t('app', 'Title'), | |
56 | - 'url' => Yii::t('app', 'Url'), | |
57 | - 'status' => Yii::t('app', 'Status'), | |
58 | - 'sort' => Yii::t('app', 'Sort'), | |
59 | - 'price' => Yii::t('app', 'Price'), | |
51 | + 'slider_image_id' => Yii::t('app', 'slider_image_id'), | |
52 | + 'slider_id' => Yii::t('app', 'slider_id'), | |
53 | + 'image' => Yii::t('app', 'image'), | |
54 | + 'alt' => Yii::t('app', 'alt'), | |
55 | + 'title' => Yii::t('app', 'title'), | |
56 | + 'url' => Yii::t('app', 'url'), | |
57 | + 'status' => Yii::t('app', 'status'), | |
58 | + 'sort' => Yii::t('app', 'sort'), | |
59 | + 'price' => Yii::t('app', 'price'), | |
60 | 60 | ]; |
61 | 61 | } |
62 | 62 | ... | ... |
common/modules/comment/Controller.php
common/modules/comment/assets/CommentAsset.php
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | |
4 | 4 | class CommentAsset extends \yii\web\AssetBundle |
5 | 5 | { |
6 | + | |
6 | 7 | public $sourcePath = '@common/modules/comment/resources'; |
7 | 8 | |
8 | 9 | public $css = [ |
... | ... | @@ -18,4 +19,8 @@ |
18 | 19 | '\yii\web\JqueryAsset', |
19 | 20 | ]; |
20 | 21 | |
22 | + public $jsOptions = [ | |
23 | + 'position' => \yii\web\View::POS_READY, | |
24 | + ]; | |
25 | + | |
21 | 26 | } |
22 | 27 | \ No newline at end of file | ... | ... |
common/modules/comment/models/Comment.php
1 | 1 | <?php |
2 | 2 | namespace common\modules\comment\models; |
3 | 3 | |
4 | + use common\models\User; | |
4 | 5 | use yii\db\ActiveQuery; |
5 | 6 | |
6 | 7 | /** |
... | ... | @@ -18,6 +19,8 @@ |
18 | 19 | * @property string $date_delete |
19 | 20 | * @property string $model |
20 | 21 | * @property int $model_id |
22 | + * @property Rating $rating | |
23 | + * @property User $user | |
21 | 24 | * @package common\modules\comment\models |
22 | 25 | */ |
23 | 26 | class Comment extends \yii\db\ActiveRecord |
... | ... | @@ -117,6 +120,22 @@ |
117 | 120 | ]; |
118 | 121 | } |
119 | 122 | |
123 | + public function afterSave($insert, $changedAttributes) | |
124 | + { | |
125 | + if($this->model == User::className()) { | |
126 | + if($user = User::findOne($this->model_id)) { | |
127 | + /** | |
128 | + * @var User $user | |
129 | + */ | |
130 | + $user->updateRating(); | |
131 | + } | |
132 | + } | |
133 | + parent::afterSave($insert, $changedAttributes); | |
134 | + } | |
135 | + | |
136 | + /** | |
137 | + * @inheritdoc | |
138 | + */ | |
120 | 139 | public static function tableName() |
121 | 140 | { |
122 | 141 | return '{{%comment}}'; |
... | ... | @@ -157,7 +176,7 @@ |
157 | 176 | 'comment.model' => $model, |
158 | 177 | 'comment.model_id' => $model_id, |
159 | 178 | 'comment.status' => 1, |
160 | - ]); | |
179 | + ])->with('rating'); | |
161 | 180 | } |
162 | 181 | |
163 | 182 | public function postComment() |
... | ... | @@ -294,7 +313,7 @@ |
294 | 313 | 'model' => $this->className(), |
295 | 314 | ]) |
296 | 315 | ->one(); |
297 | - if(!$rating instanceof \common\modules\comment\models\Rating) { | |
316 | + if(!$rating instanceof \common\modules\comment\models\Rating && !empty($this->primaryKey)) { | |
298 | 317 | $rating = new \common\modules\comment\models\Rating([ |
299 | 318 | 'model' => $this->className(), |
300 | 319 | 'model_id' => $this->comment_id, |
... | ... | @@ -331,4 +350,9 @@ |
331 | 350 | } |
332 | 351 | } |
333 | 352 | |
353 | + public function getUser() | |
354 | + { | |
355 | + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); | |
356 | + } | |
357 | + | |
334 | 358 | } | ... | ... |
common/modules/comment/models/CommentProject.php
... | ... | @@ -3,26 +3,32 @@ |
3 | 3 | |
4 | 4 | use common\models\Currency; |
5 | 5 | use common\models\File; |
6 | + use common\models\Project; | |
7 | + use common\models\User; | |
6 | 8 | use yii\db\ActiveQuery; |
9 | + use yii\db\ActiveRecord; | |
7 | 10 | use yii\web\UploadedFile; |
8 | 11 | |
9 | 12 | /** |
10 | 13 | * Class Comment |
11 | - * @property bool $guestComment | |
12 | - * @property integer $comment_id | |
13 | - * @property string $text | |
14 | - * @property int $user_id | |
15 | - * @property int $status | |
16 | - * @property string $date_add | |
17 | - * @property string $date_update | |
18 | - * @property string $date_delete | |
19 | - * @property string $model | |
20 | - * @property int $model_id | |
21 | - * @property string $files | |
22 | - * @property float $budget_from | |
23 | - * @property float $budget_to | |
24 | - * @property int $term_from | |
25 | - * @property int $term_to | |
14 | + * @property bool $guestComment | |
15 | + * @property integer $comment_id | |
16 | + * @property string $text | |
17 | + * @property int $user_id | |
18 | + * @property int $status | |
19 | + * @property string $date_add | |
20 | + * @property string $date_update | |
21 | + * @property string $date_delete | |
22 | + * @property string $model | |
23 | + * @property int $model_id | |
24 | + * @property string $files | |
25 | + * @property float $budget_from | |
26 | + * @property float $budget_to | |
27 | + * @property int $term_from | |
28 | + * @property int $term_to | |
29 | + * @property int $state | |
30 | + * @property Currency $currency | |
31 | + * @property Project $project | |
26 | 32 | * @package common\modules\comment\models |
27 | 33 | */ |
28 | 34 | class CommentProject extends \yii\db\ActiveRecord |
... | ... | @@ -35,13 +41,22 @@ |
35 | 41 | const STATUS_PERSONAL = 3; |
36 | 42 | const STATUS_ANONYMOUS = 4; |
37 | 43 | |
44 | + const STATE_NEW = 1; | |
45 | + const STATE_CANDIDATE = 2; | |
46 | + const STATE_PERFORMER = 3; | |
47 | + const STATE_DENY = 4; | |
48 | + const STATE_TRASH = 5; | |
49 | + | |
38 | 50 | const SCENARIO_USER = 'user'; |
39 | 51 | const SCENARIO_GUEST = 'guest'; |
52 | + const SCENARIO_STATE = 'state'; | |
53 | + const SCENARIO_OWNER = 'owner'; | |
40 | 54 | |
41 | 55 | /** |
42 | 56 | * @var bool |
43 | 57 | */ |
44 | 58 | public $guestComment = false; |
59 | + | |
45 | 60 | public $file; |
46 | 61 | |
47 | 62 | public function rules() |
... | ... | @@ -84,7 +99,7 @@ |
84 | 99 | [ |
85 | 100 | [ 'budget_currency' ], |
86 | 101 | 'exist', |
87 | - 'targetClass' => Currency::className(), | |
102 | + 'targetClass' => Currency::className(), | |
88 | 103 | 'targetAttribute' => 'currency_id', |
89 | 104 | ], |
90 | 105 | [ |
... | ... | @@ -104,6 +119,32 @@ |
104 | 119 | 'default', |
105 | 120 | 'value' => 1, |
106 | 121 | ], |
122 | + [ | |
123 | + [ 'state' ], | |
124 | + 'integer', | |
125 | + 'max' => 4, | |
126 | + 'min' => 1, | |
127 | + 'on' => self::SCENARIO_STATE, | |
128 | + ], | |
129 | + [ | |
130 | + [ 'state' ], | |
131 | + 'required', | |
132 | + 'on' => self::SCENARIO_STATE, | |
133 | + ], | |
134 | + [ | |
135 | + [ 'state' ], | |
136 | + 'required', | |
137 | + 'on' => self::SCENARIO_OWNER, | |
138 | + ], | |
139 | + [ | |
140 | + [ 'state' ], | |
141 | + 'in', | |
142 | + 'range' => [ | |
143 | + 1, | |
144 | + 5, | |
145 | + ], | |
146 | + 'on' => self::SCENARIO_OWNER, | |
147 | + ], | |
107 | 148 | ]; |
108 | 149 | } |
109 | 150 | |
... | ... | @@ -118,9 +159,15 @@ |
118 | 159 | 'term_to', |
119 | 160 | 'file', |
120 | 161 | ], |
121 | - self::SCENARIO_GUEST => [ | |
162 | + self::SCENARIO_GUEST => [ | |
122 | 163 | |
123 | 164 | ], |
165 | + self::SCENARIO_STATE => [ | |
166 | + 'state', | |
167 | + ], | |
168 | + self::SCENARIO_OWNER => [ | |
169 | + 'state', | |
170 | + ], | |
124 | 171 | ]; |
125 | 172 | } |
126 | 173 | |
... | ... | @@ -150,11 +197,11 @@ |
150 | 197 | public function attributeLabels() |
151 | 198 | { |
152 | 199 | return [ |
153 | - 'text' => \Yii::t('app', 'Текст ответа'), | |
200 | + 'text' => \Yii::t('app', 'Текст ответа'), | |
154 | 201 | 'budget_from' => \Yii::t('app', 'от'), |
155 | - 'budget_to' => \Yii::t('app', 'до'), | |
156 | - 'term_from' => \Yii::t('app', 'от'), | |
157 | - 'term_to' => \Yii::t('app', 'до'), | |
202 | + 'budget_to' => \Yii::t('app', 'до'), | |
203 | + 'term_from' => \Yii::t('app', 'от'), | |
204 | + 'term_to' => \Yii::t('app', 'до'), | |
158 | 205 | ]; |
159 | 206 | } |
160 | 207 | |
... | ... | @@ -163,10 +210,10 @@ |
163 | 210 | return $this->guestComment; |
164 | 211 | } |
165 | 212 | |
166 | -// public function setGuestComment($value) | |
167 | -// { | |
168 | -// $this->guestComment = $value; | |
169 | -// } | |
213 | + // public function setGuestComment($value) | |
214 | + // { | |
215 | + // $this->guestComment = $value; | |
216 | + // } | |
170 | 217 | |
171 | 218 | /** |
172 | 219 | * @param string $model |
... | ... | @@ -181,27 +228,28 @@ |
181 | 228 | 'comment_project.model' => $model, |
182 | 229 | 'comment_project.model_id' => $model_id, |
183 | 230 | 'comment_project.status' => 1, |
184 | - ]); | |
231 | + ]) | |
232 | + ->with('currency', 'user', 'user.userInfo', 'user.companyInfo', 'user.comments'); | |
185 | 233 | } |
186 | 234 | |
187 | 235 | public function postComment() |
188 | 236 | { |
189 | 237 | if($this->checkCreate()) { |
190 | - if(!empty(\Yii::$app->request->post($this->formName())['anonymous'])) { | |
238 | + if(!empty( \Yii::$app->request->post($this->formName())[ 'anonymous' ] )) { | |
191 | 239 | $this->status = self::STATUS_ANONYMOUS; |
192 | 240 | } |
193 | 241 | $this->file = UploadedFile::getInstances($this, 'file'); |
194 | - if(!empty($this->file)) { | |
195 | - $file_id = []; | |
196 | - if(is_array($this->file)){ | |
197 | - foreach($this->file as $file){ | |
198 | - if($file instanceof UploadedFile){ | |
242 | + if(!empty( $this->file )) { | |
243 | + $file_id = [ ]; | |
244 | + if(is_array($this->file)) { | |
245 | + foreach($this->file as $file) { | |
246 | + if($file instanceof UploadedFile) { | |
199 | 247 | $file_model = new File(); |
200 | 248 | $file_id[] = $file_model->saveFile($file); |
201 | 249 | } |
202 | 250 | } |
203 | 251 | } else { |
204 | - if($this->file instanceof UploadedFile){ | |
252 | + if($this->file instanceof UploadedFile) { | |
205 | 253 | $file_model = new File(); |
206 | 254 | $file_id[] = $file_model->saveFile($this->file); |
207 | 255 | } |
... | ... | @@ -325,4 +373,65 @@ |
325 | 373 | // } |
326 | 374 | } |
327 | 375 | |
376 | + /** | |
377 | + * @return ActiveQuery | |
378 | + */ | |
379 | + public function getCurrency() | |
380 | + { | |
381 | + return $this->hasOne(Currency::className(), [ 'currency_id' => 'budget_currency' ]); | |
382 | + } | |
383 | + | |
384 | + /** | |
385 | + * @return File[] | |
386 | + */ | |
387 | + public function getFilesList() | |
388 | + { | |
389 | + $files = json_decode($this->files); | |
390 | + if(!empty( $files )) { | |
391 | + return File::findAll($files); | |
392 | + } else { | |
393 | + return [ ]; | |
394 | + } | |
395 | + } | |
396 | + | |
397 | + /** | |
398 | + * @return ActiveRecord | |
399 | + * @throws \TypeError | |
400 | + */ | |
401 | + public function getOwner() | |
402 | + { | |
403 | + $model = new $this->model(); | |
404 | + if($model instanceof ActiveRecord) { | |
405 | + return $model->findOne($this->model_id); | |
406 | + } else { | |
407 | + throw new \TypeError('Model must extends Active Record Class'); | |
408 | + } | |
409 | + } | |
410 | + | |
411 | + public function getProject() | |
412 | + { | |
413 | + return $this->hasOne(Project::className(), [ 'project_id' => 'model_id' ]); | |
414 | + } | |
415 | + | |
416 | + /** | |
417 | + * @return User | |
418 | + */ | |
419 | + public function getUser() | |
420 | + { | |
421 | + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); | |
422 | + } | |
423 | + | |
424 | + public function changeState() | |
425 | + { | |
426 | + if($this->isAttributeChanged('state')) { | |
427 | + if($this->save()) { | |
428 | + return true; | |
429 | + } else { | |
430 | + return false; | |
431 | + } | |
432 | + } else { | |
433 | + return true; | |
434 | + } | |
435 | + } | |
436 | + | |
328 | 437 | } | ... | ... |
common/modules/comment/models/CommentProjectSearch.php
0 → 100644
1 | +<?php | |
2 | + namespace common\modules\comment\models; | |
3 | + | |
4 | + use common\models\Currency; | |
5 | + use common\models\File; | |
6 | + use common\models\User; | |
7 | + use yii\data\ActiveDataProvider; | |
8 | + use yii\db\ActiveQuery; | |
9 | + use yii\db\ActiveRecord; | |
10 | + use yii\web\UploadedFile; | |
11 | + | |
12 | + /** | |
13 | + * Class Comment | |
14 | + * @property bool $guestComment | |
15 | + * @property integer $comment_id | |
16 | + * @property string $text | |
17 | + * @property int $user_id | |
18 | + * @property int $status | |
19 | + * @property string $date_add | |
20 | + * @property string $date_update | |
21 | + * @property string $date_delete | |
22 | + * @property string $model | |
23 | + * @property int $model_id | |
24 | + * @property string $files | |
25 | + * @property float $budget_from | |
26 | + * @property float $budget_to | |
27 | + * @property int $term_from | |
28 | + * @property int $term_to | |
29 | + * @property int $state | |
30 | + * @property Currency $currency | |
31 | + * @package common\modules\comment\models | |
32 | + */ | |
33 | + class CommentProjectSearch extends CommentProject | |
34 | + { | |
35 | + | |
36 | + const SCENARIO_SEARCH = 'search'; | |
37 | + | |
38 | + public function rules() | |
39 | + { | |
40 | + return [ | |
41 | + [ | |
42 | + [ | |
43 | + 'state', | |
44 | + ], | |
45 | + 'integer', | |
46 | + 'max' => 5, | |
47 | + 'min' => 1, | |
48 | + ], | |
49 | + [ | |
50 | + [ | |
51 | + 'state', | |
52 | + ], | |
53 | + 'default', | |
54 | + 'value' => self::STATE_NEW, | |
55 | + ], | |
56 | + ]; | |
57 | + } | |
58 | + | |
59 | + public function scenarios() | |
60 | + { | |
61 | + return array_merge(parent::scenarios(), [ | |
62 | + self::SCENARIO_SEARCH => [ | |
63 | + 'state', | |
64 | + ], | |
65 | + ]); | |
66 | + } | |
67 | + | |
68 | + public function search($params) | |
69 | + { | |
70 | + $query = CommentProject::find() | |
71 | + ->with('project') | |
72 | + ->with('project.budgetCurrency') | |
73 | + ->with('project.comments') | |
74 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]); | |
75 | + | |
76 | + $dataProvider = new ActiveDataProvider([ | |
77 | + 'query' => $query, | |
78 | + ]); | |
79 | + | |
80 | + $this->load($params); | |
81 | + | |
82 | + if(!$this->validate()) { | |
83 | + $query->andWhere('0=1'); | |
84 | + return $dataProvider; | |
85 | + } | |
86 | + | |
87 | + $query->andWhere([ 'state' => $this->state ]); | |
88 | + | |
89 | + return $dataProvider; | |
90 | + } | |
91 | + | |
92 | + } | ... | ... |
common/modules/comment/rbac/ArtboxCommentCreateRule.php
... | ... | @@ -11,7 +11,28 @@ |
11 | 11 | |
12 | 12 | public function execute($user, $item, $params) |
13 | 13 | { |
14 | + if($params[ 'model' ] == \common\models\Project::className()) { | |
15 | + return $this->checkProject($user, $item, $params); | |
16 | + } | |
14 | 17 | return true; |
15 | 18 | } |
16 | 19 | |
20 | + public function checkProject($user, $item, $params) | |
21 | + { | |
22 | + $project = \common\models\Project::findOne($params['model_id']); | |
23 | + if($project->user_id == $user) { | |
24 | + return false; | |
25 | + } | |
26 | + $comment = \common\modules\comment\models\CommentProject::find() | |
27 | + ->where([ 'model' => $params[ 'model' ], | |
28 | + 'model_id' => $params[ 'model_id' ], | |
29 | + 'user_id' => $user, | |
30 | + ])->one(); | |
31 | + if(empty($comment)) { | |
32 | + return true; | |
33 | + } else { | |
34 | + return false; | |
35 | + } | |
36 | + } | |
37 | + | |
17 | 38 | } |
18 | 39 | \ No newline at end of file | ... | ... |
common/modules/comment/rbac/ArtboxCommentUpdateOwnRule.php
common/modules/comment/widgets/CommentWidget.php
... | ... | @@ -167,7 +167,7 @@ |
167 | 167 | $this->parts[ 'list' ] = Html::tag($tag, $this->renderItems($view), $this->list_options); |
168 | 168 | } |
169 | 169 | |
170 | - if($this->display_comment_form) { | |
170 | + if($this->display_comment_form && $this->comment_class->checkCreate()) { | |
171 | 171 | $tag = ArrayHelper::remove($this->form_options, 'tag', 'div'); |
172 | 172 | $view = ArrayHelper::remove($this->form_options, 'view'); |
173 | 173 | $this->parts[ 'form' ] = Html::tag($tag, $this->renderForm($view), $this->form_options); |
... | ... | @@ -197,12 +197,16 @@ |
197 | 197 | if(empty( $view )) { |
198 | 198 | throw new \yii\base\InvalidConfigException("form_options[view] must be set"); |
199 | 199 | } |
200 | - return $this->render($view, [ | |
201 | - 'model' => $this->comment_class, | |
202 | - 'rating' => $this->rating_class, | |
203 | - 'user' => \Yii::$app->user->identity, | |
204 | - 'dataProvider' => $this->dataProvider, | |
205 | - ]); | |
200 | + if($this->comment_class->guestComment || !empty(\Yii::$app->user->identity)) { | |
201 | + return $this->render($view, [ | |
202 | + 'model' => $this->comment_class, | |
203 | + 'rating' => $this->rating_class, | |
204 | + 'user' => \Yii::$app->user->identity, | |
205 | + 'dataProvider' => $this->dataProvider, | |
206 | + ]); | |
207 | + } else { | |
208 | + return ''; | |
209 | + } | |
206 | 210 | } |
207 | 211 | |
208 | 212 | public function renderWidget() |
... | ... | @@ -221,8 +225,11 @@ |
221 | 225 | { |
222 | 226 | $data = \Yii::$app->request->post(); |
223 | 227 | if($this->comment_class->load($data) && $this->comment_class->postComment()) { |
224 | - if(is_object($this->rating_class) && $this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { | |
225 | - $this->isSuccess = true; | |
228 | + if(is_object($this->rating_class)) { | |
229 | + $this->comment_class->checkRating(); | |
230 | + if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { | |
231 | + $this->isSuccess = true; | |
232 | + } | |
226 | 233 | } |
227 | 234 | } |
228 | 235 | } | ... | ... |
common/modules/comment/widgets/views/_project_comment_view.php
... | ... | @@ -10,13 +10,7 @@ |
10 | 10 | * @var \yii\widgets\ListView $widget current ListView instance |
11 | 11 | * @var User $user |
12 | 12 | */ |
13 | - $user = NULL; | |
14 | - if(!empty( $model->user_id )) { | |
15 | - $user = User::find() | |
16 | - ->where([ 'id' => $model->user_id ]) | |
17 | - ->with('userInfo') | |
18 | - ->one(); | |
19 | - } | |
13 | + $user = $model->user; | |
20 | 14 | ?> |
21 | 15 | <div class="performer-vacancy-sidebar-left-wr"> |
22 | 16 | <div class="performer-vacancy-sidebar-left"> |
... | ... | @@ -28,22 +22,22 @@ |
28 | 22 | <ul> |
29 | 23 | <?php |
30 | 24 | if(!empty( $user->userInfo->social_fb )) { |
31 | - echo '<li>'.Html::a(Html::img('/images/ico-fb.png'), $user->userInfo->social_fb, ['target' => '_blank']).'</li>'; | |
25 | + echo '<li>' . Html::a(Html::img('/images/ico-fb.png'), $user->userInfo->social_fb, [ 'target' => '_blank' ]) . '</li>'; | |
32 | 26 | } |
33 | 27 | ?> |
34 | 28 | <?php |
35 | 29 | if(!empty( $user->userInfo->social_t )) { |
36 | - echo '<li>'.Html::a(Html::img('/images/ico-tw.png'), $user->userInfo->social_t, ['target' => '_blank']).'</li>'; | |
30 | + echo '<li>' . Html::a(Html::img('/images/ico-tw.png'), $user->userInfo->social_t, [ 'target' => '_blank' ]) . '</li>'; | |
37 | 31 | } |
38 | 32 | ?> |
39 | 33 | <?php |
40 | 34 | if(!empty( $user->userInfo->social_in )) { |
41 | - echo '<li>'.Html::a(Html::img('/images/ico-in.png'), $user->userInfo->social_in, ['target' => '_blank']).'</li>'; | |
35 | + echo '<li>' . Html::a(Html::img('/images/ico-in.png'), $user->userInfo->social_in, [ 'target' => '_blank' ]) . '</li>'; | |
42 | 36 | } |
43 | 37 | ?> |
44 | 38 | <?php |
45 | 39 | if(!empty( $user->userInfo->social_vk )) { |
46 | - echo '<li>'.Html::a(Html::img('/images/ico-vk.png'), $user->userInfo->social_vk, ['target' => '_blank']).'</li>'; | |
40 | + echo '<li>' . Html::a(Html::img('/images/ico-vk.png'), $user->userInfo->social_vk, [ 'target' => '_blank' ]) . '</li>'; | |
47 | 41 | } |
48 | 42 | ?> |
49 | 43 | </ul> |
... | ... | @@ -54,60 +48,96 @@ |
54 | 48 | <div class="sidebarvievstxt"><?= $user->userInfo->view_count ?></div> |
55 | 49 | </li> |
56 | 50 | <li><img src="/images/sidebar-ico/ico-9.png" alt=""> |
57 | - <div class="sidebarvievstxt"><span class="sidebar-views-txt">Статус: </span><?= (empty($user->userInfo->busy)?'Свободен':'Занят') ?> | |
51 | + <div class="sidebarvievstxt"> | |
52 | + <span class="sidebar-views-txt">Статус: </span><?= ( empty( $user->userInfo->busy ) ? 'Свободен' : 'Занят' ) ?> | |
58 | 53 | </div> |
59 | 54 | </li> |
60 | 55 | <li><img src="/images/sidebar-ico/ico-2.png" alt=""> |
61 | 56 | <div class="sidebarvievstxt"> |
62 | - <span class="sidebar-views-txt">На сайте: </span>1г. 8 мес. | |
57 | + <span class="sidebar-views-txt">На сайте: </span><?= $user->liveTime ?> | |
63 | 58 | </div> |
64 | 59 | </li> |
65 | 60 | <li><img src="/images/sidebar-ico/ico-3.png" alt=""> |
66 | - <div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит:<br></span>2 дня назад | |
61 | + <div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит:<br></span><?= $user->lastVisit ?> | |
67 | 62 | </div> |
68 | 63 | </li> |
69 | 64 | </ul> |
70 | - <a href="#" class="tender-see-profile style">Посмотреть профиль</a> | |
65 | + <?= Html::a('Посмотреть профиль', $user->link, [ 'class' => 'tender-see-profile style' ]) ?> | |
71 | 66 | </div> |
72 | 67 | </div> |
73 | 68 | </div> |
74 | 69 | </div> |
75 | 70 | <div class="tender-offer-proj-block-right-wr"> |
76 | 71 | <div class="tender-offer-proj-block-right"> |
77 | - <div class="tender-offer-proj-min-blocks"><span>2000 грн</span></div> | |
78 | - <div class="tender-offer-proj-min-blocks"><span>3 ДНЯ</span></div> | |
72 | + <div class="tender-offer-proj-min-blocks"> | |
73 | + <span><?= $model->budget_from . '-' . $model->budget_to . ' ' . $model->currency->label ?></span> | |
74 | + </div> | |
75 | + <div class="tender-offer-proj-min-blocks"> | |
76 | + <span><?= $model->term_from . '-' . $model->term_to ?> ДНЯ</span></div> | |
79 | 77 | </div> |
80 | 78 | <div class="tender-offer-proj-block-left"> |
81 | 79 | <div class="search-worker-blocks-title-wr"> |
82 | - <div class="search-worker-blocks-title-title">Петер Цумтор</div> | |
80 | + <div class="search-worker-blocks-title-title"><?= $user->name ?></div> | |
83 | 81 | <div class="rating-new"> |
84 | 82 | <!--оценка--> |
85 | - <input type="hidden" class="val" value="4"/> | |
83 | + <input type="hidden" class="val" value="<?= $user->userInfo->rating ?>"/> | |
86 | 84 | </div> |
87 | - <a href="#" class="link-to-comm">30 отзывов</a> | |
85 | + <?= Html::a(count($user->comments) . ' отзывов', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?> | |
88 | 86 | </div> |
89 | 87 | <div class="tender-offer-proj-txt"> |
90 | - <p>1.1 Строительная площадка расположена по адресу: г. Киев.</p> | |
91 | - <p>1.2 Существующий объект представляет собой помещение общей площадью ориентировочно – 140 м2.</p> | |
92 | - <p>1.3. Цель проекта состоит в проведении внутренних общестроительных и отделочных работ.</p> | |
93 | - <p>1.4. При разработке методов строительства и выборе материалов, используемых в настоящем проекте, необходимо учитывать климатические условия, характерные для г. Киева.</p> | |
94 | - <p>1.5. Требования к проектированию и производству работ определяются следующими документами:</p> | |
95 | - <p>- Техническим заданием.</p> | |
96 | - <p>- Строительными нормами и правилами.</p> | |
97 | - <p>Все проектные решения и все разделы рабочего проекта должны быть согласованы с Заказчиком в объеме, необходимом для последующей сдачи инженерных систем и коммуникаций.</p> | |
88 | + <?= $model->text ?> | |
98 | 89 | </div> |
99 | 90 | <ul class="download-list-files"> |
100 | - <li> | |
101 | - <span></span><a href="#" class="download-link-file">КП.doc</a><a href="#" class="download-link">Скачать</a> | |
102 | - </li> | |
103 | - <li> | |
104 | - <span></span><a href="#" class="download-link-file">Резюме.txt</a><a href="#" class="download-link">Скачать</a> | |
105 | - </li> | |
91 | + <?php | |
92 | + foreach($model->getFilesList() as $file) { | |
93 | + ?> | |
94 | + <li> | |
95 | + <span></span> | |
96 | + <?= Html::a($file->name, $file->dir, [ 'class' => 'download-link-file' ]) ?> | |
97 | + <?= Html::a('Скачать', $file->dir, [ | |
98 | + 'class' => 'download-link', | |
99 | + 'download' => 'download', | |
100 | + ]) ?> | |
101 | + </li> | |
102 | + <?php | |
103 | + } | |
104 | + ?> | |
106 | 105 | </ul> |
107 | 106 | </div> |
108 | 107 | <div class="tender-more-buttons-wr"> |
109 | - <a class="get-project-new" href="#">Портфолио</a> | |
110 | - <a class="get-list-new" href="#">Конаткты</a> | |
108 | + <?= Html::a('Портфолио', $user->getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?> | |
109 | + <?= Html::a('Контакты', $user->link, [ 'class' => 'get-list-new' ]) ?> | |
111 | 110 | </div> |
111 | + <?php | |
112 | + if(\Yii::$app->user->getId() == $model->owner->user_id) { | |
113 | + ?> | |
114 | + <div class="project_owner_control" style="clear:both"> | |
115 | + <span>Отметить как: </span> | |
116 | + <?php | |
117 | + echo Html::a('новый', [ '#' ], [ | |
118 | + 'data-project-id' => $model->owner->project_id, | |
119 | + 'data-comment-id' => $model->comment_id, | |
120 | + 'class' => 'artbox_project_make_new', | |
121 | + ]); | |
122 | + echo Html::a('кандидат', [ '#' ], [ | |
123 | + 'data-project-id' => $model->owner->project_id, | |
124 | + 'data-comment-id' => $model->comment_id, | |
125 | + 'class' => 'artbox_project_make_candidate', | |
126 | + ]); | |
127 | + echo Html::a('исполнитель', [ '#' ], [ | |
128 | + 'data-project-id' => $model->owner->project_id, | |
129 | + 'data-comment-id' => $model->comment_id, | |
130 | + 'class' => 'artbox_project_make_performer', | |
131 | + ]); | |
132 | + echo Html::a('отказать', [ '#' ], [ | |
133 | + 'data-project-id' => $model->owner->project_id, | |
134 | + 'data-comment-id' => $model->comment_id, | |
135 | + 'class' => 'artbox_project_make_deny', | |
136 | + ]); | |
137 | + ?> | |
138 | + </div> | |
139 | + <?php | |
140 | + } | |
141 | + ?> | |
112 | 142 | |
113 | 143 | </div> | ... | ... |
common/modules/comment/widgets/views/_review_comment_view.php
0 → 100644
1 | +<?php | |
2 | + use common\models\User; | |
3 | + use yii\helpers\Html; | |
4 | + | |
5 | + /** | |
6 | + * @var \common\modules\comment\models\Comment $model Current comment model | |
7 | + * @var integer $key ID of current comment | |
8 | + * @var integer $index index of current element according | |
9 | + * to current page, starting from 0 | |
10 | + * @var \yii\widgets\ListView $widget current ListView instance | |
11 | + * @var User $user | |
12 | + */ | |
13 | + $user = $model->user; | |
14 | +?> | |
15 | + <div class="comments-name"> | |
16 | + <?php | |
17 | + if(!empty($user)) { | |
18 | + echo $user->name; | |
19 | + } else { | |
20 | + echo $model->user_name; | |
21 | + } | |
22 | + ?> | |
23 | + </div> | |
24 | +<?php | |
25 | + /* == STATUS PRO == | |
26 | + ?> | |
27 | + <div class="comments-status"><span>Pro</span></div> | |
28 | + <?php | |
29 | + */ | |
30 | +?> | |
31 | + <div class="comments-date"><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></div> | |
32 | +<?php | |
33 | + if(!empty( $model->rating )) { | |
34 | + ?> | |
35 | + <div class="rating"> | |
36 | + <!--оценка--> | |
37 | + <input type="hidden" class="val" value="<?= $model->rating->value ?>"/> | |
38 | + </div> | |
39 | + <?php | |
40 | + } | |
41 | +?> | |
42 | + <div class="comments-content"> | |
43 | + <?= $model->text ?> | |
44 | + </div> | |
45 | +<?php | |
46 | + /* == PROJECT INFO == | |
47 | + ?> | |
48 | + <div class="comments-project-link">Проект: <a href="#">Ремонт спальни</a></div> | |
49 | + <?php | |
50 | + */ | |
51 | +?> | |
0 | 52 | \ No newline at end of file | ... | ... |
common/modules/comment/widgets/views/form-comment-review.php
0 → 100644
1 | +<?php | |
2 | + /** | |
3 | + * @var \common\modules\comment\models\Comment $model | |
4 | + * @var \common\models\User $user | |
5 | + * @var \yii\data\ActiveDataProvider $dataProvider | |
6 | + * @var null|\common\modules\comment\models\Rating $rating | |
7 | + */ | |
8 | + use yii\widgets\ActiveForm; | |
9 | + use yii\helpers\Html; | |
10 | + | |
11 | +?> | |
12 | +<div class="workplace-title style"> | |
13 | + <p></p>Мнения о пользователе: <?= $dataProvider->totalCount ?></p></div> | |
14 | +<div class="new-portf-add-comm style"> | |
15 | + <?php | |
16 | + $form = ActiveForm::begin(); | |
17 | + echo $form->field($rating, 'value') | |
18 | + ->label(false) | |
19 | + ->radioList([ | |
20 | + 1 => 1, | |
21 | + 2 => 2, | |
22 | + 3 => 3, | |
23 | + 4 => 4, | |
24 | + 5 => 5, | |
25 | + ]); | |
26 | + if($model->scenario == $model::SCENARIO_GUEST) { | |
27 | + echo $form->field($model, 'user_name', [ | |
28 | + 'options' => [ | |
29 | + 'class' => 'input-blocks-comm', | |
30 | + ], | |
31 | + 'inputOptions' => [ | |
32 | + 'class' => 'custom-input-4', | |
33 | + ], | |
34 | + ]) | |
35 | + ->textInput(); | |
36 | + echo $form->field($model, 'user_email', [ | |
37 | + 'options' => [ | |
38 | + 'class' => 'input-blocks-comm', | |
39 | + ], | |
40 | + 'inputOptions' => [ | |
41 | + 'class' => 'custom-input-4', | |
42 | + ], | |
43 | + ]) | |
44 | + ->textInput(); | |
45 | + } | |
46 | + | |
47 | + ?> | |
48 | + <div class="artbox_comment_reply_block"></div> | |
49 | + <?php | |
50 | + echo $form->field($model, 'text', [ | |
51 | + 'options' => [ | |
52 | + 'class' => 'input-blocks-comm area-comm', | |
53 | + ], | |
54 | + 'inputOptions' => [ | |
55 | + 'class' => 'custom-area-4', | |
56 | + ], | |
57 | + ]) | |
58 | + ->textarea(); | |
59 | + ?> | |
60 | + <div class="input-blocks-comm-button style"> | |
61 | + <?= Html::submitButton('Добавить комментарий') ?> | |
62 | + </div> | |
63 | + <?php | |
64 | + $form->end(); | |
65 | + ?> | |
66 | +</div> | |
0 | 67 | \ No newline at end of file | ... | ... |
common/modules/comment/widgets/views/form-project-comment.php
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <div class="new-portf-add-comm style"> |
15 | 15 | <div class="box-wr"> |
16 | 16 | <div class="box-all"> |
17 | - <div class="tender-add-answer-title">Добавить ответ</div> | |
17 | + <div class="tender-add-answer-title"><?= Yii::t('app', 'add_answer') ?></div> | |
18 | 18 | <div class="form-tender-answer style"> |
19 | 19 | <?php |
20 | 20 | $form = ActiveForm::begin([ 'options' => [ 'class' => 'resformsfile MultiFile-intercepted', 'enctype' => 'multipart/form-data' ] ]); |
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | <div class="form-value-wr style"> |
23 | 23 | <div class="form-ico-ded-wr"> |
24 | 24 | <div class="header-cabinet-foto"> |
25 | - <?= Html::img($user->userInfo->image) ?> | |
25 | + <?= Html::img(($user->userInfo->image)?:'') ?> | |
26 | 26 | </div> |
27 | 27 | <div class="form-value-ded-name"> |
28 | 28 | <?= $user->name ?> | ... | ... |
common/modules/comment/widgets/views/list-comment-review.php
0 → 100644
1 | +<?php | |
2 | + /** | |
3 | + * @var \yii\data\DataProviderInterface $dataProvider | |
4 | + */ | |
5 | +echo \yii\widgets\ListView::widget([ | |
6 | + 'dataProvider' => $dataProvider, | |
7 | + 'itemView' => '_review_comment_view', | |
8 | + 'options' => [ | |
9 | + 'tag' => 'ul', | |
10 | + 'class' => 'proektant-comments style' | |
11 | + ], | |
12 | + 'itemOptions' => [ | |
13 | + 'tag' => 'li', | |
14 | + ], | |
15 | + 'layout' => "{items}\n{pager}", | |
16 | +]); | |
0 | 17 | \ No newline at end of file | ... | ... |
common/modules/comment/widgets/views/list-project-comment.php
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | ?> |
6 | 6 | <div class="box-wr"> |
7 | 7 | <div class="box-all"> |
8 | - <div class="tender-offer-proj-title-all style">Предложения проектантов</div> | |
8 | + <div class="tender-offer-proj-title-all style">Предложения проектантов (<?=$dataProvider->getTotalCount()?>)</div> | |
9 | 9 | <div class="tender-offer-proj-blocks-wr style"> |
10 | 10 | <?php |
11 | 11 | echo \yii\widgets\ListView::widget([ | ... | ... |
common/modules/product/models/Brand.php
... | ... | @@ -27,6 +27,12 @@ class Brand extends \yii\db\ActiveRecord |
27 | 27 | public function behaviors() |
28 | 28 | { |
29 | 29 | return [ |
30 | + 'slug' => [ | |
31 | + 'class' => Slug::className(), | |
32 | + 'in_attribute' => 'name', | |
33 | + 'out_attribute' => 'alias', | |
34 | + 'translit' => true | |
35 | + ], | |
30 | 36 | 'artboxsynonym' => [ |
31 | 37 | 'class' => ArtboxSynonymBehavior::className(), |
32 | 38 | 'keyNameValue' => 'brand_name_id', |
... | ... | @@ -35,13 +41,7 @@ class Brand extends \yii\db\ActiveRecord |
35 | 41 | 'valueFields' => [ // postKey => DBFieldName |
36 | 42 | 'name' => 'value' |
37 | 43 | ] |
38 | - ], | |
39 | - 'slug' => [ | |
40 | - 'class' => Slug::className(), | |
41 | - 'in_attribute' => 'name', | |
42 | - 'out_attribute' => 'alias', | |
43 | - 'translit' => true | |
44 | - ], | |
44 | + ] | |
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | ... | ... |
common/modules/product/models/ProductVariant.php
... | ... | @@ -34,7 +34,7 @@ class ProductVariant extends \yii\db\ActiveRecord |
34 | 34 | public function rules() |
35 | 35 | { |
36 | 36 | return [ |
37 | - [['product_id', 'sku', 'product_unit_id'], 'required'], | |
37 | + [['product_id', 'name', 'sku', 'product_unit_id'], 'required'], | |
38 | 38 | [['product_id', 'product_unit_id'], 'integer'], |
39 | 39 | [['price', 'price_old', 'stock'], 'number'], |
40 | 40 | [['name', 'sku'], 'string', 'max' => 255], | ... | ... |
common/modules/rubrication/models/TaxGroup.php
... | ... | @@ -15,7 +15,7 @@ use Yii; |
15 | 15 | * @property string $module |
16 | 16 | * @property boolean $hierarchical |
17 | 17 | * @property string $settings |
18 | - * @property boolean $is_filter | |
18 | + * @property boolean is_filter | |
19 | 19 | * |
20 | 20 | * @property TaxGroupToGroup[] $taxGroupToGroups |
21 | 21 | * @property TaxGroupToGroup[] $taxGroupToGroups0 |
... | ... | @@ -62,7 +62,7 @@ class TaxGroup extends \yii\db\ActiveRecord |
62 | 62 | return [ |
63 | 63 | [['name', 'module'], 'required'], |
64 | 64 | [['description', 'settings'], 'string'], |
65 | - [['hierarchical', 'is_filter'], 'boolean'], | |
65 | + [['hierarchical'], 'boolean'], | |
66 | 66 | [['alias', 'module'], 'string', 'max' => 50], |
67 | 67 | [['name'], 'string', 'max' => 255], |
68 | 68 | [['group_to_category'], 'safe'] | ... | ... |
common/translation/ru/app.php
... | ... | @@ -8,7 +8,7 @@ return [ |
8 | 8 | 'password_reset_token' => 'Password Reset Token', |
9 | 9 | 'email' => 'Логин (e-mail)', |
10 | 10 | 'phone' => 'Телефон', |
11 | - 'status' => 'Status', | |
11 | + 'status' => 'Статус', | |
12 | 12 | 'created_at' => 'Created At', |
13 | 13 | 'updated_at' => 'Updated At', |
14 | 14 | 'verifyCode' => 'Код проверки', |
... | ... | @@ -32,4 +32,50 @@ return [ |
32 | 32 | 'my_orders' => 'Мои заказы', |
33 | 33 | 'bookmarks' => 'Закладки', |
34 | 34 | 'basket' => 'Корзина', |
35 | + 'banner_id' => 'Banner ID', | |
36 | + 'image' => 'Изображение', | |
37 | + 'alt' => 'Описание', | |
38 | + 'title' => 'Заголовок', | |
39 | + 'url' => 'Ссылка', | |
40 | + 'width' => 'Ширина', | |
41 | + 'height' => 'Высота', | |
42 | + 'blog_id' => 'Blog ID', | |
43 | + 'user_id' => 'User ID', | |
44 | + 'name' => 'Название', | |
45 | + 'link' => 'Ссылка', | |
46 | + 'date_add' => 'Дата добавления', | |
47 | + 'user_add_id' => 'User Add ID', | |
48 | + 'view_count' => 'Количество просмотров', | |
49 | + 'description' => 'Описание', | |
50 | + 'cover' => 'Фото главное', | |
51 | + 'event_id' => 'Event ID', | |
52 | + 'alias' => 'Ссылка', | |
53 | + 'body' => 'Тело', | |
54 | + 'meta_title' => 'Мета заголовок', | |
55 | + 'h1' => 'H1', | |
56 | + 'seo_text' => 'Сео Текст', | |
57 | + 'end_at' => 'Срок действия по', | |
58 | + 'order_items_id' => 'Order Items ID', | |
59 | + 'order_id' => 'Order ID', | |
60 | + 'item_id' => 'Item ID', | |
61 | + 'item_count' => 'Количество', | |
62 | + 'price' => 'Цена', | |
63 | + 'customer_id' => 'Customer ID', | |
64 | + 'delivery' => 'Доставка', | |
65 | + 'payment' => 'Оплата', | |
66 | + 'seo_id' => 'Seo ID', | |
67 | + 'controller' => 'Controller', | |
68 | + 'seo_category_id' => 'Seo Category ID', | |
69 | + 'seo_dynamic_id' => 'Seo Dynamic ID', | |
70 | + 'action' => 'Action', | |
71 | + 'fields' => 'Поля', | |
72 | + 'param' => 'Параметры', | |
73 | + 'key' => 'Ключ', | |
74 | + 'service_id' => 'Service ID', | |
75 | + 'slider_id' => 'Slider ID', | |
76 | + 'speed' => 'Скорость', | |
77 | + 'duration' => 'Продолжительность', | |
78 | + 'slider_image_id' => 'Slider Image ID', | |
79 | + 'sort' => 'Сортировка', | |
80 | + | |
35 | 81 | ]; |
36 | 82 | \ No newline at end of file | ... | ... |
composer.json
... | ... | @@ -33,7 +33,9 @@ |
33 | 33 | "FortAwesome/Font-Awesome": "*", |
34 | 34 | "kartik-v/yii2-widget-datepicker": "*", |
35 | 35 | "unclead/yii2-multiple-input": "~1.0", |
36 | - "codeception/codeception":"*" | |
36 | + "codeception/codeception":"*", | |
37 | + "phpmailer/phpmailer": "^5.2", | |
38 | + "league/oauth2-client": "^1.3" | |
37 | 39 | }, |
38 | 40 | "require-dev": { |
39 | 41 | "yiisoft/yii2-codeception": "*", | ... | ... |
composer.lock
... | ... | @@ -4,8 +4,8 @@ |
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 | - "hash": "a7d36c8cf4be5f624bef0426936b9594", | |
8 | - "content-hash": "1e53816a430c74ec792d83ade8eac412", | |
7 | + "hash": "d817e95d434dbdfff82796cc0b6e9c9e", | |
8 | + "content-hash": "a704572d721b5adc21f823d363fcd4de", | |
9 | 9 | "packages": [ |
10 | 10 | { |
11 | 11 | "name": "2amigos/yii2-transliterator-helper", |
... | ... | @@ -559,7 +559,7 @@ |
559 | 559 | }, |
560 | 560 | "dist": { |
561 | 561 | "type": "zip", |
562 | - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/a04ceaea52d2a050d8df19df1a85fb1b24456477", | |
562 | + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/c3a92199d02598de6fb59fa57913a10909628e4f", | |
563 | 563 | "reference": "a04ceaea52d2a050d8df19df1a85fb1b24456477", |
564 | 564 | "shasum": "" |
565 | 565 | }, |
... | ... | @@ -739,7 +739,7 @@ |
739 | 739 | }, |
740 | 740 | "dist": { |
741 | 741 | "type": "zip", |
742 | - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", | |
742 | + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/416fb8ad1d095a87f1d21bc40711843cd122fd4a", | |
743 | 743 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", |
744 | 744 | "shasum": "" |
745 | 745 | }, |
... | ... | @@ -880,7 +880,7 @@ |
880 | 880 | }, |
881 | 881 | "dist": { |
882 | 882 | "type": "zip", |
883 | - "url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/f97ab41d187553e86abb8c7f6c057c9c0b88de58", | |
883 | + "url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/06b2efcda0d4612eccdaf8b79ae428fd079f2dfb", | |
884 | 884 | "reference": "f97ab41d187553e86abb8c7f6c057c9c0b88de58", |
885 | 885 | "shasum": "" |
886 | 886 | }, |
... | ... | @@ -928,7 +928,7 @@ |
928 | 928 | }, |
929 | 929 | "dist": { |
930 | 930 | "type": "zip", |
931 | - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", | |
931 | + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/85cb758d7367f3aaaa8ffc9269e777919c5f68bb", | |
932 | 932 | "reference": "d094e337976dff9d8e2424e8485872194e768662", |
933 | 933 | "shasum": "" |
934 | 934 | }, |
... | ... | @@ -1147,6 +1147,106 @@ |
1147 | 1147 | "time": "2014-06-13 10:54:04" |
1148 | 1148 | }, |
1149 | 1149 | { |
1150 | + "name": "ircmaxell/random-lib", | |
1151 | + "version": "dev-master", | |
1152 | + "source": { | |
1153 | + "type": "git", | |
1154 | + "url": "https://github.com/ircmaxell/RandomLib.git", | |
1155 | + "reference": "ad6a37d7bce67b0954be63feb1b4c47da77c527f" | |
1156 | + }, | |
1157 | + "dist": { | |
1158 | + "type": "zip", | |
1159 | + "url": "https://api.github.com/repos/ircmaxell/RandomLib/zipball/ad6a37d7bce67b0954be63feb1b4c47da77c527f", | |
1160 | + "reference": "ad6a37d7bce67b0954be63feb1b4c47da77c527f", | |
1161 | + "shasum": "" | |
1162 | + }, | |
1163 | + "require": { | |
1164 | + "ircmaxell/security-lib": "1.1.*@dev", | |
1165 | + "php": ">=5.3.2" | |
1166 | + }, | |
1167 | + "require-dev": { | |
1168 | + "mikey179/vfsstream": "1.1.*", | |
1169 | + "phpunit/phpunit": "3.7.*" | |
1170 | + }, | |
1171 | + "type": "library", | |
1172 | + "extra": { | |
1173 | + "branch-alias": { | |
1174 | + "dev-master": "1.1.x-dev" | |
1175 | + } | |
1176 | + }, | |
1177 | + "autoload": { | |
1178 | + "psr-0": { | |
1179 | + "RandomLib": "lib" | |
1180 | + } | |
1181 | + }, | |
1182 | + "notification-url": "https://packagist.org/downloads/", | |
1183 | + "license": [ | |
1184 | + "MIT" | |
1185 | + ], | |
1186 | + "authors": [ | |
1187 | + { | |
1188 | + "name": "Anthony Ferrara", | |
1189 | + "email": "ircmaxell@ircmaxell.com", | |
1190 | + "homepage": "http://blog.ircmaxell.com" | |
1191 | + } | |
1192 | + ], | |
1193 | + "description": "A Library For Generating Secure Random Numbers", | |
1194 | + "homepage": "https://github.com/ircmaxell/RandomLib", | |
1195 | + "keywords": [ | |
1196 | + "cryptography", | |
1197 | + "random", | |
1198 | + "random-numbers", | |
1199 | + "random-strings" | |
1200 | + ], | |
1201 | + "time": "2016-02-22 13:55:31" | |
1202 | + }, | |
1203 | + { | |
1204 | + "name": "ircmaxell/security-lib", | |
1205 | + "version": "v1.1.0", | |
1206 | + "source": { | |
1207 | + "type": "git", | |
1208 | + "url": "https://github.com/ircmaxell/SecurityLib.git", | |
1209 | + "reference": "f3db6de12c20c9bcd1aa3db4353a1bbe0e44e1b5" | |
1210 | + }, | |
1211 | + "dist": { | |
1212 | + "type": "zip", | |
1213 | + "url": "https://api.github.com/repos/ircmaxell/SecurityLib/zipball/f3db6de12c20c9bcd1aa3db4353a1bbe0e44e1b5", | |
1214 | + "reference": "f3db6de12c20c9bcd1aa3db4353a1bbe0e44e1b5", | |
1215 | + "shasum": "" | |
1216 | + }, | |
1217 | + "require": { | |
1218 | + "php": ">=5.3.2" | |
1219 | + }, | |
1220 | + "require-dev": { | |
1221 | + "mikey179/vfsstream": "1.1.*" | |
1222 | + }, | |
1223 | + "type": "library", | |
1224 | + "extra": { | |
1225 | + "branch-alias": { | |
1226 | + "dev-master": "1.0.x-dev" | |
1227 | + } | |
1228 | + }, | |
1229 | + "autoload": { | |
1230 | + "psr-0": { | |
1231 | + "SecurityLib": "lib" | |
1232 | + } | |
1233 | + }, | |
1234 | + "notification-url": "https://packagist.org/downloads/", | |
1235 | + "license": [ | |
1236 | + "MIT" | |
1237 | + ], | |
1238 | + "authors": [ | |
1239 | + { | |
1240 | + "name": "Anthony Ferrara", | |
1241 | + "email": "ircmaxell@ircmaxell.com", | |
1242 | + "homepage": "http://blog.ircmaxell.com" | |
1243 | + } | |
1244 | + ], | |
1245 | + "description": "A Base Security Library", | |
1246 | + "homepage": "https://github.com/ircmaxell/SecurityLib", | |
1247 | + "time": "2015-03-20 14:31:23" | |
1248 | + }, | |
1249 | + { | |
1150 | 1250 | "name": "kartik-v/yii2-krajee-base", |
1151 | 1251 | "version": "dev-master", |
1152 | 1252 | "source": { |
... | ... | @@ -1156,7 +1256,7 @@ |
1156 | 1256 | }, |
1157 | 1257 | "dist": { |
1158 | 1258 | "type": "zip", |
1159 | - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/3e491e51ed742663b239cd6e0b7f76d403bed7e1", | |
1259 | + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/3115b09aeb15a5e06f38dc16860baf153d9bf70e", | |
1160 | 1260 | "reference": "3e491e51ed742663b239cd6e0b7f76d403bed7e1", |
1161 | 1261 | "shasum": "" |
1162 | 1262 | }, |
... | ... | @@ -1207,7 +1307,7 @@ |
1207 | 1307 | }, |
1208 | 1308 | "dist": { |
1209 | 1309 | "type": "zip", |
1210 | - "url": "https://api.github.com/repos/kartik-v/yii2-widget-colorinput/zipball/18537fcdab0f5491d5eebff8e2464ef6a616ee4c", | |
1310 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-colorinput/zipball/1a10c5e9a528270e22dc8a5eba404c72f417665a", | |
1211 | 1311 | "reference": "18537fcdab0f5491d5eebff8e2464ef6a616ee4c", |
1212 | 1312 | "shasum": "" |
1213 | 1313 | }, |
... | ... | @@ -1261,7 +1361,7 @@ |
1261 | 1361 | }, |
1262 | 1362 | "dist": { |
1263 | 1363 | "type": "zip", |
1264 | - "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/3f7b38886e334a2c8c4262f155d98812461efd36", | |
1364 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/52606c8764a174aa0d5e6483ed811f617c74ee4e", | |
1265 | 1365 | "reference": "3f7b38886e334a2c8c4262f155d98812461efd36", |
1266 | 1366 | "shasum": "" |
1267 | 1367 | }, |
... | ... | @@ -1359,6 +1459,69 @@ |
1359 | 1459 | "time": "2016-03-10 11:33:59" |
1360 | 1460 | }, |
1361 | 1461 | { |
1462 | + "name": "league/oauth2-client", | |
1463 | + "version": "1.3.0", | |
1464 | + "source": { | |
1465 | + "type": "git", | |
1466 | + "url": "https://github.com/thephpleague/oauth2-client.git", | |
1467 | + "reference": "5e5c0bc5bd219515c8d8db8bcb61f19753101b7c" | |
1468 | + }, | |
1469 | + "dist": { | |
1470 | + "type": "zip", | |
1471 | + "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/5e5c0bc5bd219515c8d8db8bcb61f19753101b7c", | |
1472 | + "reference": "5e5c0bc5bd219515c8d8db8bcb61f19753101b7c", | |
1473 | + "shasum": "" | |
1474 | + }, | |
1475 | + "require": { | |
1476 | + "ext-curl": "*", | |
1477 | + "guzzlehttp/guzzle": "~6.0", | |
1478 | + "ircmaxell/random-lib": "~1.1", | |
1479 | + "php": ">=5.5.0" | |
1480 | + }, | |
1481 | + "require-dev": { | |
1482 | + "jakub-onderka/php-parallel-lint": "0.8.*", | |
1483 | + "mockery/mockery": "~0.9", | |
1484 | + "phpunit/phpunit": "~4.0", | |
1485 | + "satooshi/php-coveralls": "0.6.*", | |
1486 | + "squizlabs/php_codesniffer": "~2.0" | |
1487 | + }, | |
1488 | + "type": "library", | |
1489 | + "extra": { | |
1490 | + "branch-alias": { | |
1491 | + "dev-master": "1.0.x-dev" | |
1492 | + } | |
1493 | + }, | |
1494 | + "autoload": { | |
1495 | + "psr-4": { | |
1496 | + "League\\OAuth2\\Client\\": "src/" | |
1497 | + } | |
1498 | + }, | |
1499 | + "notification-url": "https://packagist.org/downloads/", | |
1500 | + "license": [ | |
1501 | + "MIT" | |
1502 | + ], | |
1503 | + "authors": [ | |
1504 | + { | |
1505 | + "name": "Alex Bilbie", | |
1506 | + "email": "hello@alexbilbie.com", | |
1507 | + "homepage": "http://www.alexbilbie.com", | |
1508 | + "role": "Developer" | |
1509 | + } | |
1510 | + ], | |
1511 | + "description": "OAuth 2.0 Client Library", | |
1512 | + "keywords": [ | |
1513 | + "Authentication", | |
1514 | + "SSO", | |
1515 | + "authorization", | |
1516 | + "identity", | |
1517 | + "idp", | |
1518 | + "oauth", | |
1519 | + "oauth2", | |
1520 | + "single sign on" | |
1521 | + ], | |
1522 | + "time": "2016-02-13 20:18:03" | |
1523 | + }, | |
1524 | + { | |
1362 | 1525 | "name": "lusitanian/oauth", |
1363 | 1526 | "version": "v0.3.6", |
1364 | 1527 | "source": { |
... | ... | @@ -1670,6 +1833,60 @@ |
1670 | 1833 | "time": "2015-02-03 12:10:50" |
1671 | 1834 | }, |
1672 | 1835 | { |
1836 | + "name": "phpmailer/phpmailer", | |
1837 | + "version": "5.4.x-dev", | |
1838 | + "source": { | |
1839 | + "type": "git", | |
1840 | + "url": "https://github.com/PHPMailer/PHPMailer.git", | |
1841 | + "reference": "3d4e3b1a0da0a33889f8b0b2afda6ad4f6d011b5" | |
1842 | + }, | |
1843 | + "dist": { | |
1844 | + "type": "zip", | |
1845 | + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/3d4e3b1a0da0a33889f8b0b2afda6ad4f6d011b5", | |
1846 | + "reference": "3d4e3b1a0da0a33889f8b0b2afda6ad4f6d011b5", | |
1847 | + "shasum": "" | |
1848 | + }, | |
1849 | + "require": { | |
1850 | + "php": ">=5.5.0" | |
1851 | + }, | |
1852 | + "require-dev": { | |
1853 | + "phpdocumentor/phpdocumentor": "2.*", | |
1854 | + "phpunit/phpunit": "4.*" | |
1855 | + }, | |
1856 | + "suggest": { | |
1857 | + "league/oauth2-client": "Needed for XOAUTH2 authentication" | |
1858 | + }, | |
1859 | + "type": "library", | |
1860 | + "autoload": { | |
1861 | + "psr-4": { | |
1862 | + "PHPMailer\\PHPMailer\\": "src/" | |
1863 | + } | |
1864 | + }, | |
1865 | + "notification-url": "https://packagist.org/downloads/", | |
1866 | + "license": [ | |
1867 | + "LGPL-2.1" | |
1868 | + ], | |
1869 | + "authors": [ | |
1870 | + { | |
1871 | + "name": "Jim Jagielski", | |
1872 | + "email": "jimjag@gmail.com" | |
1873 | + }, | |
1874 | + { | |
1875 | + "name": "Marcus Bointon", | |
1876 | + "email": "phpmailer@synchromedia.co.uk" | |
1877 | + }, | |
1878 | + { | |
1879 | + "name": "Andy Prevost", | |
1880 | + "email": "codeworxtech@users.sourceforge.net" | |
1881 | + }, | |
1882 | + { | |
1883 | + "name": "Brent R. Matzelle" | |
1884 | + } | |
1885 | + ], | |
1886 | + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", | |
1887 | + "time": "2016-04-07 09:04:03" | |
1888 | + }, | |
1889 | + { | |
1673 | 1890 | "name": "phpspec/prophecy", |
1674 | 1891 | "version": "dev-master", |
1675 | 1892 | "source": { |
... | ... | @@ -1981,7 +2198,7 @@ |
1981 | 2198 | }, |
1982 | 2199 | "dist": { |
1983 | 2200 | "type": "zip", |
1984 | - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a1b63266c046e1856fd03812a4e0ac2b51aa2d5", | |
2201 | + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/496745aeba741e63b7149da3e1f712d441751182", | |
1985 | 2202 | "reference": "1a1b63266c046e1856fd03812a4e0ac2b51aa2d5", |
1986 | 2203 | "shasum": "" |
1987 | 2204 | }, |
... | ... | @@ -2743,7 +2960,7 @@ |
2743 | 2960 | }, |
2744 | 2961 | "dist": { |
2745 | 2962 | "type": "zip", |
2746 | - "url": "https://api.github.com/repos/symfony/console/zipball/6b1175135bc2a74c08a28d89761272de8beed8cd", | |
2963 | + "url": "https://api.github.com/repos/symfony/console/zipball/7541c505d2b804cc65a4edf90a6f1cb496523fef", | |
2747 | 2964 | "reference": "6b1175135bc2a74c08a28d89761272de8beed8cd", |
2748 | 2965 | "shasum": "" |
2749 | 2966 | }, |
... | ... | @@ -2856,7 +3073,7 @@ |
2856 | 3073 | }, |
2857 | 3074 | "dist": { |
2858 | 3075 | "type": "zip", |
2859 | - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/18a06d7a9af41718c20764a674a0ebba3bc40d1f", | |
3076 | + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/49b588841225b205700e5122fa01911cabada857", | |
2860 | 3077 | "reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f", |
2861 | 3078 | "shasum": "" |
2862 | 3079 | }, |
... | ... | @@ -2912,7 +3129,7 @@ |
2912 | 3129 | }, |
2913 | 3130 | "dist": { |
2914 | 3131 | "type": "zip", |
2915 | - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9002dcf018d884d294b1ef20a6f968efc1128f39", | |
3132 | + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/17b04e6b1ede45b57d3ad5146abe50df6c3968b4", | |
2916 | 3133 | "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39", |
2917 | 3134 | "shasum": "" |
2918 | 3135 | }, |
... | ... | @@ -3174,7 +3391,7 @@ |
3174 | 3391 | }, |
3175 | 3392 | "dist": { |
3176 | 3393 | "type": "zip", |
3177 | - "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/bcc317666439a8ec1dc28874e0577b860b6dd6b3", | |
3394 | + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/b7e62df2cfa1dfab4e70223770a99c3798d4a412", | |
3178 | 3395 | "reference": "bcc317666439a8ec1dc28874e0577b860b6dd6b3", |
3179 | 3396 | "shasum": "" |
3180 | 3397 | }, |
... | ... | @@ -3268,7 +3485,7 @@ |
3268 | 3485 | }, |
3269 | 3486 | "dist": { |
3270 | 3487 | "type": "zip", |
3271 | - "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/4dd9f52e2a376a875d998de6ab4c381291b0c69e", | |
3488 | + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/772b610ea7940059584f9220f7b87e4b2b1a0e78", | |
3272 | 3489 | "reference": "4dd9f52e2a376a875d998de6ab4c381291b0c69e", |
3273 | 3490 | "shasum": "" |
3274 | 3491 | }, |
... | ... | @@ -3318,7 +3535,7 @@ |
3318 | 3535 | }, |
3319 | 3536 | "dist": { |
3320 | 3537 | "type": "zip", |
3321 | - "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/348122de0b2c2e343b579f93fcda1da78cab4912", | |
3538 | + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/f5fe6ba58dbc92b37daed5d9bd94cda777852ee4", | |
3322 | 3539 | "reference": "348122de0b2c2e343b579f93fcda1da78cab4912", |
3323 | 3540 | "shasum": "" |
3324 | 3541 | }, |
... | ... | @@ -3365,7 +3582,7 @@ |
3365 | 3582 | }, |
3366 | 3583 | "dist": { |
3367 | 3584 | "type": "zip", |
3368 | - "url": "https://api.github.com/repos/yiisoft/yii2-imagine/zipball/a6c34ef6b69fb4670ba987ce4b9cfdb2131a8b99", | |
3585 | + "url": "https://api.github.com/repos/yiisoft/yii2-imagine/zipball/3be1ecc324aa156a97f03e3fc59045c8d61be1f8", | |
3369 | 3586 | "reference": "a6c34ef6b69fb4670ba987ce4b9cfdb2131a8b99", |
3370 | 3587 | "shasum": "" |
3371 | 3588 | }, |
... | ... | @@ -3413,7 +3630,7 @@ |
3413 | 3630 | }, |
3414 | 3631 | "dist": { |
3415 | 3632 | "type": "zip", |
3416 | - "url": "https://api.github.com/repos/yiisoft/yii2-jui/zipball/69cd9763b4807dbbce367d599dc615c5b8a8ef4f", | |
3633 | + "url": "https://api.github.com/repos/yiisoft/yii2-jui/zipball/9ab9a2cb17cd7f13921339e11e5146295cf39083", | |
3417 | 3634 | "reference": "69cd9763b4807dbbce367d599dc615c5b8a8ef4f", |
3418 | 3635 | "shasum": "" |
3419 | 3636 | }, |
... | ... | @@ -3463,7 +3680,7 @@ |
3463 | 3680 | }, |
3464 | 3681 | "dist": { |
3465 | 3682 | "type": "zip", |
3466 | - "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/20775fef1047cd927908270a8d7983580304eb57", | |
3683 | + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/163b9c6273e133c43a596aef46a9f5b1537731f9", | |
3467 | 3684 | "reference": "20775fef1047cd927908270a8d7983580304eb57", |
3468 | 3685 | "shasum": "" |
3469 | 3686 | }, |
... | ... | @@ -3542,7 +3759,7 @@ |
3542 | 3759 | }, |
3543 | 3760 | "dist": { |
3544 | 3761 | "type": "zip", |
3545 | - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/8deb6343c80c4edf546a6fff01a2b05c7dc59ac4", | |
3762 | + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/1c33e894fbbad6cf65bd42871719cd33227ed6a7", | |
3546 | 3763 | "reference": "8deb6343c80c4edf546a6fff01a2b05c7dc59ac4", |
3547 | 3764 | "shasum": "" |
3548 | 3765 | }, |
... | ... | @@ -3592,7 +3809,7 @@ |
3592 | 3809 | }, |
3593 | 3810 | "dist": { |
3594 | 3811 | "type": "zip", |
3595 | - "url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a", | |
3812 | + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", | |
3596 | 3813 | "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a", |
3597 | 3814 | "shasum": "" |
3598 | 3815 | }, |
... | ... | @@ -3626,7 +3843,7 @@ |
3626 | 3843 | }, |
3627 | 3844 | "dist": { |
3628 | 3845 | "type": "zip", |
3629 | - "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/e01b3c46917b3f00c42f6a4aabf612cc36d792e6", | |
3846 | + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/572a6d46d942cc5733c45931fdbd1d60228f3c89", | |
3630 | 3847 | "reference": "e01b3c46917b3f00c42f6a4aabf612cc36d792e6", |
3631 | 3848 | "shasum": "" |
3632 | 3849 | }, |
... | ... | @@ -3671,7 +3888,7 @@ |
3671 | 3888 | }, |
3672 | 3889 | "dist": { |
3673 | 3890 | "type": "zip", |
3674 | - "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/081795536b31d29106b0d1de0cb3aefa3e05e995", | |
3891 | + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/e26905af4bc1ca5ecbababac112c7f7f722cabd2", | |
3675 | 3892 | "reference": "081795536b31d29106b0d1de0cb3aefa3e05e995", |
3676 | 3893 | "shasum": "" |
3677 | 3894 | }, |
... | ... | @@ -3718,7 +3935,7 @@ |
3718 | 3935 | }, |
3719 | 3936 | "dist": { |
3720 | 3937 | "type": "zip", |
3721 | - "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/a8daa97749e7154d91676405a1c59ed81e1ca999", | |
3938 | + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/6e6eb430809e3f9c05e367303909a05a4912d4c0", | |
3722 | 3939 | "reference": "a8daa97749e7154d91676405a1c59ed81e1ca999", |
3723 | 3940 | "shasum": "" |
3724 | 3941 | }, |
... | ... | @@ -3765,7 +3982,7 @@ |
3765 | 3982 | }, |
3766 | 3983 | "dist": { |
3767 | 3984 | "type": "zip", |
3768 | - "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/989d6c52c92e51f0d562729c329ee1012191cba2", | |
3985 | + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/70edab5a7938b5bf4b5dc3ad1e1c3ce673552f48", | |
3769 | 3986 | "reference": "989d6c52c92e51f0d562729c329ee1012191cba2", |
3770 | 3987 | "shasum": "" |
3771 | 3988 | }, | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160225_143331_comment_test extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->createTable('{{%comment}}', [ | |
10 | + 'comment_id' => $this->primaryKey(), | |
11 | + 'entity' => $this->string()->notNull(), | |
12 | + 'text' => $this->text()->notNull(), | |
13 | + 'user_id' => $this->integer(), | |
14 | + 'user_name' => $this->string(), | |
15 | + 'user_email' => $this->string(), | |
16 | + 'comment_pid' => $this->integer(), | |
17 | + 'status' => $this->integer(), | |
18 | + 'date_add' => $this->timestamp()->notNull()->defaultExpression('NOW()'), | |
19 | + 'date_update' => $this->timestamp()->notNull()->defaultExpression('NOW()'), | |
20 | + 'date_delete' => $this->timestamp(), | |
21 | + ]); | |
22 | + | |
23 | + $this->addForeignKey('comment_user', '{{%comment}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); | |
24 | + } | |
25 | + | |
26 | + public function down() | |
27 | + { | |
28 | + $this->dropForeignKey('comment_user', '{{%comment}}'); | |
29 | + $this->dropTable('{{%comment}}'); | |
30 | + } | |
31 | + | |
32 | + /* | |
33 | + // Use safeUp/safeDown to run migration code within a transaction | |
34 | + public function safeUp() | |
35 | + { | |
36 | + } | |
37 | + | |
38 | + public function safeDown() | |
39 | + { | |
40 | + } | |
41 | + */ | |
42 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160304_081817_rating_table extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->createTable('{{%rating}}', [ | |
10 | + 'rating_id' => $this->primaryKey(), | |
11 | + 'date_add' => $this->timestamp()->notNull()->defaultExpression('NOW()'), | |
12 | + 'date_update' => $this->timestamp()->notNull()->defaultExpression('NOW()'), | |
13 | + 'user_id' => $this->integer(), | |
14 | + 'entity' => $this->string(), | |
15 | + 'value' => $this->integer(), | |
16 | + ]); | |
17 | + | |
18 | + $this->addForeignKey('rating_user', '{{%rating}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); | |
19 | + } | |
20 | + | |
21 | + public function down() | |
22 | + { | |
23 | + $this->dropForeignKey('rating_user', '{{%rating}}'); | |
24 | + $this->dropTable('{{%rating}}'); | |
25 | + } | |
26 | + | |
27 | +} | ... | ... |
console/migrations/m160311_132124_rating_comment_restyle.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160311_132124_rating_comment_restyle extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->truncateTable('{{%comment}}'); | |
10 | + $this->truncateTable('{{%rating}}'); | |
11 | + $this->dropColumn('{{%comment}}', 'entity'); | |
12 | + $this->dropColumn('{{%rating}}', 'entity'); | |
13 | + $this->addColumn('{{%comment}}', 'model', $this->string()->notNull()); | |
14 | + $this->addColumn('{{%comment}}', 'model_id', $this->integer()->notNull()); | |
15 | + $this->addColumn('{{%rating}}', 'model', $this->string()->notNull()); | |
16 | + $this->addColumn('{{%rating}}', 'model_id', $this->integer()->notNull()); | |
17 | + } | |
18 | + | |
19 | + public function down() | |
20 | + { | |
21 | + $this->truncateTable('{{%comment}}'); | |
22 | + $this->truncateTable('{{%rating}}'); | |
23 | + $this->dropColumn('{{%comment}}', 'model'); | |
24 | + $this->dropColumn('{{%rating}}', 'model'); | |
25 | + $this->dropColumn('{{%comment}}', 'model_id'); | |
26 | + $this->dropColumn('{{%rating}}', 'model_id'); | |
27 | + $this->addColumn('{{%comment}}', 'entity', $this->string()->notNull()); | |
28 | + $this->addColumn('{{%rating}}', 'entity', $this->string()->notNull()); | |
29 | + } | |
30 | + | |
31 | +} | ... | ... |
console/migrations/m160414_101644_add_param_to_seo_dynamic.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Handles adding the columns `param` | |
7 | + * for table `seo_dynamic`. | |
8 | + */ | |
9 | +class m160414_101644_add_param_to_seo_dynamic extends Migration | |
10 | +{ | |
11 | + /** | |
12 | + * @inheritdoc | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + $this->addColumn('seo_dynamic', 'param', $this->string()); | |
17 | + } | |
18 | + | |
19 | + /** | |
20 | + * @inheritdoc | |
21 | + */ | |
22 | + public function down() | |
23 | + { | |
24 | + $this->dropColumn('seo_dynamic', 'param'); | |
25 | + } | |
26 | +} | ... | ... |
console/migrations/m160414_214745_add_key_to_seo_dynamic.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Handles adding the columns `key` | |
7 | + * for table `seo_dynamic`. | |
8 | + */ | |
9 | +class m160414_214745_add_key_to_seo_dynamic extends Migration | |
10 | +{ | |
11 | + /** | |
12 | + * @inheritdoc | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + $this->addColumn('seo_dynamic', 'key', $this->string()); | |
17 | + } | |
18 | + | |
19 | + /** | |
20 | + * @inheritdoc | |
21 | + */ | |
22 | + public function down() | |
23 | + { | |
24 | + $this->dropColumn('seo_dynamic', 'key'); | |
25 | + } | |
26 | +} | ... | ... |
frontend/controllers/SiteController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | +use common\components\Mailer; | |
4 | 5 | use Yii; |
5 | 6 | use common\models\LoginForm; |
6 | 7 | use frontend\models\PasswordResetRequestForm; |
... | ... | @@ -91,6 +92,22 @@ class SiteController extends Controller |
91 | 92 | return $this->render('index'); |
92 | 93 | } |
93 | 94 | |
95 | + | |
96 | + public function actionMail(){ | |
97 | + $num = Yii::$app->request->post('num'); | |
98 | + $type = Yii::$app->request->post('type'); | |
99 | + | |
100 | + switch ($type) { | |
101 | + case 'call_me': | |
102 | + if(!empty($num)){ | |
103 | + return json_encode(Mailer::widget(['text' => $num, 'subject' => 'Обратный звонок'])); | |
104 | + } | |
105 | + | |
106 | + break; | |
107 | + | |
108 | + } | |
109 | + } | |
110 | + | |
94 | 111 | /** |
95 | 112 | * Logs in a user. |
96 | 113 | * | ... | ... |
frontend/views/catalog/product.php
1 | 1 | <?php |
2 | 2 | /** @var $this \yii\web\View */ |
3 | 3 | /** @var $dataProvider \yii\data\ActiveDataProvider */ |
4 | - | |
4 | +die('here1'); | |
5 | 5 | $this->title = $product->name; |
6 | 6 | foreach($product->category->getParents()->all() as $parent) { |
7 | 7 | $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]]; | ... | ... |
frontend/views/catalog/products.php
... | ... | @@ -3,14 +3,21 @@ |
3 | 3 | /** @var $productProvider \yii\data\ActiveDataProvider */ |
4 | 4 | /** @var $brandProvider \yii\data\ActiveDataProvider */ |
5 | 5 | |
6 | + | |
6 | 7 | use yii\helpers\Url; |
7 | 8 | use common\modules\product\helpers\ProductHelper; |
8 | 9 | |
10 | + | |
9 | 11 | $this->title = $category->categoryName->value; |
10 | 12 | foreach($category->getParents()->all() as $parent) { |
11 | 13 | $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]]; |
12 | 14 | } |
13 | 15 | $this->params['breadcrumbs'][] = $category->categoryName->value; |
16 | +$this->params['seo']['seo_text'] = 'TEST SEO TEXT'; | |
17 | +$this->params['seo']['h1'] = 'TEST H1'; | |
18 | +$this->params['seo']['description'] = 'TEST DESCRIPTION'; | |
19 | +$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD'; | |
20 | +$this->params['seo']['key']= 'product_list'; | |
14 | 21 | ?> |
15 | 22 | <script type="text/javascript"> |
16 | 23 | <?php if ($priceLimits['min'] < $priceLimits['max']) :?> | ... | ... |
frontend/views/event/index.php
... | ... | @@ -2,6 +2,10 @@ |
2 | 2 | use yii\widgets\ListView; |
3 | 3 | use frontend\widgets\Seo; |
4 | 4 | $this->params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']]; |
5 | +$this->params['seo']['seo_text'] = 'TEST SEO TEXT'; | |
6 | +$this->params['seo']['h1'] = 'TEST H1'; | |
7 | +$this->params['seo']['description'] = 'TEST DESCRIPTION'; | |
8 | +$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD'; | |
5 | 9 | ?> |
6 | 10 | |
7 | 11 | <?php | ... | ... |
frontend/views/event/view.php
... | ... | @@ -20,6 +20,31 @@ $this->params['name'] = $this->title; |
20 | 20 | <div class="content-last-block-text-wrap"> |
21 | 21 | <?= $model->body?> |
22 | 22 | </div> |
23 | + <?php | |
24 | + echo \common\modules\comment\widgets\CommentWidget::widget([ | |
25 | + 'context' => $this, | |
26 | + 'model' => $model->className(), | |
27 | + 'model_id' => $model->event_id, | |
28 | + 'comment_class' => \common\modules\comment\models\Comment::className(), | |
29 | + 'rating_class' => \common\modules\comment\models\Rating::className(), | |
30 | + 'class_options' => [ | |
31 | + 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, | |
32 | + 'user_id' => \Yii::$app->user->getId(), | |
33 | + 'guestComment' => true, | |
34 | + 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE, | |
35 | + ], | |
36 | + 'list_options' => [ | |
37 | + 'view' => 'list-comment-review', | |
38 | + ], | |
39 | + 'form_options' => [ | |
40 | + 'view' => 'form-comment-review', | |
41 | + 'tag' => 'span', | |
42 | + ], | |
43 | + 'options' => [ | |
44 | + 'class' => 'proektant-comments-wr style', | |
45 | + ], | |
46 | + ]); | |
47 | + ?> | |
23 | 48 | </div> |
24 | 49 | <div class="seo-text"> |
25 | 50 | <?= Seo::widget(['row'=>'seo_text'])?> | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -19,24 +19,8 @@ AppAsset::register($this); |
19 | 19 | <html lang="en"> |
20 | 20 | <head> |
21 | 21 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
22 | - <title><?= Seo::widget([ | |
23 | - 'row'=>'title', | |
24 | - 'own_attr'=>$this->title, | |
25 | - 'fields' =>[ | |
26 | - 'name' => isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : '' | |
27 | - ] | |
28 | - ])?> | |
29 | - </title> | |
30 | - <?php $this->registerMetaTag([ | |
31 | - 'name' => 'description', | |
32 | - 'content' => Seo::widget([ | |
33 | - 'row'=>'description', | |
34 | - 'own_attr'=>isset($this->params[ 'description' ]) ? $this->params[ 'description' ] : '', | |
35 | - 'fields' =>[ | |
36 | - 'name' => isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : '' | |
37 | - ] | |
38 | - ]) | |
39 | - ]); ?> | |
22 | + <title><?= Seo::widget([ 'row'=>'title'])?></title> | |
23 | + <?= Seo::widget([ 'row'=>'description'])?> | |
40 | 24 | <?php $this->head() ?> |
41 | 25 | <?//= Html::csrfMetaTags() ?> |
42 | 26 | <link href='https://fonts.googleapis.com/css?family=Ubuntu:400,300italic,300,400italic,500,500italic,700italic,700' rel='stylesheet' type='text/css'> | ... | ... |
1 | +<div class="call_me_modal_wrapper"> | |
2 | + <!-- <form name="forgot_pass_form" id="forgot_pass_form"> --> | |
3 | + <div class="modal_window"> | |
4 | + <form> | |
5 | + <div class="modal_close_btn"></div> | |
6 | + <div class="title">Перезвонить мне</div> | |
7 | + <label>Телефон:<input type="text" name="callme_head" id="phone_num_modal" placeholder="(0xx) xxx-xx-xx"></label> | |
8 | + <div class="for_btn_position"><button class="my_cust_btn" type="submit">перезвонить мне</button></div> | |
9 | + </form> | |
10 | + </div> | |
11 | + <!-- </form> --> | |
12 | +</div> | |
0 | 13 | \ No newline at end of file | ... | ... |
frontend/web/css/concat_all.css
frontend/web/js/my_scripts.js
... | ... | @@ -181,8 +181,13 @@ $(document).ready(function(){ |
181 | 181 | $(".phone_me_head").find("input").addClass("error"); |
182 | 182 | } |
183 | 183 | else{ |
184 | - callback_wrap.fadeIn(200); | |
185 | - $(".phone_me_head").find("input").val(''); | |
184 | + var num = $(".phone_me_head").find("input").val(); | |
185 | + var type = 'call_me'; | |
186 | + send_call_me_back( num,type, function(data){ | |
187 | + callback_wrap.fadeIn(200); | |
188 | + $(".phone_me_head").find("input").val(''); | |
189 | + }); | |
190 | + | |
186 | 191 | } |
187 | 192 | }); |
188 | 193 | modal_busket_header_cont.click(function(){ // скрываем модальную корзину в хедере по ссылке |
... | ... | @@ -462,4 +467,28 @@ $(document).ready(function(){ |
462 | 467 | |
463 | 468 | //=============================================== BUSKET MODAL WINDOW FUNCTIONS |
464 | 469 | |
470 | + function send_call_me_back( num, type,callback ) | |
471 | + { | |
472 | + $.ajax({ | |
473 | + url: '/site/mail', | |
474 | + data : | |
475 | + { | |
476 | + 'num' : num, | |
477 | + 'type' : type | |
478 | + }, | |
479 | + type : 'POST', | |
480 | + dataType: 'json', | |
481 | + success: function (data) | |
482 | + { | |
483 | + if(callback) | |
484 | + callback(data); | |
485 | + }, | |
486 | + error: function() | |
487 | + { | |
488 | + console.info('error'); | |
489 | + } | |
490 | + }); | |
491 | + } | |
492 | + | |
493 | + | |
465 | 494 | }); |
466 | 495 | \ No newline at end of file | ... | ... |
frontend/widgets/Seo.php
1 | 1 | <?php |
2 | 2 | namespace frontend\widgets; |
3 | -use common\models\SeoCategory; | |
4 | 3 | use common\models\SeoDynamic; |
5 | 4 | use yii\base\Widget; |
6 | 5 | use yii\helpers\Html; |
... | ... | @@ -11,9 +10,20 @@ class Seo extends Widget |
11 | 10 | public $row; |
12 | 11 | public $own_attr; |
13 | 12 | public $fields; |
13 | + public $description; | |
14 | + public $title; | |
15 | + public $seo_text; | |
16 | + public $h1; | |
17 | + public $key; | |
18 | + public $project_name; | |
19 | + const SEO_TEXT = 'seo_text'; | |
20 | + const DESCRIPTION = 'description'; | |
21 | + const H1 = 'h1'; | |
22 | + const TITLE = 'title'; | |
14 | 23 | |
15 | 24 | public function init(){ |
16 | - $this->url = $_SERVER['REQUEST_URI']; | |
25 | + $this->url = \Yii::$app->request->url; | |
26 | + $this->project_name = \Yii::$app->name; | |
17 | 27 | parent::init(); |
18 | 28 | |
19 | 29 | } |
... | ... | @@ -21,27 +31,62 @@ class Seo extends Widget |
21 | 31 | |
22 | 32 | public function run() |
23 | 33 | { |
24 | - $row = ''; | |
25 | 34 | |
35 | + $seoData = $this->getViewData(); | |
36 | + foreach($seoData as $key=>$value){ | |
37 | + $this->$key = $value; | |
38 | + } | |
26 | 39 | |
27 | - $widgetData = $this->findSeoByUrl(); | |
28 | - if($widgetData instanceof \common\models\Seo){ | |
29 | 40 | |
30 | - $row = $widgetData->{$this->row}; | |
31 | - } else{ | |
41 | + switch ($this->row) { | |
42 | + case self::SEO_TEXT: | |
43 | + return $this->selectSeoData(self::SEO_TEXT); | |
44 | + | |
45 | + break; | |
46 | + case self::H1: | |
47 | + return $this->selectSeoData(self::H1); | |
48 | + break; | |
49 | + case self::TITLE: | |
50 | + | |
51 | + $filter = \Yii::$app->request->get('filter', []); | |
52 | + if(!empty($filter)){ | |
53 | + $filter_row = ''; | |
54 | + foreach($filter as $sub_filter_name => $sub_filter_array){ | |
55 | + if($sub_filter_name=='options'){ | |
56 | + foreach($sub_filter_array as $f_name=>$f_values){ | |
57 | + $filter_row .= $f_name.':'.implode(',',$f_values).'|'; | |
58 | + } | |
59 | + } | |
60 | + | |
61 | + } | |
62 | + $this->fields['name'] = $filter_row; | |
63 | + } | |
64 | + | |
65 | + $title = $this->selectSeoData(self::TITLE); | |
32 | 66 | |
33 | - $widgetData = $this->findSeoByDynamic(); | |
34 | - if($widgetData instanceof SeoDynamic){ | |
35 | - $row = $widgetData->{$this->row}; | |
36 | - } | |
37 | - } | |
38 | - if(!empty($this->own_attr) && empty($row)) { | |
39 | 67 | |
40 | - $row = $this->own_attr; | |
41 | - } | |
42 | 68 | |
69 | + if(!empty($title)){ | |
70 | + return $title; | |
71 | + } else { | |
72 | + return $this->project_name; | |
73 | + } | |
43 | 74 | |
44 | - return $this->replaceData($row); | |
75 | + break; | |
76 | + case self::DESCRIPTION: | |
77 | + $description = $this->selectSeoData(self::DESCRIPTION); | |
78 | + | |
79 | + if(!empty($description)){ | |
80 | + | |
81 | + $this->getView()->registerMetaTag([ | |
82 | + 'name' => 'description', | |
83 | + 'content' => $description | |
84 | + ]); | |
85 | + | |
86 | + } | |
87 | + | |
88 | + break; | |
89 | + } | |
45 | 90 | |
46 | 91 | |
47 | 92 | } |
... | ... | @@ -54,6 +99,7 @@ class Seo extends Widget |
54 | 99 | $str = str_replace('{'.$field_name.'}', $field_value, $str); |
55 | 100 | } |
56 | 101 | } |
102 | + $str = str_replace('{project_name}', $this->project_name, $str); | |
57 | 103 | return Html::encode($str); |
58 | 104 | } |
59 | 105 | |
... | ... | @@ -64,6 +110,51 @@ class Seo extends Widget |
64 | 110 | |
65 | 111 | protected function findSeoByDynamic() |
66 | 112 | { |
67 | - return SeoDynamic::find()->joinWith('seoCategory')->where(['controller'=> \Yii::$app->controller->id, 'action'=>\Yii::$app->controller->action->id])->one(); | |
113 | + $query = SeoDynamic::find()->joinWith('seoCategory')->where(['controller'=> \Yii::$app->controller->id, 'action'=>\Yii::$app->controller->action->id]); | |
114 | + if(!empty($this->key)){ | |
115 | + $query->andWhere(['key'=>$this->key]); | |
116 | + } | |
117 | + return $query->one(); | |
68 | 118 | } |
119 | + | |
120 | + | |
121 | + protected function getViewData(){ | |
122 | + $params = $this->getView()->params; | |
123 | + if(isset($params['seo'])){ | |
124 | + return $params['seo']; | |
125 | + } else { | |
126 | + return []; | |
127 | + } | |
128 | + } | |
129 | + | |
130 | + protected function selectSeoData($param){ | |
131 | + $result = ''; | |
132 | + | |
133 | + $widgetData = $this->findSeoByUrl(); | |
134 | + | |
135 | + if($widgetData instanceof \common\models\Seo){ | |
136 | + | |
137 | + $result = $widgetData->$param; | |
138 | + | |
139 | + }else if(!empty($this->$param)){ | |
140 | + | |
141 | + $result = $this->$param; | |
142 | + | |
143 | + } else { | |
144 | + | |
145 | + $widgetData = $this->findSeoByDynamic(); | |
146 | + | |
147 | + if($widgetData instanceof SeoDynamic){ | |
148 | + | |
149 | + $result = $widgetData->$param; | |
150 | + | |
151 | + } | |
152 | + | |
153 | + } | |
154 | + | |
155 | + return $this->replaceData($result); | |
156 | + | |
157 | + } | |
158 | + | |
159 | + | |
69 | 160 | } |
70 | 161 | \ No newline at end of file | ... | ... |