Commit 42931736627bf91f918a7186c9f593a5378eb36d
1 parent
143979c5
test
Showing
15 changed files
with
78 additions
and
59 deletions
Show diff stats
common/models/BlogSearch.php
@@ -130,8 +130,8 @@ | @@ -130,8 +130,8 @@ | ||
130 | 130 | ||
131 | $query->andFilterWhere([ | 131 | $query->andFilterWhere([ |
132 | 'like', | 132 | 'like', |
133 | - 'name', | ||
134 | - $this->name, | 133 | + 'LOWER(name)', |
134 | + mb_strtolower($this->name), | ||
135 | ]) | 135 | ]) |
136 | ->andFilterWhere([ | 136 | ->andFilterWhere([ |
137 | 'like', | 137 | 'like', |
frontend/controllers/CompanyController.php
@@ -251,29 +251,22 @@ | @@ -251,29 +251,22 @@ | ||
251 | throw new BadRequestHttpException('Пользователь не найден'); | 251 | throw new BadRequestHttpException('Пользователь не найден'); |
252 | } | 252 | } |
253 | 253 | ||
254 | - $query = Blog::find() | ||
255 | - ->where([ 'user_id' => $company_id ]); | ||
256 | - | ||
257 | - $countQuery = clone $query; | ||
258 | - | ||
259 | - $pagination = new Pagination([ | ||
260 | - 'totalCount' => $countQuery->count(), | ||
261 | - 'pageSize' => 5, | ||
262 | - ]); | ||
263 | - | ||
264 | - $article = $query->offset($pagination->offset) | ||
265 | - ->limit($pagination->limit) | ||
266 | - ->with('comments') | ||
267 | - ->all(); | ||
268 | - | ||
269 | - $blog = new ArrayDataProvider([ | ||
270 | - 'allModels' => $article, | 254 | + $blog = new ActiveDataProvider([ |
255 | + 'query' => $company->getBlog(), | ||
256 | + 'pagination' => new Pagination([ | ||
257 | + 'pageSize' => 5, | ||
258 | + ]), | ||
259 | + 'sort' => new Sort([ | ||
260 | + 'defaultOrder' => [ | ||
261 | + 'date_add' => SORT_DESC, | ||
262 | + 'name' => SORT_ASC, | ||
263 | + ], | ||
264 | + ]), | ||
271 | ]); | 265 | ]); |
272 | 266 | ||
273 | return $this->render('blog-list', [ | 267 | return $this->render('blog-list', [ |
274 | 'company' => $company, | 268 | 'company' => $company, |
275 | 'blog' => $blog, | 269 | 'blog' => $blog, |
276 | - 'pagination' => $pagination, | ||
277 | ]); | 270 | ]); |
278 | } | 271 | } |
279 | 272 |
frontend/controllers/PerformerController.php
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | use yii\data\ActiveDataProvider; | 10 | use yii\data\ActiveDataProvider; |
11 | use yii\data\ArrayDataProvider; | 11 | use yii\data\ArrayDataProvider; |
12 | use yii\data\Pagination; | 12 | use yii\data\Pagination; |
13 | + use yii\data\Sort; | ||
13 | use yii\helpers\ArrayHelper; | 14 | use yii\helpers\ArrayHelper; |
14 | use yii\web\BadRequestHttpException; | 15 | use yii\web\BadRequestHttpException; |
15 | use yii\web\Controller; | 16 | use yii\web\Controller; |
@@ -217,28 +218,22 @@ | @@ -217,28 +218,22 @@ | ||
217 | throw new BadRequestHttpException('Пользователь не найден'); | 218 | throw new BadRequestHttpException('Пользователь не найден'); |
218 | } | 219 | } |
219 | 220 | ||
220 | - $query = $user->getBlog(); | ||
221 | - | ||
222 | - $countQuery = clone $query; | ||
223 | - | ||
224 | - $pagination = new Pagination([ | ||
225 | - 'totalCount' => $countQuery->count(), | ||
226 | - 'pageSize' => 5, | ||
227 | - ]); | ||
228 | - | ||
229 | - $article = $query->offset($pagination->offset) | ||
230 | - ->limit($pagination->limit) | ||
231 | - ->with('comments') | ||
232 | - ->all(); | ||
233 | - | ||
234 | - $blog = new ArrayDataProvider([ | ||
235 | - 'allModels' => $article, | 221 | + $blog = new ActiveDataProvider([ |
222 | + 'query' => $user->getBlog(), | ||
223 | + 'pagination' => new Pagination([ | ||
224 | + 'pageSize' => 5, | ||
225 | + ]), | ||
226 | + 'sort' => new Sort([ | ||
227 | + 'defaultOrder' => [ | ||
228 | + 'date_add' => SORT_DESC, | ||
229 | + 'name' => SORT_ASC, | ||
230 | + ], | ||
231 | + ]), | ||
236 | ]); | 232 | ]); |
237 | 233 | ||
238 | return $this->render('blog-list', [ | 234 | return $this->render('blog-list', [ |
239 | 'user' => $user, | 235 | 'user' => $user, |
240 | 'blog' => $blog, | 236 | 'blog' => $blog, |
241 | - 'pagination' => $pagination, | ||
242 | ]); | 237 | ]); |
243 | } | 238 | } |
244 | 239 |
frontend/controllers/SiteController.php
@@ -266,8 +266,6 @@ class SiteController extends Controller | @@ -266,8 +266,6 @@ class SiteController extends Controller | ||
266 | 266 | ||
267 | if ($user = $model->signup()) { | 267 | if ($user = $model->signup()) { |
268 | 268 | ||
269 | - | ||
270 | - | ||
271 | $user_info = new UserInfo(); | 269 | $user_info = new UserInfo(); |
272 | 270 | ||
273 | $user_info->load(Yii::$app->request->post(),'SignupForm'); | 271 | $user_info->load(Yii::$app->request->post(),'SignupForm'); |
frontend/models/SearchPerformerForm.php
@@ -49,7 +49,7 @@ class SearchPerformerForm extends Model | @@ -49,7 +49,7 @@ class SearchPerformerForm extends Model | ||
49 | 'city' => 'Город', | 49 | 'city' => 'Город', |
50 | 'specialization' => 'Специализация', | 50 | 'specialization' => 'Специализация', |
51 | 'type' => 'Тип исполнителя', | 51 | 'type' => 'Тип исполнителя', |
52 | - 'additional_parameters' => 'Тип исполнителя', | 52 | + 'additional_parameters' => 'Дополнительно', |
53 | 'working_conditions' => 'Условия работы', | 53 | 'working_conditions' => 'Условия работы', |
54 | 'rating' => 'Рейтинг', | 54 | 'rating' => 'Рейтинг', |
55 | 'online' => 'Статус', | 55 | 'online' => 'Статус', |
frontend/models/SignupForm.php
@@ -36,7 +36,7 @@ class SignupForm extends Model | @@ -36,7 +36,7 @@ class SignupForm extends Model | ||
36 | { | 36 | { |
37 | return [ | 37 | return [ |
38 | ['username', 'filter', 'filter' => 'trim'], | 38 | ['username', 'filter', 'filter' => 'trim'], |
39 | - ['username', 'required'], | 39 | + [['username', 'city'], 'required'], |
40 | ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], | 40 | ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], |
41 | ['username', 'string', 'min' => 2, 'max' => 255], | 41 | ['username', 'string', 'min' => 2, 'max' => 255], |
42 | 42 | ||
@@ -83,7 +83,9 @@ class SignupForm extends Model | @@ -83,7 +83,9 @@ class SignupForm extends Model | ||
83 | */ | 83 | */ |
84 | public function signup() | 84 | public function signup() |
85 | { | 85 | { |
86 | - | 86 | + if(empty($this->city)) { |
87 | + $this->city = $this->city_custom; | ||
88 | + } | ||
87 | if ($this->validate()) { | 89 | if ($this->validate()) { |
88 | $user = new User(); | 90 | $user = new User(); |
89 | $user->username = $this->username; | 91 | $user->username = $this->username; |
frontend/views/accounts/blog.php
@@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
42 | 'clientOptions' => [ | 42 | 'clientOptions' => [ |
43 | 'changeYear' => true, | 43 | 'changeYear' => true, |
44 | 'changeMonth' => true, | 44 | 'changeMonth' => true, |
45 | + 'yearRange' => "1970:".date('Y'), | ||
45 | ], | 46 | ], |
46 | ]). | 47 | ]). |
47 | "</span> | 48 | "</span> |
@@ -57,6 +58,7 @@ | @@ -57,6 +58,7 @@ | ||
57 | 'clientOptions' => [ | 58 | 'clientOptions' => [ |
58 | 'changeYear' => true, | 59 | 'changeYear' => true, |
59 | 'changeMonth' => true, | 60 | 'changeMonth' => true, |
61 | + 'yearRange' => "1970:".date('Y'), | ||
60 | ], | 62 | ], |
61 | ]) | 63 | ]) |
62 | ."</span>" | 64 | ."</span>" |
frontend/views/company/blog-list.php
1 | <?php | 1 | <?php |
2 | + /** | ||
3 | + * @var View $this | ||
4 | + * @var ActiveDataProvider $blog | ||
5 | + * @var User $company | ||
6 | + */ | ||
2 | 7 | ||
3 | - use \yii\helpers\Html; | 8 | + use common\models\User; |
9 | + use yii\data\ActiveDataProvider; | ||
10 | + use yii\web\View; | ||
4 | use yii\widgets\LinkPager; | 11 | use yii\widgets\LinkPager; |
5 | use yii\widgets\ListView; | 12 | use yii\widgets\ListView; |
6 | 13 | ||
7 | - /* @var $this yii\web\View */ | ||
8 | $this->params[ 'company' ] = $company; | 14 | $this->params[ 'company' ] = $company; |
9 | $this->title = 'My Yii Application'; | 15 | $this->title = 'My Yii Application'; |
10 | ?> | 16 | ?> |
@@ -19,6 +25,6 @@ | @@ -19,6 +25,6 @@ | ||
19 | </div> | 25 | </div> |
20 | <div class="navi-buttons-wr style"> | 26 | <div class="navi-buttons-wr style"> |
21 | <?= LinkPager::widget([ | 27 | <?= LinkPager::widget([ |
22 | - 'pagination' => $pagination, | 28 | + 'pagination' => $blog->pagination, |
23 | ]); ?> | 29 | ]); ?> |
24 | </div> | 30 | </div> |
frontend/views/layouts/company.php
@@ -228,12 +228,26 @@ | @@ -228,12 +228,26 @@ | ||
228 | </li> | 228 | </li> |
229 | <li><img src="/images/sidebar-ico/ico-3.png" alt=""/> | 229 | <li><img src="/images/sidebar-ico/ico-3.png" alt=""/> |
230 | <div class="sidebarvievstxt"> | 230 | <div class="sidebarvievstxt"> |
231 | - <span class="sidebar-views-txt">Последний визит: <br/></span><?= $this->params[ 'company' ]->userInfo->lastVisit ?> | 231 | + <span class="sidebar-views-txt">Последний визит: <br/></span> |
232 | + <?php | ||
233 | + if($this->params[ 'company' ]->isOnline) { | ||
234 | + echo 'Онлайн'; | ||
235 | + } else { | ||
236 | + echo $this->params[ 'company' ]->userInfo->lastVisitCabinet; | ||
237 | + } | ||
238 | + ?> | ||
232 | </div> | 239 | </div> |
233 | </li> | 240 | </li> |
234 | <li><img src="/images/sidebar-ico/ico-5.png" alt=""/> | 241 | <li><img src="/images/sidebar-ico/ico-5.png" alt=""/> |
235 | <div class="sidebarvievstxt"> | 242 | <div class="sidebarvievstxt"> |
236 | - <span class="sidebar-views-txt">Сотрудники:<br/></span><?= $this->params[ 'company' ]->companyInfo->staff ?> | 243 | + <span class="sidebar-views-txt">Сотрудники:<br/></span> |
244 | + <?php | ||
245 | + if(!empty($this->params[ 'company' ]->companyInfo->staff)) { | ||
246 | + echo $this->params[ 'company' ]->companyInfo->staff; | ||
247 | + } else { | ||
248 | + echo 0; | ||
249 | + } | ||
250 | + ?> | ||
237 | </div> | 251 | </div> |
238 | </li> | 252 | </li> |
239 | <?= $this->render('/patrial/show_phone_list', [ | 253 | <?= $this->render('/patrial/show_phone_list', [ |
frontend/views/layouts/performer.php
@@ -258,7 +258,7 @@ | @@ -258,7 +258,7 @@ | ||
258 | <span class="sidebar-views-txt">Стоимость работ:<br/></span> | 258 | <span class="sidebar-views-txt">Стоимость работ:<br/></span> |
259 | <?php | 259 | <?php |
260 | if(!empty( $this->params[ 'user' ]->userInfo->salary )) { | 260 | if(!empty( $this->params[ 'user' ]->userInfo->salary )) { |
261 | - echo $this->params[ 'user' ]->userInfo->salary . ' ' . $this->params[ 'user' ]->userInfo->currency->label; | 261 | + echo 'от '.$this->params[ 'user' ]->userInfo->salary . ' ' . $this->params[ 'user' ]->userInfo->currency->label.' за час'; |
262 | } else { | 262 | } else { |
263 | echo 'Не указано'; | 263 | echo 'Не указано'; |
264 | } | 264 | } |
frontend/views/patrial/show_site_list.php
1 | -<?php foreach($sites as $site ):?> | ||
2 | - <?php if(!empty($phone['phone'])): ?> | ||
3 | - <li><img src="/images/sidebar-ico/ico-7.png" alt=""/><div class="sidebarvievstxt"><a target="_blank" href="<?= $site['site']?>">Сайт</a></div></li> | 1 | +<?php foreach($sites as $site): ?> |
2 | + <?php if(!empty( $site[ 'site' ] )): ?> | ||
3 | + <li><img src="/images/sidebar-ico/ico-7.png" alt=""/> | ||
4 | + <div class="sidebarvievstxt"> | ||
5 | + <a target="_blank" href="<?= $site[ 'site' ] ?>"><?= $site[ 'site' ] ?></a></div> | ||
6 | + </li> | ||
4 | <?php endif; ?> | 7 | <?php endif; ?> |
5 | -<?php endforeach;?> | ||
6 | \ No newline at end of file | 8 | \ No newline at end of file |
9 | +<?php endforeach; ?> | ||
7 | \ No newline at end of file | 10 | \ No newline at end of file |
frontend/views/performer/blog-list.php
1 | <?php | 1 | <?php |
2 | /** | 2 | /** |
3 | - * @var ArrayDataProvider $blog | 3 | + * @var ActiveDataProvider $blog |
4 | * @var Pagination $pagination | 4 | * @var Pagination $pagination |
5 | * @var yii\web\View $this | 5 | * @var yii\web\View $this |
6 | */ | 6 | */ |
7 | - use yii\data\ArrayDataProvider; | 7 | + use yii\data\ActiveDataProvider; |
8 | use yii\data\Pagination; | 8 | use yii\data\Pagination; |
9 | use yii\widgets\LinkPager; | 9 | use yii\widgets\LinkPager; |
10 | use yii\widgets\ListView; | 10 | use yii\widgets\ListView; |
@@ -23,7 +23,6 @@ | @@ -23,7 +23,6 @@ | ||
23 | </div> | 23 | </div> |
24 | <div class="navi-buttons-wr style"> | 24 | <div class="navi-buttons-wr style"> |
25 | <?= LinkPager::widget([ | 25 | <?= LinkPager::widget([ |
26 | - 'pagination' => $pagination, | 26 | + 'pagination' => $blog->pagination, |
27 | ]); ?> | 27 | ]); ?> |
28 | </div> | 28 | </div> |
29 | - |
frontend/views/search/performer.php
1 | <?php | 1 | <?php |
2 | + /** | ||
3 | + * @var View $this | ||
4 | + * @var SearchPerformerForm $model | ||
5 | + */ | ||
2 | 6 | ||
3 | use common\models\Vacancy; | 7 | use common\models\Vacancy; |
8 | + use frontend\models\SearchPerformerForm; | ||
4 | use kartik\select2\Select2; | 9 | use kartik\select2\Select2; |
5 | use yii\helpers\ArrayHelper; | 10 | use yii\helpers\ArrayHelper; |
6 | use \yii\helpers\Html; | 11 | use \yii\helpers\Html; |
7 | use yii\helpers\Url; | 12 | use yii\helpers\Url; |
8 | use yii\jui\SliderInput; | 13 | use yii\jui\SliderInput; |
9 | use yii\web\JsExpression; | 14 | use yii\web\JsExpression; |
15 | + use yii\web\View; | ||
10 | use yii\widgets\ActiveForm; | 16 | use yii\widgets\ActiveForm; |
11 | use yii\widgets\LinkSorter; | 17 | use yii\widgets\LinkSorter; |
12 | use yii\widgets\ListView; | 18 | use yii\widgets\ListView; |
13 | 19 | ||
14 | - /* @var $this yii\web\View */ | ||
15 | - | ||
16 | $sort_array = $dataProvider->sort->getAttributeOrders(); | 20 | $sort_array = $dataProvider->sort->getAttributeOrders(); |
17 | $active_key = array_keys($sort_array)[ 0 ]; | 21 | $active_key = array_keys($sort_array)[ 0 ]; |
18 | $active_value = $sort_array[ $active_key ]; | 22 | $active_value = $sort_array[ $active_key ]; |
frontend/views/site/registration.php
@@ -117,7 +117,7 @@ | @@ -117,7 +117,7 @@ | ||
117 | </div> | 117 | </div> |
118 | <div class="input-blocks-wrapper"> | 118 | <div class="input-blocks-wrapper"> |
119 | <div class="input-blocks"> | 119 | <div class="input-blocks"> |
120 | - <?= $form->field($model, 'city') | 120 | + <?= $form->field($model, 'city', ['enableClientValidation' => false, 'options' => ['class' => 'required-no-star']]) |
121 | ->widget(Select2::classname(), [ | 121 | ->widget(Select2::classname(), [ |
122 | 'options' => [ 'placeholder' => 'Выбор города ...' ], | 122 | 'options' => [ 'placeholder' => 'Выбор города ...' ], |
123 | 'pluginOptions' => [ | 123 | 'pluginOptions' => [ |
frontend/web/css/style.css
@@ -5063,6 +5063,9 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + | @@ -5063,6 +5063,9 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + | ||
5063 | left: -15px; | 5063 | left: -15px; |
5064 | width: 15px; | 5064 | width: 15px; |
5065 | } | 5065 | } |
5066 | +.input-blocks .required.required-no-star:before { | ||
5067 | + display: none; | ||
5068 | +} | ||
5066 | .has-success label {color: inherit !important;} | 5069 | .has-success label {color: inherit !important;} |
5067 | .input-blocks .has-success:before { | 5070 | .input-blocks .has-success:before { |
5068 | 5071 |