Commit 0fa9e0f104b4e3a510226c316df365d59edfdfc0
Merge remote-tracking branch 'origin/master'
Showing
14 changed files
with
544 additions
and
371 deletions
Show diff stats
common/models/CustomerSearch.php
@@ -32,12 +32,22 @@ | @@ -32,12 +32,22 @@ | ||
32 | [ | 32 | [ |
33 | [ | 33 | [ |
34 | 'type', | 34 | 'type', |
35 | - 'rating', | ||
36 | 'online', | 35 | 'online', |
37 | ], | 36 | ], |
38 | 'integer', | 37 | 'integer', |
39 | ], | 38 | ], |
40 | [ | 39 | [ |
40 | + ['rating'], | ||
41 | + 'number', | ||
42 | + 'min' => 0, | ||
43 | + 'max' => 5, | ||
44 | + ], | ||
45 | + [ | ||
46 | + ['rating'], | ||
47 | + 'default', | ||
48 | + 'value' => 0, | ||
49 | + ], | ||
50 | + [ | ||
41 | [ | 51 | [ |
42 | 'city', | 52 | 'city', |
43 | 'info', | 53 | 'info', |
@@ -123,6 +133,10 @@ | @@ -123,6 +133,10 @@ | ||
123 | } | 133 | } |
124 | 134 | ||
125 | $query->andFilterWhere([ | 135 | $query->andFilterWhere([ |
136 | + '>=', 'user_info.rating', $this->rating, | ||
137 | + ]); | ||
138 | + | ||
139 | + $query->andFilterWhere([ | ||
126 | 'like', | 140 | 'like', |
127 | 'user_info.city', | 141 | 'user_info.city', |
128 | $this->city, | 142 | $this->city, |
common/models/User.php
@@ -578,11 +578,29 @@ | @@ -578,11 +578,29 @@ | ||
578 | } | 578 | } |
579 | } | 579 | } |
580 | 580 | ||
581 | + /** | ||
582 | + * @return ActiveQuery | ||
583 | + */ | ||
581 | public function getComments() | 584 | public function getComments() |
582 | { | 585 | { |
583 | - $entity = 'user-' . $this->id; | ||
584 | - $comments = (new Comment())->getComments($entity); | ||
585 | - return $comments; | 586 | + return $this->hasMany(Comment::className(), [ |
587 | + 'model_id' => 'id', | ||
588 | + ]) | ||
589 | + ->andWhere([ | ||
590 | + 'comment.model' => $this->className(), | ||
591 | + ]); | ||
592 | + } | ||
593 | + | ||
594 | + /** | ||
595 | + * @return ActiveQuery | ||
596 | + */ | ||
597 | + public function getCommentRating() | ||
598 | + { | ||
599 | + return $this->hasMany(Rating::className(), [ 'model_id' => 'comment_id' ]) | ||
600 | + ->via('comments') | ||
601 | + ->andWhere([ | ||
602 | + 'rating.model' => Comment::className(), | ||
603 | + ]); | ||
586 | } | 604 | } |
587 | 605 | ||
588 | public function getRatingPG() | 606 | public function getRatingPG() |
@@ -590,16 +608,21 @@ | @@ -590,16 +608,21 @@ | ||
590 | if(\Yii::$app->db->driverName != 'pgsql') { | 608 | if(\Yii::$app->db->driverName != 'pgsql') { |
591 | throw new InvalidConfigException('This method is available only in PostgreSQL'); | 609 | throw new InvalidConfigException('This method is available only in PostgreSQL'); |
592 | } | 610 | } |
593 | - $entity = 'user-' . $this->id; | ||
594 | - $rating = (new Comment())->getComments($entity) | ||
595 | - ->select('ROUND(SUM("rating"."value")/COUNT("rating"."rating_id")::float) as rating') | ||
596 | - ->leftJoin(Rating::tableName(), "CONCAT('Comment-', \"comment\".\"comment_id\") = \"rating\".\"entity\"") | ||
597 | - ->andWhere([ | ||
598 | - 'not', | ||
599 | - [ 'rating.value' => NULL ], | ||
600 | - ]) | ||
601 | - ->one(); | ||
602 | - return $rating; | 611 | + return $this->getCommentRating() |
612 | + ->select('ROUND(SUM("rating"."value")/COUNT("rating"."rating_id")::float) as rating') | ||
613 | + ->andWhere([ | ||
614 | + 'not', | ||
615 | + [ 'rating.value' => NULL ], | ||
616 | + ]) | ||
617 | + ->scalar(); | ||
618 | + } | ||
619 | + | ||
620 | + public function updateRating() | ||
621 | + { | ||
622 | + if($rating = $this->getRatingPG()) { | ||
623 | + $this->userInfo->rating = $rating; | ||
624 | + $this->userInfo->save(); | ||
625 | + } | ||
603 | } | 626 | } |
604 | 627 | ||
605 | } | 628 | } |
common/modules/comment/interfaces/CommentInterface.php
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | interface CommentInterface { | 4 | interface CommentInterface { |
5 | public function load($data, $formName = null); | 5 | public function load($data, $formName = null); |
6 | public function formName(); | 6 | public function formName(); |
7 | - public function getComments($entity); | 7 | + public function getComments($model, $model_id); |
8 | public function postComment(); | 8 | public function postComment(); |
9 | public function deleteComment(); | 9 | public function deleteComment(); |
10 | public function updateComment(); | 10 | public function updateComment(); |
common/modules/comment/models/Comment.php
@@ -7,6 +7,17 @@ | @@ -7,6 +7,17 @@ | ||
7 | * Class Comment | 7 | * Class Comment |
8 | * @property bool $guestComment | 8 | * @property bool $guestComment |
9 | * @property integer $comment_id | 9 | * @property integer $comment_id |
10 | + * @property string $text | ||
11 | + * @property int $user_id | ||
12 | + * @property string $user_name | ||
13 | + * @property string $user_email | ||
14 | + * @property int $comment_pid | ||
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 | ||
10 | * @package common\modules\comment\models | 21 | * @package common\modules\comment\models |
11 | */ | 22 | */ |
12 | class Comment extends \yii\db\ActiveRecord | 23 | class Comment extends \yii\db\ActiveRecord |
@@ -21,8 +32,6 @@ | @@ -21,8 +32,6 @@ | ||
21 | const SCENARIO_USER = 'user'; | 32 | const SCENARIO_USER = 'user'; |
22 | const SCENARIO_GUEST = 'guest'; | 33 | const SCENARIO_GUEST = 'guest'; |
23 | 34 | ||
24 | - public $rating; | ||
25 | - | ||
26 | /** | 35 | /** |
27 | * @var bool | 36 | * @var bool |
28 | */ | 37 | */ |
@@ -70,7 +79,8 @@ | @@ -70,7 +79,8 @@ | ||
70 | 'exist', | 79 | 'exist', |
71 | 'targetAttribute' => 'comment_id', | 80 | 'targetAttribute' => 'comment_id', |
72 | 'filter' => [ | 81 | 'filter' => [ |
73 | - 'entity' => $this->entity, | 82 | + 'model' => $this->model, |
83 | + 'model_id' => $this->model_id, | ||
74 | ], | 84 | ], |
75 | ], | 85 | ], |
76 | ]; | 86 | ]; |
@@ -135,16 +145,18 @@ | @@ -135,16 +145,18 @@ | ||
135 | } | 145 | } |
136 | 146 | ||
137 | /** | 147 | /** |
138 | - * @param string $entity | 148 | + * @param string $model |
149 | + * @param integer $model_id | ||
139 | * | 150 | * |
140 | * @return ActiveQuery | 151 | * @return ActiveQuery |
141 | */ | 152 | */ |
142 | - public function getComments($entity) | 153 | + public function getComments($model, $model_id) |
143 | { | 154 | { |
144 | return $this->find() | 155 | return $this->find() |
145 | ->where([ | 156 | ->where([ |
146 | - 'comment.entity' => $entity, | ||
147 | - 'comment.status' => 1, | 157 | + 'comment.model' => $model, |
158 | + 'comment.model_id' => $model_id, | ||
159 | + 'comment.status' => 1, | ||
148 | ]); | 160 | ]); |
149 | } | 161 | } |
150 | 162 | ||
@@ -212,7 +224,10 @@ | @@ -212,7 +224,10 @@ | ||
212 | if($this->getGuestComment()) { | 224 | if($this->getGuestComment()) { |
213 | return true; | 225 | return true; |
214 | } else { | 226 | } else { |
215 | - return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [ 'entity' => $this->entity ]); | 227 | + return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [ |
228 | + 'model' => $this->model, | ||
229 | + 'model_id' => $this->model_id, | ||
230 | + ]); | ||
216 | } | 231 | } |
217 | } | 232 | } |
218 | 233 | ||
@@ -221,7 +236,13 @@ | @@ -221,7 +236,13 @@ | ||
221 | if($this->scenario == self::SCENARIO_GUEST) { | 236 | if($this->scenario == self::SCENARIO_GUEST) { |
222 | return false; | 237 | return false; |
223 | } else { | 238 | } else { |
224 | - return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [ 'entity' => $this->entity ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [ 'entity' => $this->entity ]); | 239 | + return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [ |
240 | + 'model' => $this->model, | ||
241 | + 'model_id' => $this->model_id, | ||
242 | + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [ | ||
243 | + 'model' => $this->model, | ||
244 | + 'model_id' => $this->model_id, | ||
245 | + ]); | ||
225 | } | 246 | } |
226 | } | 247 | } |
227 | 248 | ||
@@ -230,7 +251,13 @@ | @@ -230,7 +251,13 @@ | ||
230 | if($this->scenario == self::SCENARIO_GUEST) { | 251 | if($this->scenario == self::SCENARIO_GUEST) { |
231 | return false; | 252 | return false; |
232 | } else { | 253 | } else { |
233 | - return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [ 'entity' => $this->entity ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [ 'entity' => $this->entity ]); | 254 | + return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [ |
255 | + 'model' => $this->model, | ||
256 | + 'model_id' => $this->model_id, | ||
257 | + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [ | ||
258 | + 'model' => $this->model, | ||
259 | + 'model_id' => $this->model_id, | ||
260 | + ]); | ||
234 | } | 261 | } |
235 | } | 262 | } |
236 | 263 | ||
@@ -260,12 +287,18 @@ | @@ -260,12 +287,18 @@ | ||
260 | 287 | ||
261 | public function checkRating() | 288 | public function checkRating() |
262 | { | 289 | { |
263 | - $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [ 'entity' => 'entityId' ]) | 290 | + $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [ |
291 | + 'model_id' => 'comment_id', | ||
292 | + ]) | ||
293 | + ->andWhere([ | ||
294 | + 'model' => $this->className(), | ||
295 | + ]) | ||
264 | ->one(); | 296 | ->one(); |
265 | if(!$rating instanceof \common\modules\comment\models\Rating) { | 297 | if(!$rating instanceof \common\modules\comment\models\Rating) { |
266 | $rating = new \common\modules\comment\models\Rating([ | 298 | $rating = new \common\modules\comment\models\Rating([ |
267 | - 'entity' => $this->entityId, | ||
268 | - 'user_id' => $this->user_id, | 299 | + 'model' => $this->className(), |
300 | + 'model_id' => $this->comment_id, | ||
301 | + 'user_id' => $this->user_id, | ||
269 | ]); | 302 | ]); |
270 | $rating->save(); | 303 | $rating->save(); |
271 | } | 304 | } |
@@ -274,12 +307,18 @@ | @@ -274,12 +307,18 @@ | ||
274 | public function getRating() | 307 | public function getRating() |
275 | { | 308 | { |
276 | $this->checkRating(); | 309 | $this->checkRating(); |
277 | - return $this->hasOne(\common\modules\comment\models\Rating::className(), [ 'entity' => 'entityId' ]); | 310 | + return $this->hasOne(\common\modules\comment\models\Rating::className(), [ |
311 | + 'model_id' => 'comment_id', | ||
312 | + ]) | ||
313 | + ->andWhere([ 'model' => $this->className() ]); | ||
278 | } | 314 | } |
279 | 315 | ||
280 | public function hasRating($return = true) | 316 | public function hasRating($return = true) |
281 | { | 317 | { |
282 | - $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [ 'entity' => 'entityId' ]) | 318 | + $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [ |
319 | + 'model_id' => 'comment_id', | ||
320 | + ]) | ||
321 | + ->andWhere([ 'model' => $this->className() ]) | ||
283 | ->andWhere([ | 322 | ->andWhere([ |
284 | 'not', | 323 | 'not', |
285 | [ 'value' => NULL ], | 324 | [ 'value' => NULL ], |
@@ -292,8 +331,4 @@ | @@ -292,8 +331,4 @@ | ||
292 | } | 331 | } |
293 | } | 332 | } |
294 | 333 | ||
295 | - public function getEntityId() | ||
296 | - { | ||
297 | - return $this->formName() . '-' . $this->getPrimaryKey(); | ||
298 | - } | ||
299 | } | 334 | } |
common/modules/comment/models/Rating.php
@@ -11,13 +11,16 @@ use Yii; | @@ -11,13 +11,16 @@ use Yii; | ||
11 | * @property string $date_add | 11 | * @property string $date_add |
12 | * @property string $date_update | 12 | * @property string $date_update |
13 | * @property integer $user_id | 13 | * @property integer $user_id |
14 | - * @property string $entity | ||
15 | * @property integer $value | 14 | * @property integer $value |
15 | + * @property string $model | ||
16 | + * @property integer $model_id | ||
16 | * | 17 | * |
17 | * @property \common\models\User $user | 18 | * @property \common\models\User $user |
18 | */ | 19 | */ |
19 | class Rating extends \yii\db\ActiveRecord | 20 | class Rating extends \yii\db\ActiveRecord |
20 | { | 21 | { |
22 | + | ||
23 | + public $rating; | ||
21 | /** | 24 | /** |
22 | * @inheritdoc | 25 | * @inheritdoc |
23 | */ | 26 | */ |
common/modules/comment/widgets/CommentWidget.php
@@ -86,9 +86,14 @@ | @@ -86,9 +86,14 @@ | ||
86 | public $success_text = 'Comment successfully added'; | 86 | public $success_text = 'Comment successfully added'; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | - * @var string Entity, to which comments attached | 89 | + * @var string $model Model, to which comments attached |
90 | */ | 90 | */ |
91 | - public $entity; | 91 | + public $model; |
92 | + | ||
93 | + /** | ||
94 | + * @var integer $model_id Model id, to which comments attached | ||
95 | + */ | ||
96 | + public $model_id; | ||
92 | 97 | ||
93 | /** | 98 | /** |
94 | * @var string Template of the widget. You may use <code>{success}, {form}, {list}</code> | 99 | * @var string Template of the widget. You may use <code>{success}, {form}, {list}</code> |
@@ -123,7 +128,8 @@ | @@ -123,7 +128,8 @@ | ||
123 | } elseif(!empty( $this->rating_class )) { | 128 | } elseif(!empty( $this->rating_class )) { |
124 | throw new \yii\base\InvalidConfigException(__CLASS__ . '->rating_class must be defined as object full class name string.'); | 129 | throw new \yii\base\InvalidConfigException(__CLASS__ . '->rating_class must be defined as object full class name string.'); |
125 | } | 130 | } |
126 | - $this->comment_class->entity = $this->entity; | 131 | + $this->comment_class->model = $this->model; |
132 | + $this->comment_class->model_id = $this->model_id; | ||
127 | $this->createDataProvider(); | 133 | $this->createDataProvider(); |
128 | $this->process(); | 134 | $this->process(); |
129 | ob_start(); | 135 | ob_start(); |
@@ -171,7 +177,7 @@ | @@ -171,7 +177,7 @@ | ||
171 | public function createDataProvider() | 177 | public function createDataProvider() |
172 | { | 178 | { |
173 | $this->dataProvider = new \yii\data\ActiveDataProvider([ | 179 | $this->dataProvider = new \yii\data\ActiveDataProvider([ |
174 | - 'query' => $this->comment_class->getComments($this->entity), | 180 | + 'query' => $this->comment_class->getComments($this->model, $this->model_id), |
175 | 'pagination' => [ | 181 | 'pagination' => [ |
176 | 'pageSize' => 10, | 182 | 'pageSize' => 10, |
177 | ], | 183 | ], |
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/m160311_151257_user_project_rating.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +class m160311_151257_user_project_rating extends Migration | ||
6 | +{ | ||
7 | + public function up() | ||
8 | + { | ||
9 | + $this->addColumn('{{%user_info}}', 'rating', $this->float()->defaultValue(0)); | ||
10 | + $this->addColumn('{{%project}}', 'rating', $this->float()->defaultValue(0)); | ||
11 | + } | ||
12 | + | ||
13 | + public function down() | ||
14 | + { | ||
15 | + $this->dropColumn('{{%user_info}}', 'rating'); | ||
16 | + $this->dropColumn('{{%project}}', 'rating'); | ||
17 | + } | ||
18 | + | ||
19 | +} |
frontend/controllers/SearchController.php
1 | <?php | 1 | <?php |
2 | -namespace frontend\controllers; | ||
3 | - | ||
4 | -use common\models\CustomerSearch; | ||
5 | -use common\models\Project; | ||
6 | -use common\models\UserInfo; | ||
7 | -use common\models\Vacancy; | ||
8 | -use Yii; | ||
9 | -use common\models\LoginForm; | ||
10 | -use frontend\models\PasswordResetRequestForm; | ||
11 | -use frontend\models\ResetPasswordForm; | ||
12 | -use frontend\models\SignupForm; | ||
13 | -use frontend\models\ContactForm; | ||
14 | -use frontend\models\Options; | ||
15 | -use frontend\models\OptionValues; | ||
16 | -use yii\base\InvalidParamException; | ||
17 | -use yii\data\ActiveDataProvider; | ||
18 | -use yii\data\Pagination; | ||
19 | -use yii\web\BadRequestHttpException; | ||
20 | -use yii\web\Controller; | ||
21 | -use yii\filters\VerbFilter; | ||
22 | -use yii\filters\AccessControl; | ||
23 | -use frontend\models\OptionsToValues; | ||
24 | -use yii\validators\EmailValidator; | ||
25 | -use common\models\User; | ||
26 | -use yii\helpers\VarDumper; | ||
27 | -use common\models\Page; | ||
28 | -use frontend\models\Option; | ||
29 | -use common\models\Social; | ||
30 | - | ||
31 | - | ||
32 | -/** | ||
33 | - * Site controller | ||
34 | - */ | ||
35 | -class SearchController extends Controller | ||
36 | -{ | ||
37 | - public $defaultAction = 'common'; | 2 | + namespace frontend\controllers; |
3 | + | ||
4 | + use common\models\CustomerSearch; | ||
5 | + use common\models\Project; | ||
6 | + use common\models\UserInfo; | ||
7 | + use common\models\Vacancy; | ||
8 | + use Yii; | ||
9 | + use common\models\LoginForm; | ||
10 | + use frontend\models\PasswordResetRequestForm; | ||
11 | + use frontend\models\ResetPasswordForm; | ||
12 | + use frontend\models\SignupForm; | ||
13 | + use frontend\models\ContactForm; | ||
14 | + use frontend\models\Options; | ||
15 | + use frontend\models\OptionValues; | ||
16 | + use yii\base\InvalidParamException; | ||
17 | + use yii\data\ActiveDataProvider; | ||
18 | + use yii\data\Pagination; | ||
19 | + use yii\web\BadRequestHttpException; | ||
20 | + use yii\web\Controller; | ||
21 | + use yii\filters\VerbFilter; | ||
22 | + use yii\filters\AccessControl; | ||
23 | + use frontend\models\OptionsToValues; | ||
24 | + use yii\validators\EmailValidator; | ||
25 | + use common\models\User; | ||
26 | + use yii\helpers\VarDumper; | ||
27 | + use common\models\Page; | ||
28 | + use frontend\models\Option; | ||
29 | + use common\models\Social; | ||
38 | 30 | ||
39 | /** | 31 | /** |
40 | - * @inheritdoc | 32 | + * Site controller |
41 | */ | 33 | */ |
42 | - public function actions() | ||
43 | - { | ||
44 | - return [ | ||
45 | - 'error' => [ | ||
46 | - 'class' => 'yii\web\ErrorAction', | ||
47 | - ], | ||
48 | - 'captcha' => [ | ||
49 | - 'class' => 'yii\captcha\CaptchaAction', | ||
50 | - 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, | ||
51 | - ], | ||
52 | - ]; | ||
53 | - } | ||
54 | - | ||
55 | - public function actionProject() | 34 | + class SearchController extends Controller |
56 | { | 35 | { |
57 | 36 | ||
58 | - $projects = new ActiveDataProvider([ | ||
59 | - 'query' => Project::find(), | ||
60 | - 'pagination' => [ | ||
61 | - 'pageSize' => 9, | ||
62 | - ], | ||
63 | - ]); | ||
64 | - | ||
65 | - return $this->render('project',[ | ||
66 | - 'projects' => $projects | ||
67 | - ]); | ||
68 | - } | 37 | + public $defaultAction = 'common'; |
69 | 38 | ||
70 | - | ||
71 | - public function actionCustomer(){ | ||
72 | - $model = new CustomerSearch(); | ||
73 | - $dataProvider = $model->search(Yii::$app->request->queryParams); | ||
74 | - $dataProvider->setPagination([ | ||
75 | - 'pageSize' => 5 | ||
76 | - ]); | ||
77 | - $dataProvider->setSort([ | ||
78 | - 'attributes' => [ | ||
79 | - 'name' => [ | ||
80 | - 'asc' => [ | ||
81 | - 'company_info.name' => SORT_ASC, | ||
82 | - 'firstname' => SORT_ASC, | ||
83 | - 'lastname' => SORT_ASC, | ||
84 | - ], | ||
85 | - 'desc' => [ | ||
86 | - 'company_info.name' => SORT_DESC, | ||
87 | - 'firstname' => SORT_DESC, | ||
88 | - 'lastname' => SORT_DESC, | ||
89 | - ], | ||
90 | - 'default' => SORT_ASC, | ||
91 | - 'label' => 'Название', | 39 | + /** |
40 | + * @inheritdoc | ||
41 | + */ | ||
42 | + public function actions() | ||
43 | + { | ||
44 | + return [ | ||
45 | + 'error' => [ | ||
46 | + 'class' => 'yii\web\ErrorAction', | ||
92 | ], | 47 | ], |
93 | - 'staff' => [ | ||
94 | - 'asc' => [ | ||
95 | - 'company_info.staff' => SORT_ASC, | ||
96 | - ], | ||
97 | - 'desc' => [ | ||
98 | - 'company_info.staff' => SORT_DESC, | ||
99 | - ], | ||
100 | - 'default' => SORT_DESC, | ||
101 | - 'label' => 'Количество сотрудников', | 48 | + 'captcha' => [ |
49 | + 'class' => 'yii\captcha\CaptchaAction', | ||
50 | + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : NULL, | ||
51 | + ], | ||
52 | + ]; | ||
53 | + } | ||
54 | + | ||
55 | + public function actionProject() | ||
56 | + { | ||
57 | + $projects = new ActiveDataProvider([ | ||
58 | + 'query' => Project::find(), | ||
59 | + 'pagination' => [ | ||
60 | + 'pageSize' => 9, | ||
61 | + ], | ||
62 | + ]); | ||
63 | + return $this->render('project', [ | ||
64 | + 'projects' => $projects, | ||
65 | + ]); | ||
66 | + } | ||
67 | + | ||
68 | + public function actionCustomer() | ||
69 | + { | ||
70 | + $model = new CustomerSearch(); | ||
71 | + $dataProvider = $model->search(Yii::$app->request->queryParams); | ||
72 | + $dataProvider->setPagination([ | ||
73 | + 'pageSize' => 5, | ||
74 | + ]); | ||
75 | + $dataProvider->setSort([ | ||
76 | + 'defaultOrder' => [ | ||
77 | + 'name' => SORT_ASC, | ||
102 | ], | 78 | ], |
103 | - 'visit' => [ | ||
104 | - 'asc' => [ | ||
105 | - 'user_info.date_visit' => SORT_ASC, | 79 | + 'attributes' => [ |
80 | + 'name' => [ | ||
81 | + 'asc' => [ | ||
82 | + 'company_info.name' => SORT_ASC, | ||
83 | + 'firstname' => SORT_ASC, | ||
84 | + 'lastname' => SORT_ASC, | ||
85 | + ], | ||
86 | + 'desc' => [ | ||
87 | + 'company_info.name' => SORT_DESC, | ||
88 | + 'firstname' => SORT_DESC, | ||
89 | + 'lastname' => SORT_DESC, | ||
90 | + ], | ||
91 | + 'default' => SORT_ASC, | ||
92 | + 'label' => 'Название', | ||
106 | ], | 93 | ], |
107 | - 'desc' => [ | ||
108 | - 'user_info.date_visit' => SORT_DESC, | 94 | + 'staff' => [ |
95 | + 'asc' => [ | ||
96 | + 'company_info.staff' => SORT_ASC, | ||
97 | + ], | ||
98 | + 'desc' => [ | ||
99 | + 'company_info.staff' => SORT_DESC, | ||
100 | + ], | ||
101 | + 'default' => SORT_DESC, | ||
102 | + 'label' => 'Количество сотрудников', | ||
109 | ], | 103 | ], |
110 | - 'default' => SORT_DESC, | ||
111 | - 'label' => 'Последний визит', | ||
112 | - ], | ||
113 | - 'city' => [ | ||
114 | - 'asc' => [ | ||
115 | - 'user_info.city' => SORT_ASC, | 104 | + 'visit' => [ |
105 | + 'asc' => [ | ||
106 | + 'user_info.date_visit' => SORT_ASC, | ||
107 | + ], | ||
108 | + 'desc' => [ | ||
109 | + 'user_info.date_visit' => SORT_DESC, | ||
110 | + ], | ||
111 | + 'default' => SORT_DESC, | ||
112 | + 'label' => 'Последний визит', | ||
116 | ], | 113 | ], |
117 | - 'desc' => [ | ||
118 | - 'user_info.city' => SORT_DESC, | 114 | + 'city' => [ |
115 | + 'asc' => [ | ||
116 | + 'user_info.city' => SORT_ASC, | ||
117 | + ], | ||
118 | + 'desc' => [ | ||
119 | + 'user_info.city' => SORT_DESC, | ||
120 | + ], | ||
121 | + 'default' => SORT_ASC, | ||
122 | + 'label' => 'Город', | ||
119 | ], | 123 | ], |
120 | - 'default' => SORT_ASC, | ||
121 | - 'label' => 'Город', | ||
122 | ], | 124 | ], |
123 | - ], | ||
124 | - ]); | ||
125 | - $model->load(Yii::$app->request->queryParams); | ||
126 | - $cities = UserInfo::find()->select('city')->distinct()->asArray()->indexBy('city')->column(); | ||
127 | - return $this->render('customer',[ | ||
128 | - 'model' => $model, | ||
129 | - 'dataProvider' => $dataProvider, | ||
130 | - 'cities' => $cities, | ||
131 | - ]); | ||
132 | - } | ||
133 | - | ||
134 | - public function actionCompany() | ||
135 | - { | ||
136 | - $query = UserInfo::find() | ||
137 | - ->joinWith([ 'user' ]) | ||
138 | - ->where(['is_customer' => 1,'user.type'=>2]); | ||
139 | - | ||
140 | - $companies = new ActiveDataProvider([ | ||
141 | - 'query' => $query, | ||
142 | - 'pagination' => [ | ||
143 | - 'pageSize' => 3, | ||
144 | - ], | ||
145 | - ]); | ||
146 | - | ||
147 | - return $this->render('company',[ | ||
148 | - 'companies' => $companies | ||
149 | - ]); | ||
150 | - } | ||
151 | - | ||
152 | - public function actionPerformer() | ||
153 | - { | ||
154 | - $query = UserInfo::find() | ||
155 | - ->joinWith([ 'user' ]) | ||
156 | - ->where(['is_customer' => 1,'user.type'=>1]); | ||
157 | - | ||
158 | - | ||
159 | - $performer = new ActiveDataProvider([ | ||
160 | - 'query' => $query, | ||
161 | - 'pagination' => [ | ||
162 | - 'pageSize' => 3, | ||
163 | - ], | ||
164 | - ]); | ||
165 | - | ||
166 | - return $this->render('performer',[ | ||
167 | - 'performer' => $performer | ||
168 | - ]); | ||
169 | - } | ||
170 | - | ||
171 | - public function actionVacancy() | ||
172 | - { | ||
173 | - | 125 | + ]); |
126 | + $model->load(Yii::$app->request->queryParams); | ||
127 | + $cities = UserInfo::find() | ||
128 | + ->select('city') | ||
129 | + ->distinct() | ||
130 | + ->asArray() | ||
131 | + ->indexBy('city') | ||
132 | + ->column(); | ||
133 | + return $this->render('customer', [ | ||
134 | + 'model' => $model, | ||
135 | + 'dataProvider' => $dataProvider, | ||
136 | + 'cities' => $cities, | ||
137 | + ]); | ||
138 | + } | ||
139 | + | ||
140 | + public function actionCompany() | ||
141 | + { | ||
142 | + $query = UserInfo::find() | ||
143 | + ->joinWith([ 'user' ]) | ||
144 | + ->where([ | ||
145 | + 'is_customer' => 1, | ||
146 | + 'user.type' => 2, | ||
147 | + ]); | ||
148 | + | ||
149 | + $companies = new ActiveDataProvider([ | ||
150 | + 'query' => $query, | ||
151 | + 'pagination' => [ | ||
152 | + 'pageSize' => 3, | ||
153 | + ], | ||
154 | + ]); | ||
155 | + | ||
156 | + return $this->render('company', [ | ||
157 | + 'companies' => $companies, | ||
158 | + ]); | ||
159 | + } | ||
160 | + | ||
161 | + public function actionPerformer() | ||
162 | + { | ||
163 | + $query = UserInfo::find() | ||
164 | + ->joinWith([ 'user' ]) | ||
165 | + ->where([ | ||
166 | + 'is_customer' => 1, | ||
167 | + 'user.type' => 1, | ||
168 | + ]); | ||
169 | + | ||
170 | + $performer = new ActiveDataProvider([ | ||
171 | + 'query' => $query, | ||
172 | + 'pagination' => [ | ||
173 | + 'pageSize' => 3, | ||
174 | + ], | ||
175 | + ]); | ||
174 | 176 | ||
175 | - $query = Vacancy::find(); | 177 | + return $this->render('performer', [ |
178 | + 'performer' => $performer, | ||
179 | + ]); | ||
180 | + } | ||
176 | 181 | ||
177 | - $countQuery = clone $query; | 182 | + public function actionVacancy() |
183 | + { | ||
178 | 184 | ||
179 | - $pagination = new Pagination(['totalCount' => $countQuery->count(), | ||
180 | - 'pageSize' => 15, | ||
181 | - ]); | 185 | + $query = Vacancy::find(); |
182 | 186 | ||
183 | - $vacancy = $query->offset($pagination->offset) | ||
184 | - ->limit($pagination->limit); | 187 | + $countQuery = clone $query; |
185 | 188 | ||
189 | + $pagination = new Pagination([ | ||
190 | + 'totalCount' => $countQuery->count(), | ||
191 | + 'pageSize' => 15, | ||
192 | + ]); | ||
186 | 193 | ||
187 | - $provider = new ActiveDataProvider([ | ||
188 | - 'query' => $vacancy, | ||
189 | - 'pagination' => false, | ||
190 | - 'sort' => [ | ||
191 | - 'defaultOrder' => [ | ||
192 | - 'date_add' => SORT_DESC, | ||
193 | - 'name' => SORT_ASC, | ||
194 | - ] | ||
195 | - ], | ||
196 | - ]); | 194 | + $vacancy = $query->offset($pagination->offset) |
195 | + ->limit($pagination->limit); | ||
197 | 196 | ||
197 | + $provider = new ActiveDataProvider([ | ||
198 | + 'query' => $vacancy, | ||
199 | + 'pagination' => false, | ||
200 | + 'sort' => [ | ||
201 | + 'defaultOrder' => [ | ||
202 | + 'date_add' => SORT_DESC, | ||
203 | + 'name' => SORT_ASC, | ||
204 | + ], | ||
205 | + ], | ||
206 | + ]); | ||
198 | 207 | ||
208 | + return $this->render('vacancy', [ | ||
209 | + 'provider' => $provider, | ||
210 | + 'pagination' => $pagination, | ||
211 | + ]); | ||
212 | + } | ||
199 | 213 | ||
200 | - return $this->render('vacancy',[ | ||
201 | - 'provider' => $provider, | ||
202 | - 'pagination' => $pagination | ||
203 | - ]); | ||
204 | } | 214 | } |
205 | - | ||
206 | -} |
frontend/views/performer/portfolio-view.php
@@ -114,21 +114,22 @@ | @@ -114,21 +114,22 @@ | ||
114 | <?php | 114 | <?php |
115 | echo \common\modules\comment\widgets\CommentWidget::widget([ | 115 | echo \common\modules\comment\widgets\CommentWidget::widget([ |
116 | 'context' => $this, | 116 | 'context' => $this, |
117 | - 'entity' => $portfolio::tableName() . '-' . $portfolio->portfolio_id, | 117 | + 'model' => $portfolio::className(), |
118 | + 'model_id' => $portfolio->portfolio_id, | ||
118 | 'comment_class' => \common\modules\comment\models\Comment::className(), | 119 | 'comment_class' => \common\modules\comment\models\Comment::className(), |
119 | - 'rating_class' => \common\modules\comment\models\Rating::className(), | 120 | + 'rating_class' => \common\modules\comment\models\Rating::className(), |
120 | 'class_options' => [ | 121 | 'class_options' => [ |
121 | - 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, | ||
122 | - 'user_id' => \Yii::$app->user->getId(), | 122 | + 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, |
123 | + 'user_id' => \Yii::$app->user->getId(), | ||
123 | 'guestComment' => true, | 124 | 'guestComment' => true, |
124 | - 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE, | 125 | + 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE, |
125 | ], | 126 | ], |
126 | 'list_options' => [ | 127 | 'list_options' => [ |
127 | 'view' => 'list-comment', | 128 | 'view' => 'list-comment', |
128 | ], | 129 | ], |
129 | 'form_options' => [ | 130 | 'form_options' => [ |
130 | - 'view' => 'form-comment', | ||
131 | - 'tag' => 'div', | 131 | + 'view' => 'form-comment', |
132 | + 'tag' => 'div', | ||
132 | 'class' => 'artbox_comment_form', | 133 | 'class' => 'artbox_comment_form', |
133 | ], | 134 | ], |
134 | 'options' => [ | 135 | 'options' => [ |
frontend/views/search/_customer_list_view.php
@@ -26,13 +26,12 @@ | @@ -26,13 +26,12 @@ | ||
26 | <div class="rating_search_performer"> | 26 | <div class="rating_search_performer"> |
27 | <!--оценка--> | 27 | <!--оценка--> |
28 | <?php | 28 | <?php |
29 | - if($rating = $model->getRatingPG()->rating) { | 29 | + if($rating = $model->userInfo->rating) { |
30 | echo "<input type='hidden' class='val' value='{$rating}'/>"; | 30 | echo "<input type='hidden' class='val' value='{$rating}'/>"; |
31 | } else { | 31 | } else { |
32 | echo "<input type='hidden' class='val' value='0'/>"; | 32 | echo "<input type='hidden' class='val' value='0'/>"; |
33 | } | 33 | } |
34 | ?> | 34 | ?> |
35 | - <input type="hidden" class="val" value="4"/> | ||
36 | </div> | 35 | </div> |
37 | <div class="search_perform-stars-txt"> | 36 | <div class="search_perform-stars-txt"> |
38 | <?= $model->getComments()->count() ?> отзывов | 37 | <?= $model->getComments()->count() ?> отзывов |
@@ -53,7 +52,7 @@ | @@ -53,7 +52,7 @@ | ||
53 | } | 52 | } |
54 | ?> | 53 | ?> |
55 | <div class="search_perform_visit"> | 54 | <div class="search_perform_visit"> |
56 | - <span>Послелний визит:</span> <?= \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit) ?> | 55 | + <span>Последний визит:</span> <?= \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit) ?> |
57 | </div> | 56 | </div> |
58 | <div class="search_perform_projets_nam"> | 57 | <div class="search_perform_projets_nam"> |
59 | <?= Html::a("Заказано проектов {$model->getProjects()->count()}", ['search/project', (new Project())->formName().'[user_id]' => $model->id]) ?> | 58 | <?= Html::a("Заказано проектов {$model->getProjects()->count()}", ['search/project', (new Project())->formName().'[user_id]' => $model->id]) ?> |
frontend/views/search/customer.php
@@ -7,20 +7,29 @@ | @@ -7,20 +7,29 @@ | ||
7 | use common\models\CustomerSearch; | 7 | use common\models\CustomerSearch; |
8 | use yii\data\ActiveDataProvider; | 8 | use yii\data\ActiveDataProvider; |
9 | use yii\helpers\Html; | 9 | use yii\helpers\Html; |
10 | + use yii\jui\SliderInput; | ||
10 | use yii\widgets\ActiveForm; | 11 | use yii\widgets\ActiveForm; |
11 | use yii\widgets\LinkSorter; | 12 | use yii\widgets\LinkSorter; |
12 | use yii\widgets\ListView; | 13 | use yii\widgets\ListView; |
13 | 14 | ||
15 | + $sort_array = $dataProvider->sort->getAttributeOrders(); | ||
16 | + $active_key = array_keys($sort_array)[ 0 ]; | ||
17 | + $active_value = $sort_array[ $active_key ]; | ||
18 | + $sort_name = ( ( $active_value == 4 ) ? '-' : '' ) . $active_key; | ||
14 | ?> | 19 | ?> |
15 | <div class="section-box-22 section-box-customer"> | 20 | <div class="section-box-22 section-box-customer"> |
16 | <div class="box-wr"> | 21 | <div class="box-wr"> |
17 | <div class="box-all"> | 22 | <div class="box-all"> |
18 | <?php | 23 | <?php |
19 | - // == Left filter == | 24 | + // == Left filter == |
20 | ?> | 25 | ?> |
21 | <div class="left-search-work"> | 26 | <div class="left-search-work"> |
22 | <?php | 27 | <?php |
23 | - $form = ActiveForm::begin(['method' => 'get', 'options' => [ 'class' => 'search-work-form' ], 'action' => [''] ]); | 28 | + $form = ActiveForm::begin([ |
29 | + 'method' => 'get', | ||
30 | + 'options' => [ 'class' => 'search-work-form' ], | ||
31 | + 'action' => [ '' ], | ||
32 | + ]); | ||
24 | 33 | ||
25 | echo $form->field($model, 'city', [ | 34 | echo $form->field($model, 'city', [ |
26 | 'options' => [ | 35 | 'options' => [ |
@@ -41,20 +50,31 @@ | @@ -41,20 +50,31 @@ | ||
41 | 2 => 'Компания', | 50 | 2 => 'Компания', |
42 | ], [ 'prompt' => 'Любой' ]); | 51 | ], [ 'prompt' => 'Любой' ]); |
43 | ?> | 52 | ?> |
53 | + <div class="blocks-check-list-wrapp"> | ||
54 | + <div id="slider-value"></div> | ||
55 | + <?php | ||
56 | + echo $form->field($model, 'rating', [ | ||
57 | + 'template' => "{label}<br><div id='{$form->id}-rating'>{$model->rating}</div><br>{input}\n{hint}\n{error}", | ||
58 | + 'labelOptions' => [ | ||
59 | + 'class' => 'blocks-check-title', | ||
60 | + ], | ||
61 | + ]) | ||
62 | + ->widget(SliderInput::className(), [ | ||
63 | + 'clientOptions' => [ | ||
64 | + 'min' => 0, | ||
65 | + 'max' => 5, | ||
66 | + 'step' => 0.5, | ||
67 | + ], | ||
68 | + 'clientEvents' => [ | ||
69 | + 'slide' => "function( event, ui ) { | ||
70 | + $( '#{$form->id}-rating' ).text(ui.value); | ||
71 | + $('input[name=\"{$model->formName()}[rating]\"]').val(ui.value); | ||
44 | 72 | ||
45 | - <?php | ||
46 | - /* Рейтинг | ||
47 | - ?> | ||
48 | - <div class="blocks-check-list-wrapp"> | ||
49 | - <div class="blocks-check-title">Рейтинг</div> | ||
50 | - <div class="rating"> | ||
51 | - <!--оценка--> | ||
52 | - <input type="hidden" class="val" value="0"> | ||
53 | - </div> | ||
54 | - </div> | ||
55 | - <?php | ||
56 | - */ | ||
57 | - ?> | 73 | + }", |
74 | + ], | ||
75 | + ]); | ||
76 | + ?> | ||
77 | + </div> | ||
58 | 78 | ||
59 | <?php | 79 | <?php |
60 | echo $form->field($model, 'online', [ | 80 | echo $form->field($model, 'online', [ |
@@ -68,31 +88,31 @@ | @@ -68,31 +88,31 @@ | ||
68 | 1 => 'Онлайн', | 88 | 1 => 'Онлайн', |
69 | ], [ | 89 | ], [ |
70 | 'item' => function($index, $label, $name, $checked, $value) use ($model) { | 90 | 'item' => function($index, $label, $name, $checked, $value) use ($model) { |
71 | - $checked = ($model->online == $value); | ||
72 | - return "<div class='blocks-check-list'><input type='radio' id='{$model->formName()}-{$index}' name='{$name}' class='check-search' value='{$value}' " . ($checked?'checked':'') . "><label for='{$model->formName()}-{$index}'><span></span>{$label}</label></div>"; | 91 | + $checked = ( $model->online == $value ); |
92 | + return "<div class='blocks-check-list'><input type='radio' id='{$model->formName()}-{$index}' name='{$name}' class='check-search' value='{$value}' " . ( $checked ? 'checked' : '' ) . "><label for='{$model->formName()}-{$index}'><span></span>{$label}</label></div>"; | ||
73 | }, | 93 | }, |
74 | 'unselect' => NULL, | 94 | 'unselect' => NULL, |
75 | ]); | 95 | ]); |
76 | 96 | ||
77 | - echo '<div class="blocks-check-list-submit">'.Html::submitInput('Найти').'</div>'; | 97 | + echo '<div class="blocks-check-list-submit">' . Html::submitInput('Найти') . '</div>'; |
78 | 98 | ||
79 | $form->end(); | 99 | $form->end(); |
80 | ?> | 100 | ?> |
81 | <script> | 101 | <script> |
82 | $('div.rating').rating( | 102 | $('div.rating').rating( |
83 | { | 103 | { |
84 | - fx : 'full', url : 'rating.php' | 104 | + fx : 'full', |
85 | } | 105 | } |
86 | ); | 106 | ); |
87 | </script> | 107 | </script> |
88 | </div> | 108 | </div> |
89 | 109 | ||
90 | <?php | 110 | <?php |
91 | - // == End of left filter == | 111 | + // == End of left filter == |
92 | ?> | 112 | ?> |
93 | 113 | ||
94 | <?php | 114 | <?php |
95 | - // == Page content == | 115 | + // == Page content == |
96 | ?> | 116 | ?> |
97 | <div class="right-search-work"> | 117 | <div class="right-search-work"> |
98 | <div class="search-worker-title style">Найти заказчика</div> | 118 | <div class="search-worker-title style">Найти заказчика</div> |
@@ -100,17 +120,23 @@ | @@ -100,17 +120,23 @@ | ||
100 | <span><?= $dataProvider->totalCount ?></span></div> | 120 | <span><?= $dataProvider->totalCount ?></span></div> |
101 | <div class="search-worker-search-wr style"> | 121 | <div class="search-worker-search-wr style"> |
102 | <?php | 122 | <?php |
103 | - $form2 = ActiveForm::begin(['method' => 'get', 'action' => [''], 'options' => ['class' => 'search-worker-form']]); | ||
104 | - echo $form2->field($model, 'info', ['options' => ['tag' => false]])->label(false)->textInput(['placeholder' => $model->getAttributeLabel('info')]); | 123 | + $form2 = ActiveForm::begin([ |
124 | + 'method' => 'get', | ||
125 | + 'action' => [ '' ], | ||
126 | + 'options' => [ 'class' => 'search-worker-form' ], | ||
127 | + ]); | ||
128 | + echo $form2->field($model, 'info', [ 'options' => [ 'tag' => false ] ]) | ||
129 | + ->label(false) | ||
130 | + ->textInput([ 'placeholder' => $model->getAttributeLabel('info') ]); | ||
105 | echo Html::submitInput('Найти'); | 131 | echo Html::submitInput('Найти'); |
106 | - $form2->end(); | 132 | + $form2->end(); |
107 | ?> | 133 | ?> |
108 | <a href="#" class="add-to-catalog-search-worker">Добавить себя в каталог</a> | 134 | <a href="#" class="add-to-catalog-search-worker">Добавить себя в каталог</a> |
109 | <div class="search-worker-sort-wr style"> | 135 | <div class="search-worker-sort-wr style"> |
110 | <div class="search-worker-sort">Сортировать: </div> | 136 | <div class="search-worker-sort">Сортировать: </div> |
111 | <ul> | 137 | <ul> |
112 | <li class="activejob"> | 138 | <li class="activejob"> |
113 | - <a href="#"></a> | 139 | + <a href="#" data-sort-name="<?= $sort_name ?>"></a> |
114 | <div class="sidebar-droped-wr style"> | 140 | <div class="sidebar-droped-wr style"> |
115 | <?php | 141 | <?php |
116 | echo LinkSorter::widget([ | 142 | echo LinkSorter::widget([ |
@@ -123,147 +149,147 @@ | @@ -123,147 +149,147 @@ | ||
123 | </div> | 149 | </div> |
124 | </div> | 150 | </div> |
125 | <?php | 151 | <?php |
126 | - echo ListView::widget([ | ||
127 | - 'dataProvider' => $dataProvider, | ||
128 | - 'layout' => "{items}\n{pager}", | ||
129 | - 'options' => [ | ||
130 | - 'class' => 'search-worker-blocks-wr style', | ||
131 | - ], | ||
132 | - 'itemOptions' => [ | ||
133 | - 'class' => 'search-worker-blocks', | ||
134 | - ], | ||
135 | - 'itemView' => '_customer_list_view', | ||
136 | - ]); | 152 | + echo ListView::widget([ |
153 | + 'dataProvider' => $dataProvider, | ||
154 | + 'layout' => "{items}\n{pager}", | ||
155 | + 'options' => [ | ||
156 | + 'class' => 'search-worker-blocks-wr style', | ||
157 | + ], | ||
158 | + 'itemOptions' => [ | ||
159 | + 'class' => 'search-worker-blocks', | ||
160 | + ], | ||
161 | + 'itemView' => '_customer_list_view', | ||
162 | + ]); | ||
137 | ?> | 163 | ?> |
138 | <?php | 164 | <?php |
139 | - /* == Layout == | ||
140 | - ?> | ||
141 | - <div class="search-worker-blocks-wr style"> | 165 | + /* == Layout == |
166 | + ?> | ||
167 | + <div class="search-worker-blocks-wr style"> | ||
142 | 168 | ||
143 | - <div class="search-worker-blocks"> | ||
144 | - <div class="search_perform_txt-wr"> | ||
145 | - <div class="search_perform_title">ООО «Ортекс»</div> | ||
146 | - <div class="search_perform-stars-wr"> | ||
147 | - <div class="rating_search_performer"> | ||
148 | - <!--оценка--> | ||
149 | - <input type="hidden" class="val" value="4"/> | 169 | + <div class="search-worker-blocks"> |
170 | + <div class="search_perform_txt-wr"> | ||
171 | + <div class="search_perform_title">ООО «Ортекс»</div> | ||
172 | + <div class="search_perform-stars-wr"> | ||
173 | + <div class="rating_search_performer"> | ||
174 | + <!--оценка--> | ||
175 | + <input type="hidden" class="val" value="4"/> | ||
176 | + </div> | ||
177 | + <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
150 | </div> | 178 | </div> |
151 | - <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
152 | - </div> | ||
153 | - <div class="search_perform_leng"> | ||
154 | - <div>Сотрудники: более 40</div> | ||
155 | - </div> | ||
156 | - <div class="search_perform_visit"> | ||
157 | - <span>Послелний визит:</span> 2 дня назад | 179 | + <div class="search_perform_leng"> |
180 | + <div>Сотрудники: более 40</div> | ||
181 | + </div> | ||
182 | + <div class="search_perform_visit"> | ||
183 | + <span>Послелний визит:</span> 2 дня назад | ||
184 | + </div> | ||
185 | + <div class="search_perform_projets_nam"> | ||
186 | + <a href="#">Заказано проектов: 21</a></div> | ||
158 | </div> | 187 | </div> |
159 | - <div class="search_perform_projets_nam"> | ||
160 | - <a href="#">Заказано проектов: 21</a></div> | ||
161 | - </div> | ||
162 | 188 | ||
163 | - <div class="right_search_perform_block-wr"> | ||
164 | - <div class="right_search_perform_foto-wr"> | ||
165 | - <div><img src="/images/search_performer_img-1.jpg" alt=""/></div> | 189 | + <div class="right_search_perform_block-wr"> |
190 | + <div class="right_search_perform_foto-wr"> | ||
191 | + <div><img src="/images/search_performer_img-1.jpg" alt=""/></div> | ||
192 | + </div> | ||
193 | + <a class="get-list" href="#">Добавить в закладки</a> | ||
166 | </div> | 194 | </div> |
167 | - <a class="get-list" href="#">Добавить в закладки</a> | ||
168 | </div> | 195 | </div> |
169 | - </div> | ||
170 | 196 | ||
171 | - <div class="search-worker-blocks"> | ||
172 | - <div class="search_perform_txt-wr"> | ||
173 | - <div class="search_perform_title">Петер Цумтор</div> | ||
174 | - <div class="search_perform-stars-wr"> | ||
175 | - <div class="rating_search_performer"> | ||
176 | - <!--оценка--> | ||
177 | - <input type="hidden" class="val" value="2"/> | 197 | + <div class="search-worker-blocks"> |
198 | + <div class="search_perform_txt-wr"> | ||
199 | + <div class="search_perform_title">Петер Цумтор</div> | ||
200 | + <div class="search_perform-stars-wr"> | ||
201 | + <div class="rating_search_performer"> | ||
202 | + <!--оценка--> | ||
203 | + <input type="hidden" class="val" value="2"/> | ||
204 | + </div> | ||
205 | + <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
178 | </div> | 206 | </div> |
179 | - <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
180 | - </div> | ||
181 | - <div class="search_perform_leng"> | ||
182 | - <!--<div>Сотрудники: более 40</div>--> | ||
183 | - </div> | ||
184 | - <div class="search_perform_visit"> | ||
185 | - <span>Послелний визит:</span> 2 дня назад | 207 | + <div class="search_perform_leng"> |
208 | + <!--<div>Сотрудники: более 40</div>--> | ||
209 | + </div> | ||
210 | + <div class="search_perform_visit"> | ||
211 | + <span>Послелний визит:</span> 2 дня назад | ||
212 | + </div> | ||
213 | + <div class="search_perform_projets_nam"> | ||
214 | + <a href="#">Заказано проектов: 21</a></div> | ||
186 | </div> | 215 | </div> |
187 | - <div class="search_perform_projets_nam"> | ||
188 | - <a href="#">Заказано проектов: 21</a></div> | ||
189 | - </div> | ||
190 | 216 | ||
191 | - <div class="right_search_perform_block-wr"> | ||
192 | - <div class="right_search_perform_foto-wr"> | ||
193 | - <div><a href="#"><img src="/images/ded-ico.png" alt=""/></a></div> | 217 | + <div class="right_search_perform_block-wr"> |
218 | + <div class="right_search_perform_foto-wr"> | ||
219 | + <div><a href="#"><img src="/images/ded-ico.png" alt=""/></a></div> | ||
220 | + </div> | ||
221 | + <a class="get-list" href="#">Добавить в закладки</a> | ||
194 | </div> | 222 | </div> |
195 | - <a class="get-list" href="#">Добавить в закладки</a> | ||
196 | </div> | 223 | </div> |
197 | - </div> | ||
198 | 224 | ||
199 | - <div class="search-worker-blocks"> | ||
200 | - <div class="search_perform_txt-wr"> | ||
201 | - <div class="search_perform_title">ООО «Ортекс»</div> | ||
202 | - <div class="search_perform-stars-wr"> | ||
203 | - <div class="rating_search_performer"> | ||
204 | - <!--оценка--> | ||
205 | - <input type="hidden" class="val" value="1"/> | 225 | + <div class="search-worker-blocks"> |
226 | + <div class="search_perform_txt-wr"> | ||
227 | + <div class="search_perform_title">ООО «Ортекс»</div> | ||
228 | + <div class="search_perform-stars-wr"> | ||
229 | + <div class="rating_search_performer"> | ||
230 | + <!--оценка--> | ||
231 | + <input type="hidden" class="val" value="1"/> | ||
232 | + </div> | ||
233 | + <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
206 | </div> | 234 | </div> |
207 | - <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
208 | - </div> | ||
209 | - <div class="search_perform_leng"> | ||
210 | - <div>Сотрудники: более 40</div> | ||
211 | - </div> | ||
212 | - <div class="search_perform_visit"> | ||
213 | - <span>Послелний визит:</span> 2 дня назад | 235 | + <div class="search_perform_leng"> |
236 | + <div>Сотрудники: более 40</div> | ||
237 | + </div> | ||
238 | + <div class="search_perform_visit"> | ||
239 | + <span>Послелний визит:</span> 2 дня назад | ||
240 | + </div> | ||
241 | + <div class="search_perform_projets_nam"> | ||
242 | + <a href="#">Заказано проектов: 21</a></div> | ||
214 | </div> | 243 | </div> |
215 | - <div class="search_perform_projets_nam"> | ||
216 | - <a href="#">Заказано проектов: 21</a></div> | ||
217 | - </div> | ||
218 | 244 | ||
219 | - <div class="right_search_perform_block-wr"> | ||
220 | - <div class="right_search_perform_foto-wr"> | ||
221 | - <div><img src="/images/search_performer_img-1.jpg" alt=""/></div> | 245 | + <div class="right_search_perform_block-wr"> |
246 | + <div class="right_search_perform_foto-wr"> | ||
247 | + <div><img src="/images/search_performer_img-1.jpg" alt=""/></div> | ||
248 | + </div> | ||
249 | + <a class="get-list" href="#">Добавить в закладки</a> | ||
222 | </div> | 250 | </div> |
223 | - <a class="get-list" href="#">Добавить в закладки</a> | ||
224 | </div> | 251 | </div> |
225 | - </div> | ||
226 | 252 | ||
227 | - <div class="search-worker-blocks"> | ||
228 | - <div class="search_perform_txt-wr"> | ||
229 | - <div class="search_perform_title">Петер Цумтор</div> | ||
230 | - <div class="search_perform-stars-wr"> | ||
231 | - <div class="rating_search_performer"> | ||
232 | - <!--оценка--> | ||
233 | - <input type="hidden" class="val" value="5"/> | 253 | + <div class="search-worker-blocks"> |
254 | + <div class="search_perform_txt-wr"> | ||
255 | + <div class="search_perform_title">Петер Цумтор</div> | ||
256 | + <div class="search_perform-stars-wr"> | ||
257 | + <div class="rating_search_performer"> | ||
258 | + <!--оценка--> | ||
259 | + <input type="hidden" class="val" value="5"/> | ||
260 | + </div> | ||
261 | + <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
234 | </div> | 262 | </div> |
235 | - <div class="search_perform-stars-txt">30 отзывов, Киев</div> | ||
236 | - </div> | ||
237 | - <div class="search_perform_leng"> | ||
238 | - <!--<div>Сотрудники: более 40</div>--> | ||
239 | - </div> | ||
240 | - <div class="search_perform_visit"> | ||
241 | - <span>Послелний визит:</span> 2 дня назад | 263 | + <div class="search_perform_leng"> |
264 | + <!--<div>Сотрудники: более 40</div>--> | ||
265 | + </div> | ||
266 | + <div class="search_perform_visit"> | ||
267 | + <span>Послелний визит:</span> 2 дня назад | ||
268 | + </div> | ||
269 | + <div class="search_perform_projets_nam"> | ||
270 | + <a href="#">Заказано проектов: 21</a></div> | ||
242 | </div> | 271 | </div> |
243 | - <div class="search_perform_projets_nam"> | ||
244 | - <a href="#">Заказано проектов: 21</a></div> | ||
245 | - </div> | ||
246 | 272 | ||
247 | - <div class="right_search_perform_block-wr"> | ||
248 | - <div class="right_search_perform_foto-wr"> | ||
249 | - <div><img src="/images/ded-ico.png" alt=""/></div> | 273 | + <div class="right_search_perform_block-wr"> |
274 | + <div class="right_search_perform_foto-wr"> | ||
275 | + <div><img src="/images/ded-ico.png" alt=""/></div> | ||
276 | + </div> | ||
277 | + <a class="get-list" href="#">Добавить в закладки</a> | ||
250 | </div> | 278 | </div> |
251 | - <a class="get-list" href="#">Добавить в закладки</a> | ||
252 | </div> | 279 | </div> |
253 | </div> | 280 | </div> |
254 | - </div> | ||
255 | 281 | ||
256 | - <div class="navi-buttons-wr style"> | ||
257 | - <ul class="pagination"> | ||
258 | - <li class="prev disabled"><span>«</span></li> | ||
259 | - <li class="active"><a href="#">1</a></li> | ||
260 | - <li><a href="#">2</a></li> | ||
261 | - <li class="next"><a href="#">»</a></li> | ||
262 | - </ul> | ||
263 | - </div> | 282 | + <div class="navi-buttons-wr style"> |
283 | + <ul class="pagination"> | ||
284 | + <li class="prev disabled"><span>«</span></li> | ||
285 | + <li class="active"><a href="#">1</a></li> | ||
286 | + <li><a href="#">2</a></li> | ||
287 | + <li class="next"><a href="#">»</a></li> | ||
288 | + </ul> | ||
289 | + </div> | ||
264 | 290 | ||
265 | - <?php | ||
266 | - == End of layout == */ | 291 | + <?php |
292 | + == End of layout == */ | ||
267 | ?> | 293 | ?> |
268 | 294 | ||
269 | <script> | 295 | <script> |
@@ -275,7 +301,7 @@ | @@ -275,7 +301,7 @@ | ||
275 | </script> | 301 | </script> |
276 | </div> | 302 | </div> |
277 | <?php | 303 | <?php |
278 | - // == End of page content == | 304 | + // == End of page content == |
279 | ?> | 305 | ?> |
280 | </div> | 306 | </div> |
281 | </div> | 307 | </div> |
frontend/web/css/style.css
@@ -6594,7 +6594,6 @@ input[disabled], select[disabled] { | @@ -6594,7 +6594,6 @@ input[disabled], select[disabled] { | ||
6594 | } | 6594 | } |
6595 | 6595 | ||
6596 | /***/ | 6596 | /***/ |
6597 | -.sidebar-droped-wr ul li:first-child {display: none;} | ||
6598 | .right_search_perform_foto-wr {width: 140px;height: 93px;float: left;margin-left: 16px;} | 6597 | .right_search_perform_foto-wr {width: 140px;height: 93px;float: left;margin-left: 16px;} |
6599 | .right_search_perform_foto-wr>div{width: 140px;height: 93px; display: table-cell; vertical-align: middle; text-align: center} | 6598 | .right_search_perform_foto-wr>div{width: 140px;height: 93px; display: table-cell; vertical-align: middle; text-align: center} |
6600 | .right_search_perform_foto-wr>div{max-width: 140px;max-height: 93px; vertical-align: middle} | 6599 | .right_search_perform_foto-wr>div{max-width: 140px;max-height: 93px; vertical-align: middle} |
frontend/web/js/script.js
@@ -490,8 +490,17 @@ $(document).ready(function(){ | @@ -490,8 +490,17 @@ $(document).ready(function(){ | ||
490 | //} | 490 | //} |
491 | 491 | ||
492 | function jobClick(){ | 492 | function jobClick(){ |
493 | - $('.activejob a').click(function(e){ | 493 | + |
494 | + var container = $('.search-worker-sort-wr'); | ||
495 | + var sort = $(container).find('.activejob a[data-sort-name]').data('sort-name'); | ||
496 | + var active = $(container).find('ul.sorter a[data-sort='+sort+']').clone(); | ||
497 | + $(container).find('.activejob a[data-sort-name]').replaceWith(active); | ||
498 | + | ||
499 | + $('.activejob>a').click(function(e) { | ||
494 | e.preventDefault(); | 500 | e.preventDefault(); |
501 | + }); | ||
502 | + | ||
503 | + $('.activejob a').click(function(e){ | ||
495 | $('.sidebar-droped-wr').toggleClass('act') | 504 | $('.sidebar-droped-wr').toggleClass('act') |
496 | $('.performance-vacancy-sidebar-company-job>ul').addClass('active-dropped-ul') | 505 | $('.performance-vacancy-sidebar-company-job>ul').addClass('active-dropped-ul') |
497 | if( !($('.sidebar-droped-wr').hasClass('act')) ) { | 506 | if( !($('.sidebar-droped-wr').hasClass('act')) ) { |