Commit a22972f9b0479f4bc1fa84b7a21dd6dd70fa5c84
Merge remote-tracking branch 'origin/master'
Showing
6 changed files
with
313 additions
and
172 deletions
Show diff stats
common/models/Project.php
... | ... | @@ -6,8 +6,11 @@ |
6 | 6 | use common\modules\comment\models\CommentProject; |
7 | 7 | use common\modules\fileloader\behaviors\FileloaderBehavior; |
8 | 8 | use Yii; |
9 | + use yii\base\ModelEvent; | |
10 | + use yii\behaviors\AttributeBehavior; | |
9 | 11 | use yii\behaviors\BlameableBehavior; |
10 | 12 | use yii\behaviors\TimestampBehavior; |
13 | + use yii\db\ActiveRecord; | |
11 | 14 | use yii\db\Expression; |
12 | 15 | |
13 | 16 | /** |
... | ... | @@ -68,6 +71,33 @@ |
68 | 71 | 'updatedAtAttribute' => false, |
69 | 72 | 'value' => new Expression('NOW()'), |
70 | 73 | ], |
74 | + [ | |
75 | + 'class' => AttributeBehavior::className(), | |
76 | + 'attributes' => [ | |
77 | + ActiveRecord::EVENT_BEFORE_INSERT => 'total_budget', | |
78 | + ActiveRecord::EVENT_BEFORE_UPDATE => 'total_budget', | |
79 | + ], | |
80 | + 'value' => function($event) { | |
81 | + /** | |
82 | + * @var ModelEvent $event | |
83 | + * @var Project $sender | |
84 | + */ | |
85 | + $total_budget = 0; | |
86 | + $sender = $event->sender; | |
87 | + if($sender->budget > 0) { | |
88 | + $currencies = Currency::find() | |
89 | + ->select([ | |
90 | + 'rate', | |
91 | + 'currency_id', | |
92 | + ]) | |
93 | + ->asArray() | |
94 | + ->indexBy('currency_id') | |
95 | + ->column(); | |
96 | + $total_budget = $sender->budget * $currencies[$sender->budget_currency]; | |
97 | + } | |
98 | + return $total_budget; | |
99 | + }, | |
100 | + ], | |
71 | 101 | 'slug' => [ |
72 | 102 | 'class' => 'common\behaviors\Slug', |
73 | 103 | 'in_attribute' => 'name', |
... | ... | @@ -129,7 +159,6 @@ |
129 | 159 | [ |
130 | 160 | 'name', |
131 | 161 | 'link', |
132 | - 'budget', | |
133 | 162 | 'city', |
134 | 163 | 'street', |
135 | 164 | 'house', |
... | ... | @@ -138,6 +167,14 @@ |
138 | 167 | 'max' => 255, |
139 | 168 | ], |
140 | 169 | [ |
170 | + [ | |
171 | + 'budget', | |
172 | + ], | |
173 | + 'number', | |
174 | + 'skipOnEmpty' => true, | |
175 | + 'min' => 0, | |
176 | + ], | |
177 | + [ | |
141 | 178 | [ 'view_count' ], |
142 | 179 | 'default', |
143 | 180 | 'value' => 0, | ... | ... |
common/models/Specialization.php
1 | 1 | <?php |
2 | 2 | |
3 | -namespace common\models; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\helpers\ArrayHelper; | |
7 | - | |
8 | -/** | |
9 | - * This is the model class for table "specialization". | |
10 | - * | |
11 | - * @property integer $specialization_id | |
12 | - * @property integer $specialization_pid | |
13 | - * @property string $specialization_name | |
14 | - * @property string $image | |
15 | - * @property string $background | |
16 | - */ | |
17 | -class Specialization extends \yii\db\ActiveRecord | |
18 | -{ | |
19 | - /** | |
20 | - * @inheritdoc | |
21 | - */ | |
22 | - public static function tableName() | |
23 | - { | |
24 | - return 'specialization'; | |
25 | - } | |
3 | + namespace common\models; | |
26 | 4 | |
27 | - /** | |
28 | - * @inheritdoc | |
29 | - */ | |
30 | - public function rules() | |
31 | - { | |
32 | - return [ | |
33 | - [['specialization_pid','status'], 'integer'], | |
34 | - [['specialization_pid'], 'default', 'value' => '0',], | |
35 | - [['specialization_name'], 'required'], | |
36 | - [['specialization_name','image','background'], 'string', 'max' => 255], | |
37 | - ]; | |
38 | - } | |
5 | + use Yii; | |
6 | + use yii\db\ActiveQuery; | |
7 | + use yii\helpers\ArrayHelper; | |
39 | 8 | |
40 | 9 | /** |
41 | - * @inheritdoc | |
10 | + * This is the model class for table "specialization". | |
11 | + * @property integer $specialization_id | |
12 | + * @property integer $specialization_pid | |
13 | + * @property string $specialization_name | |
14 | + * @property string $image | |
15 | + * @property string $background | |
42 | 16 | */ |
43 | - public function attributeLabels() | |
17 | + class Specialization extends \yii\db\ActiveRecord | |
44 | 18 | { |
45 | - return [ | |
46 | - 'specialization_id' => Yii::t('app', 'specialization_id'), | |
47 | - 'specialization_pid' => Yii::t('app', 'specialization_pid'), | |
48 | - 'specialization_name' => Yii::t('app', 'specialization_name'), | |
49 | - 'specialization_parent_name' => Yii::t('app', 'specialization_parent_name'), | |
50 | - 'image' => Yii::t('app', 'image'), | |
51 | - 'background' => Yii::t('app', 'background'), | |
52 | - 'status' => Yii::t('app', 'status'), | |
53 | - ]; | |
54 | - } | |
55 | 19 | |
56 | - public static function specializationsList(){ | |
57 | - | |
58 | - | |
59 | - $specializationArray = []; | |
20 | + /** | |
21 | + * @inheritdoc | |
22 | + */ | |
23 | + public static function tableName() | |
24 | + { | |
25 | + return 'specialization'; | |
26 | + } | |
60 | 27 | |
61 | - $specialization = Specialization::find()->where(['specialization_id'=> Specialization::find()->select('specialization_id') | |
62 | - ->andWhere('specialization_pid != 0') | |
63 | - ->column()]) | |
64 | - ->all(); | |
28 | + /** | |
29 | + * @inheritdoc | |
30 | + */ | |
31 | + public function rules() | |
32 | + { | |
33 | + return [ | |
34 | + [ | |
35 | + [ | |
36 | + 'specialization_pid', | |
37 | + 'status', | |
38 | + ], | |
39 | + 'integer', | |
40 | + ], | |
41 | + [ | |
42 | + [ 'specialization_pid' ], | |
43 | + 'default', | |
44 | + 'value' => '0', | |
45 | + ], | |
46 | + [ | |
47 | + [ 'specialization_name' ], | |
48 | + 'required', | |
49 | + ], | |
50 | + [ | |
51 | + [ | |
52 | + 'specialization_name', | |
53 | + 'image', | |
54 | + 'background', | |
55 | + ], | |
56 | + 'string', | |
57 | + 'max' => 255, | |
58 | + ], | |
59 | + ]; | |
60 | + } | |
65 | 61 | |
66 | - foreach(ArrayHelper::index($specialization,'specialization_id') as $spec){ | |
67 | - $array = $spec->hasChildrenInArray($specialization); | |
68 | - if($array){ | |
69 | - $specializationArray[$spec->specialization_name] = $array; | |
70 | - } | |
62 | + /** | |
63 | + * @inheritdoc | |
64 | + */ | |
65 | + public function attributeLabels() | |
66 | + { | |
67 | + return [ | |
68 | + 'specialization_id' => Yii::t('app', 'specialization_id'), | |
69 | + 'specialization_pid' => Yii::t('app', 'specialization_pid'), | |
70 | + 'specialization_name' => Yii::t('app', 'specialization_name'), | |
71 | + 'specialization_parent_name' => Yii::t('app', 'specialization_parent_name'), | |
72 | + 'image' => Yii::t('app', 'image'), | |
73 | + 'background' => Yii::t('app', 'background'), | |
74 | + 'status' => Yii::t('app', 'status'), | |
75 | + ]; | |
71 | 76 | } |
72 | 77 | |
73 | - return $specializationArray; | |
78 | + public static function specializationsList() | |
79 | + { | |
74 | 80 | |
81 | + $specializationArray = [ ]; | |
75 | 82 | |
76 | - } | |
83 | + $specialization = Specialization::find() | |
84 | + ->where([ | |
85 | + 'specialization_id' => Specialization::find() | |
86 | + ->select('specialization_id') | |
87 | + ->andWhere('specialization_pid != 0') | |
88 | + ->column(), | |
89 | + ]) | |
90 | + ->all(); | |
77 | 91 | |
92 | + foreach(ArrayHelper::index($specialization, 'specialization_id') as $spec) { | |
93 | + $array = $spec->hasChildrenInArray($specialization); | |
94 | + if($array) { | |
95 | + $specializationArray[ $spec->specialization_name ] = $array; | |
96 | + } | |
97 | + } | |
78 | 98 | |
79 | - public function getParent() | |
80 | - { | |
81 | - return $this->hasOne(self::className(), ['specialization_id' => 'specialization_pid']); | |
82 | - } | |
99 | + return $specializationArray; | |
83 | 100 | |
84 | - public function getChildren() | |
85 | - { | |
86 | - return $this->hasMany(self::className(), ['specialization_pid' => 'specialization_id']); | |
87 | - } | |
101 | + } | |
88 | 102 | |
89 | - public function hasChildrenInArray($array){ | |
90 | - $array = ArrayHelper::map($array,'specialization_id', 'specialization_name','specialization_pid'); | |
103 | + public function getParent() | |
104 | + { | |
105 | + return $this->hasOne(self::className(), [ 'specialization_id' => 'specialization_pid' ]); | |
106 | + } | |
91 | 107 | |
92 | - if(isset($array[$this->specialization_id])){ | |
93 | - return $array[$this->specialization_id]; | |
94 | - } else { | |
95 | - return false; | |
108 | + public function getChildren() | |
109 | + { | |
110 | + return $this->hasMany(self::className(), [ 'specialization_pid' => 'specialization_id' ]); | |
96 | 111 | } |
97 | 112 | |
98 | - } | |
113 | + public function hasChildrenInArray($array) | |
114 | + { | |
115 | + $array = ArrayHelper::map($array, 'specialization_id', 'specialization_name', 'specialization_pid'); | |
99 | 116 | |
100 | - public function getStack() | |
101 | - { | |
102 | - $stack[] = $this->specialization_id; | |
103 | - if(!empty($this->children)) { | |
104 | - foreach($this->children as $child) { | |
105 | - $stack[] = $child->specialization_id; | |
106 | - if(!empty($child->children)) { | |
107 | - $stack = array_merge($stack, ArrayHelper::getColumn($child->children, 'specialization_id', false)); | |
117 | + if(isset( $array[ $this->specialization_id ] )) { | |
118 | + return $array[ $this->specialization_id ]; | |
119 | + } else { | |
120 | + return false; | |
121 | + } | |
122 | + | |
123 | + } | |
124 | + | |
125 | + public function getStack() | |
126 | + { | |
127 | + $stack[] = $this->specialization_id; | |
128 | + if(!empty( $this->children )) { | |
129 | + foreach($this->children as $child) { | |
130 | + $stack[] = $child->specialization_id; | |
131 | + if(!empty( $child->children )) { | |
132 | + $stack = array_merge($stack, ArrayHelper::getColumn($child->children, 'specialization_id', false)); | |
133 | + } | |
108 | 134 | } |
109 | 135 | } |
136 | + return $stack; | |
137 | + } | |
138 | + | |
139 | + /** | |
140 | + * @return ActiveQuery | |
141 | + */ | |
142 | + public static function getSorted() | |
143 | + { | |
144 | + return self::find() | |
145 | + ->with([ | |
146 | + 'children' => function($query) { | |
147 | + /** | |
148 | + * @var ActiveQuery $query | |
149 | + */ | |
150 | + $query->orderBy('specialization_name'); | |
151 | + }, | |
152 | + ]) | |
153 | + ->with([ | |
154 | + 'children.children' => function($query) { | |
155 | + /** | |
156 | + * @var ActiveQuery $query | |
157 | + */ | |
158 | + $query->orderBy('specialization_name'); | |
159 | + }, | |
160 | + ]) | |
161 | + ->where([ 'specialization_pid' => 0 ]) | |
162 | + ->orderBy('specialization_name'); | |
110 | 163 | } |
111 | - return $stack; | |
112 | - } | |
113 | 164 | |
114 | -} | |
165 | + } | ... | ... |
common/models/TenderSearch.php
... | ... | @@ -90,13 +90,13 @@ |
90 | 90 | public function attributeLabels() |
91 | 91 | { |
92 | 92 | return [ |
93 | - 'specialization' => Yii::t('app', 'specialization'), | |
93 | + 'specialization' => Yii::t('app', 'specialization'), | |
94 | 94 | 'budget_currency' => Yii::t('app', 'budget_currency'), |
95 | - 'contractual' => Yii::t('app', 'contractual'), | |
96 | - 'city' => Yii::t('app', 'city'), | |
97 | - 'payment' => Yii::t('app', 'payment'), | |
98 | - 'budget_from' => Yii::t('app', 'budget_from'), | |
99 | - 'budget_to' => Yii::t('app', 'budget_to'), | |
95 | + 'contractual' => Yii::t('app', 'contractual'), | |
96 | + 'city' => Yii::t('app', 'city'), | |
97 | + 'payment' => Yii::t('app', 'payment'), | |
98 | + 'budget_from' => Yii::t('app', 'budget_from'), | |
99 | + 'budget_to' => Yii::t('app', 'budget_to'), | |
100 | 100 | ]; |
101 | 101 | } |
102 | 102 | |
... | ... | @@ -120,7 +120,8 @@ |
120 | 120 | { |
121 | 121 | $query = Project::find() |
122 | 122 | ->joinWith('projectSpecializations') |
123 | - ->joinWith('projectPayments'); | |
123 | + ->joinWith('projectPayments') | |
124 | + ->joinWith('user.companyInfo'); | |
124 | 125 | |
125 | 126 | $dataProvider = new ActiveDataProvider([ |
126 | 127 | 'query' => $query, |
... | ... | @@ -200,9 +201,32 @@ |
200 | 201 | 'city' => $this->city, |
201 | 202 | ]) |
202 | 203 | ->andFilterWhere([ |
203 | - 'like', | |
204 | - 'LOWER(project.name)', | |
205 | - mb_strtolower($this->info), | |
204 | + 'or', | |
205 | + [ | |
206 | + 'like', | |
207 | + 'LOWER(project.name)', | |
208 | + mb_strtolower($this->info), | |
209 | + ], | |
210 | + [ | |
211 | + 'like', | |
212 | + 'LOWER(project.description)', | |
213 | + mb_strtolower($this->info), | |
214 | + ], | |
215 | + [ | |
216 | + 'like', | |
217 | + 'LOWER("user".firstname)', | |
218 | + mb_strtolower($this->info), | |
219 | + ], | |
220 | + [ | |
221 | + 'like', | |
222 | + 'LOWER("user".lastname)', | |
223 | + mb_strtolower($this->info), | |
224 | + ], | |
225 | + [ | |
226 | + 'like', | |
227 | + 'LOWER(company_info.name)', | |
228 | + mb_strtolower($this->info), | |
229 | + ], | |
206 | 230 | ]) |
207 | 231 | ->andWhere([ |
208 | 232 | 'project_payment.payment_id' => $this->payment, | ... | ... |
frontend/controllers/SearchController.php
1 | 1 | <?php |
2 | -namespace frontend\controllers; | |
3 | - | |
4 | -use common\models\Currency; | |
5 | -use common\models\CustomerSearch; | |
6 | -use common\models\Payment; | |
7 | -use common\models\Specialization; | |
8 | -use common\models\TenderSearch; | |
9 | -use frontend\models\SearchPerformerForm; | |
10 | -use frontend\models\SearchVacancyForm; | |
11 | -use Yii; | |
12 | -use frontend\models\Options; | |
13 | -use frontend\models\OptionValues; | |
14 | -use yii\base\InvalidParamException; | |
15 | -use yii\data\ActiveDataProvider; | |
16 | -use yii\data\Pagination; | |
17 | -use yii\web\Controller; | |
18 | -use frontend\models\OptionsToValues; | |
19 | -use common\models\Page; | |
20 | -use frontend\models\Option; | |
2 | + namespace frontend\controllers; | |
3 | + | |
4 | + use common\models\Currency; | |
5 | + use common\models\CustomerSearch; | |
6 | + use common\models\Payment; | |
7 | + use common\models\Specialization; | |
8 | + use common\models\TenderSearch; | |
9 | + use frontend\models\SearchPerformerForm; | |
10 | + use frontend\models\SearchVacancyForm; | |
11 | + use Yii; | |
12 | + use frontend\models\Options; | |
13 | + use frontend\models\OptionValues; | |
14 | + use yii\base\InvalidParamException; | |
15 | + use yii\data\ActiveDataProvider; | |
16 | + use yii\data\Pagination; | |
17 | + use yii\db\ActiveQuery; | |
18 | + use yii\web\Controller; | |
19 | + use frontend\models\OptionsToValues; | |
20 | + use common\models\Page; | |
21 | + use frontend\models\Option; | |
21 | 22 | |
22 | 23 | /** |
23 | 24 | * Site controller |
... | ... | @@ -49,20 +50,32 @@ use frontend\models\Option; |
49 | 50 | $actions = [ |
50 | 51 | 1 => 'project', |
51 | 52 | 2 => 'performer', |
52 | - 3 => 'customer' | |
53 | + 3 => 'customer', | |
53 | 54 | ]; |
54 | 55 | if(!array_key_exists($action, $actions)) { |
55 | - return $this->redirect(['/', 'query' => $query]); | |
56 | + return $this->redirect([ | |
57 | + '/', | |
58 | + 'query' => $query, | |
59 | + ]); | |
56 | 60 | } else { |
57 | 61 | switch($action) { |
58 | 62 | case 1: |
59 | - return $this->redirect(['search/'.$actions[$action], 'TenderSearch[info]' => $query]); | |
60 | - break; | |
63 | + return $this->redirect([ | |
64 | + 'search/' . $actions[ $action ], | |
65 | + 'TenderSearch[info]' => $query, | |
66 | + ]); | |
67 | + break; | |
61 | 68 | case 2: |
62 | - return $this->redirect(['search/'.$actions[$action], 'SearchPerformerForm[search]' => $query]); | |
69 | + return $this->redirect([ | |
70 | + 'search/' . $actions[ $action ], | |
71 | + 'SearchPerformerForm[search]' => $query, | |
72 | + ]); | |
63 | 73 | break; |
64 | 74 | case 3: |
65 | - return $this->redirect(['search/'.$actions[$action], 'CustomerSearch[info]' => $query]); | |
75 | + return $this->redirect([ | |
76 | + 'search/' . $actions[ $action ], | |
77 | + 'CustomerSearch[info]' => $query, | |
78 | + ]); | |
66 | 79 | break; |
67 | 80 | } |
68 | 81 | } |
... | ... | @@ -73,19 +86,26 @@ use frontend\models\Option; |
73 | 86 | { |
74 | 87 | $model = new TenderSearch(); |
75 | 88 | $dataProvider = $model->search(Yii::$app->request->queryParams); |
76 | - $dataProvider->query->andWhere(['hidden' => 0]); | |
89 | + $dataProvider->query->andWhere([ 'hidden' => 0 ]); | |
77 | 90 | $dataProvider->setPagination([ |
78 | 91 | 'pageSize' => 10, |
79 | 92 | ]); |
80 | 93 | $specialization = Specialization::specializationsList(); |
81 | 94 | $currencies = Currency::getCurrencyDropdown(); |
82 | - $payments = Payment::find()->select(['name', 'payment_id'])->asArray()->indexBy('payment_id')->column(); | |
95 | + $payments = Payment::find() | |
96 | + ->select([ | |
97 | + 'name', | |
98 | + 'payment_id', | |
99 | + ]) | |
100 | + ->asArray() | |
101 | + ->indexBy('payment_id') | |
102 | + ->column(); | |
83 | 103 | return $this->render('project', [ |
84 | - 'model' => $model, | |
85 | - 'dataProvider' => $dataProvider, | |
104 | + 'model' => $model, | |
105 | + 'dataProvider' => $dataProvider, | |
86 | 106 | 'specialization' => $specialization, |
87 | - 'currencies' => $currencies, | |
88 | - 'payments' => $payments, | |
107 | + 'currencies' => $currencies, | |
108 | + 'payments' => $payments, | |
89 | 109 | ]); |
90 | 110 | } |
91 | 111 | |
... | ... | @@ -103,25 +123,19 @@ use frontend\models\Option; |
103 | 123 | ]); |
104 | 124 | } |
105 | 125 | |
106 | - | |
107 | - | |
108 | 126 | public function actionPerformer() |
109 | 127 | { |
110 | 128 | $specialization = Specialization::specializationsList(); |
111 | 129 | |
112 | - $specializations = Specialization::find() | |
113 | - ->with('children') | |
114 | - ->where([ 'specialization_pid' => 0 ]) | |
115 | - ->orderBy('specialization_id') | |
116 | - ->all(); | |
130 | + $specializations = Specialization::getSorted()->all(); | |
117 | 131 | |
118 | 132 | $searchModel = new SearchPerformerForm(); |
119 | 133 | |
120 | - return $this->render('performer',[ | |
121 | - 'dataProvider' => $searchModel->search(Yii::$app->request->queryParams), | |
122 | - 'specialization' => $specialization, | |
134 | + return $this->render('performer', [ | |
135 | + 'dataProvider' => $searchModel->search(Yii::$app->request->queryParams), | |
136 | + 'specialization' => $specialization, | |
123 | 137 | 'specializations' => $specializations, |
124 | - 'model'=> $searchModel | |
138 | + 'model' => $searchModel, | |
125 | 139 | ]); |
126 | 140 | } |
127 | 141 | |
... | ... | @@ -141,7 +155,7 @@ use frontend\models\Option; |
141 | 155 | ]); |
142 | 156 | |
143 | 157 | $vacancy = $query->offset($pagination->offset) |
144 | - ->limit($pagination->limit); | |
158 | + ->limit($pagination->limit); | |
145 | 159 | |
146 | 160 | $dataProvider = new ActiveDataProvider([ |
147 | 161 | 'query' => $vacancy, |
... | ... | @@ -154,11 +168,11 @@ use frontend\models\Option; |
154 | 168 | ], |
155 | 169 | ]); |
156 | 170 | |
157 | - return $this->render('vacancy',[ | |
158 | - 'dataProvider' => $dataProvider, | |
171 | + return $this->render('vacancy', [ | |
172 | + 'dataProvider' => $dataProvider, | |
159 | 173 | 'specialization' => $specialization, |
160 | - 'model'=> $searchModel, | |
161 | - 'pagination'=> $pagination | |
174 | + 'model' => $searchModel, | |
175 | + 'pagination' => $pagination, | |
162 | 176 | ]); |
163 | 177 | |
164 | 178 | } | ... | ... |
frontend/models/SearchPerformerForm.php
... | ... | @@ -177,9 +177,19 @@ |
177 | 177 | // Clear array from empty strings |
178 | 178 | //$this->specialization = array_filter($this->specialization, 'strlen'); |
179 | 179 | |
180 | + if($this->portfolio) { | |
181 | + $query->innerJoin('portfolio_specialization', '"portfolio"."portfolio_id" = "portfolio_specialization"."portfolio_id"'); | |
182 | + $query->andFilterWhere([ | |
183 | + 'portfolio_specialization.specialization_id' => $this->specialization, | |
184 | + ]); | |
185 | + } else { | |
186 | + $query->andFilterWhere([ | |
187 | + 'specialization.specialization_id' => $this->specialization, | |
188 | + ]); | |
189 | + } | |
190 | + | |
180 | 191 | $query->andFilterWhere([ |
181 | 192 | 'user_info.city' => $this->city, |
182 | - 'specialization.specialization_id' => $this->specialization, | |
183 | 193 | 'user.type' => $this->type, |
184 | 194 | 'user.id' => $query2, |
185 | 195 | ]); | ... | ... |
frontend/views/search/_performer_list_view.php
... | ... | @@ -19,34 +19,29 @@ |
19 | 19 | if(!empty( $portfolios )) { |
20 | 20 | for($i = 0; $i < count($portfolios); $i++) { |
21 | 21 | if($i) { |
22 | - echo Html::a(Html::img($portfolios[ $i ]), '#', [ 'class' => 'small-img-search gallery-box-min' ]); | |
22 | + echo Html::a(Html::img($portfolios[ $i ]), [ | |
23 | + 'performer/portfolio', | |
24 | + 'performer_id' => $model->id, | |
25 | + ], [ 'class' => 'small-img-search' ]); | |
23 | 26 | } else { |
24 | - echo Html::a(Html::img($model->minImg($portfolios[ $i ], '318', '228')), '#', [ 'class' => 'big-img-search gallery-box-min' ]); | |
27 | + echo Html::a(Html::img($model->minImg($portfolios[ $i ], '318', '228')), [ | |
28 | + 'performer/portfolio', | |
29 | + 'performer_id' => $model->id, | |
30 | + ], [ 'class' => 'big-img-search' ]); | |
25 | 31 | } |
26 | 32 | } |
27 | 33 | } else { |
28 | 34 | echo 'Работы в порфолио отсутствуют'; |
29 | 35 | } |
30 | 36 | ?> |
31 | - | |
32 | - <div class="gallery-box-hidden"> | |
33 | - <div class="gallery-box-preview"> | |
34 | - <?php foreach($portfolios as $portfolio): ?> | |
35 | - <span data-link="<?= $model->minImg($portfolio, '152', '108') ?>"></span> | |
36 | - <?php endforeach; ?> | |
37 | - </div> | |
38 | - <div class="gallery-box-big"> | |
39 | - <?php foreach($portfolios as $portfolio): ?> | |
40 | - <span data-link="<?= $model->minImg($portfolio, 'original') ?>"></span> | |
41 | - <?php endforeach; ?> | |
42 | - </div> | |
43 | - </div> | |
44 | 37 | </div> |
45 | 38 | </div> |
46 | - | |
47 | 39 | <div class="search-worker-blocks-text-wr"> |
48 | 40 | <div class="search-worker-blocks-ico-wr"> |
49 | - <?= Html::img($model->minImg($model->userInfo->image, '48', '48')) ?> | |
41 | + <?= Html::a(Html::img($model->minImg($model->userInfo->image, '48', '48')), [ | |
42 | + 'performer/portfolio', | |
43 | + 'performer_id' => $model->id, | |
44 | + ]) ?> | |
50 | 45 | </div> |
51 | 46 | <div class="search-worker-blocks-title-wr"> |
52 | 47 | <?php if($model->userInfo->member): ?> |
... | ... | @@ -55,7 +50,10 @@ |
55 | 50 | <div class="land-stars-new">NEW</div> |
56 | 51 | <?php endif; ?> |
57 | 52 | |
58 | - <div class="search-worker-blocks-title"><?= $model->name ?></div> | |
53 | + <div class="search-worker-blocks-title"><?= Html::a($model->name, [ | |
54 | + 'performer/portfolio', | |
55 | + 'performer_id' => $model->id, | |
56 | + ]) ?></div> | |
59 | 57 | </div> |
60 | 58 | <div class="search-worker-blocks-title-wr"> |
61 | 59 | <div> |
... | ... | @@ -73,7 +71,7 @@ |
73 | 71 | ]); |
74 | 72 | ?> |
75 | 73 | </div> |
76 | - <div class="search-worker-blocks-atr"><?=count($model->comments)?> мнений, <?= $model->userInfo->city ?></div> | |
74 | + <div class="search-worker-blocks-atr"><?= count($model->comments) ?> мнений, <?= $model->userInfo->city ?></div> | |
77 | 75 | </div> |
78 | 76 | <div class="search-worker-blocks-title-wr"> |
79 | 77 | <div class="search-worker-blocks-status"> |
... | ... | @@ -82,18 +80,25 @@ |
82 | 80 | <?php else: ?> |
83 | 81 | <?= Html::img('/images/sidebar-ico/ico-9.png'); ?><span>свободен</span> |
84 | 82 | <?php endif ?> |
85 | - | |
86 | 83 | </div> |
87 | 84 | </div> |
88 | 85 | <div class="search-worker-blocks-geographic style"> |
89 | - | |
90 | - | |
91 | 86 | <span>География работ: </span><?= implode(',', array_filter(ArrayHelper::getColumn($model->portfolios, 'city'))) ?> |
92 | 87 | </div> |
93 | 88 | <div class="search-worker-blocks-tags style"> |
94 | - <?php foreach($model->specializations as $specialization): ?> | |
95 | - <a href="#"><?= $specialization->specialization_name ?></a>, | |
96 | - <?php endforeach; ?> | |
89 | + <?php | |
90 | + $count = count($model->specializations); | |
91 | + if($count > 20) { | |
92 | + $count = 20; | |
93 | + } | |
94 | + for($i = 0; $i < $count; $i++) { | |
95 | + echo Html::a($model->specializations[ $i ]->specialization_name, [ | |
96 | + 'search/performer', | |
97 | + 'SearchPerformerForm[specialization][' . $model->specializations[ $i ]->specialization_id . ']' => $model->specializations[ $i ]->specialization_id, | |
98 | + 'SearchPerformerForm[portfolio]' => 0, | |
99 | + ]) . ', '; | |
100 | + } | |
101 | + ?> | |
97 | 102 | </div> |
98 | 103 | <div class="search-worker-blocks-visit style"> |
99 | 104 | <span>Последний визит: </span><?= $model->userInfo->lastVisit ?></div> | ... | ... |