Commit bb9709e03a6c4874e3dbed767a881df758f5b339
1 parent
26e94ae5
add yii jquery
Showing
1 changed file
with
39 additions
and
33 deletions
Show diff stats
frontend/models/SearchPerformerForm.php
| @@ -168,48 +168,54 @@ class SearchPerformerForm extends Model | @@ -168,48 +168,54 @@ class SearchPerformerForm extends Model | ||
| 168 | ]); | 168 | ]); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | - foreach($this->working_conditions as $working_conditions){ | ||
| 172 | - if($working_conditions=='guarantee'){ | ||
| 173 | - $query->andWhere([ | ||
| 174 | - '<>', | ||
| 175 | - 'user_info.guarantee', | ||
| 176 | - '' | ||
| 177 | - ]); | ||
| 178 | - }else if($working_conditions=='prepayment'){ | ||
| 179 | - $query->andWhere([ | ||
| 180 | - 'user_info.prepayment'=>0, | ||
| 181 | - | ||
| 182 | - ]); | ||
| 183 | - }else { | ||
| 184 | - $query->andFilterWhere([ | ||
| 185 | - 'user_info.'.$working_conditions => 1, | ||
| 186 | - ]); | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - } | ||
| 190 | 171 | ||
| 191 | - foreach($this->additional_parameters as $additional_parameters){ | ||
| 192 | - | ||
| 193 | - switch ($additional_parameters) { | ||
| 194 | - case 'with_portfolio': | ||
| 195 | - $query->andFilterWhere([ | ||
| 196 | - 'user.id'=>ArrayHelper::toArray(Portfolio::find()->select('user_id')->column()), | 172 | + if(!empty($this->working_conditions)){ |
| 173 | + foreach($this->working_conditions as $working_conditions){ | ||
| 174 | + if($working_conditions=='guarantee'){ | ||
| 175 | + $query->andWhere([ | ||
| 176 | + '<>', | ||
| 177 | + 'user_info.guarantee', | ||
| 178 | + '' | ||
| 197 | ]); | 179 | ]); |
| 198 | - break; | ||
| 199 | - case 'with_comments': | ||
| 200 | - $query->andFilterWhere([ | ||
| 201 | - 'user.id'=>ArrayHelper::toArray(Portfolio::find()->select('user_id')->column()), | 180 | + }else if($working_conditions=='prepayment'){ |
| 181 | + $query->andWhere([ | ||
| 182 | + 'user_info.prepayment'=>0, | ||
| 183 | + | ||
| 202 | ]); | 184 | ]); |
| 203 | - break; | ||
| 204 | - case 'only_free': | 185 | + }else { |
| 205 | $query->andFilterWhere([ | 186 | $query->andFilterWhere([ |
| 206 | - 'user_info.busy'=>0, | 187 | + 'user_info.'.$working_conditions => 1, |
| 207 | ]); | 188 | ]); |
| 208 | - break; | 189 | + } |
| 190 | + | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + if(!empty($this->additional_parameters)){ | ||
| 194 | + foreach($this->additional_parameters as $additional_parameters){ | ||
| 195 | + | ||
| 196 | + switch ($additional_parameters) { | ||
| 197 | + case 'with_portfolio': | ||
| 198 | + $query->andFilterWhere([ | ||
| 199 | + 'user.id'=>ArrayHelper::toArray(Portfolio::find()->select('user_id')->column()), | ||
| 200 | + ]); | ||
| 201 | + break; | ||
| 202 | + case 'with_comments': | ||
| 203 | + $query->andFilterWhere([ | ||
| 204 | + 'user.id'=>ArrayHelper::toArray(Portfolio::find()->select('user_id')->column()), | ||
| 205 | + ]); | ||
| 206 | + break; | ||
| 207 | + case 'only_free': | ||
| 208 | + $query->andFilterWhere([ | ||
| 209 | + 'user_info.busy'=>0, | ||
| 210 | + ]); | ||
| 211 | + break; | ||
| 212 | + } | ||
| 209 | } | 213 | } |
| 210 | } | 214 | } |
| 211 | 215 | ||
| 212 | 216 | ||
| 217 | + | ||
| 218 | + | ||
| 213 | if(!empty( $this->search)){ | 219 | if(!empty( $this->search)){ |
| 214 | 220 | ||
| 215 | $query->andFilterWhere([ | 221 | $query->andFilterWhere([ |