Commit 377b29c784a9282d124eea88b84d85ec4520a4b9
1 parent
31c230f6
Yarik comment
Showing
24 changed files
with
637 additions
and
95 deletions
Show diff stats
.gitignore
common/config/main.php
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"><?= $user->name ?></div> | |
16 | +<?php | |
17 | + /* == STATUS PRO == | |
18 | + ?> | |
19 | + <div class="comments-status"><span>Pro</span></div> | |
20 | + <?php | |
21 | + */ | |
22 | +?> | |
23 | + <div class="comments-date"><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></div> | |
24 | +<?php | |
25 | + if(!empty( $model->rating )) { | |
26 | + ?> | |
27 | + <div class="rating"> | |
28 | + <!--ะพัะตะฝะบะฐ--> | |
29 | + <input type="hidden" class="val" value="<?= $model->rating->value ?>"/> | |
30 | + </div> | |
31 | + <?php | |
32 | + } | |
33 | +?> | |
34 | + <div class="comments-content"> | |
35 | + <?= $model->text ?> | |
36 | + </div> | |
37 | +<?php | |
38 | + /* == PROJECT INFO == | |
39 | + ?> | |
40 | + <div class="comments-project-link">ะัะพะตะบั: <a href="#">ะ ะตะผะพะฝั ัะฟะฐะปัะฝะธ</a></div> | |
41 | + <?php | |
42 | + */ | |
43 | +?> | |
0 | 44 | \ 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'] | ... | ... |
console/migrations/m160225_143331_comment_test.php
0 โ 100644
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 | +} | ... | ... |
console/migrations/m160304_081817_rating_table.php
0 โ 100644
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 | +} | ... | ... |
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'])?> | ... | ... |