Commit 42931736627bf91f918a7186c9f593a5378eb36d
1 parent
143979c5
test
Showing
15 changed files
with
78 additions
and
59 deletions
Show diff stats
common/models/BlogSearch.php
frontend/controllers/CompanyController.php
| ... | ... | @@ -251,29 +251,22 @@ |
| 251 | 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 | 267 | return $this->render('blog-list', [ |
| 274 | 268 | 'company' => $company, |
| 275 | 269 | 'blog' => $blog, |
| 276 | - 'pagination' => $pagination, | |
| 277 | 270 | ]); |
| 278 | 271 | } |
| 279 | 272 | ... | ... |
frontend/controllers/PerformerController.php
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | use yii\data\ActiveDataProvider; |
| 11 | 11 | use yii\data\ArrayDataProvider; |
| 12 | 12 | use yii\data\Pagination; |
| 13 | + use yii\data\Sort; | |
| 13 | 14 | use yii\helpers\ArrayHelper; |
| 14 | 15 | use yii\web\BadRequestHttpException; |
| 15 | 16 | use yii\web\Controller; |
| ... | ... | @@ -217,28 +218,22 @@ |
| 217 | 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 | 234 | return $this->render('blog-list', [ |
| 239 | 235 | 'user' => $user, |
| 240 | 236 | 'blog' => $blog, |
| 241 | - 'pagination' => $pagination, | |
| 242 | 237 | ]); |
| 243 | 238 | } |
| 244 | 239 | ... | ... |
frontend/controllers/SiteController.php
frontend/models/SearchPerformerForm.php
| ... | ... | @@ -49,7 +49,7 @@ class SearchPerformerForm extends Model |
| 49 | 49 | 'city' => 'Город', |
| 50 | 50 | 'specialization' => 'Специализация', |
| 51 | 51 | 'type' => 'Тип исполнителя', |
| 52 | - 'additional_parameters' => 'Тип исполнителя', | |
| 52 | + 'additional_parameters' => 'Дополнительно', | |
| 53 | 53 | 'working_conditions' => 'Условия работы', |
| 54 | 54 | 'rating' => 'Рейтинг', |
| 55 | 55 | 'online' => 'Статус', | ... | ... |
frontend/models/SignupForm.php
| ... | ... | @@ -36,7 +36,7 @@ class SignupForm extends Model |
| 36 | 36 | { |
| 37 | 37 | return [ |
| 38 | 38 | ['username', 'filter', 'filter' => 'trim'], |
| 39 | - ['username', 'required'], | |
| 39 | + [['username', 'city'], 'required'], | |
| 40 | 40 | ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], |
| 41 | 41 | ['username', 'string', 'min' => 2, 'max' => 255], |
| 42 | 42 | |
| ... | ... | @@ -83,7 +83,9 @@ class SignupForm extends Model |
| 83 | 83 | */ |
| 84 | 84 | public function signup() |
| 85 | 85 | { |
| 86 | - | |
| 86 | + if(empty($this->city)) { | |
| 87 | + $this->city = $this->city_custom; | |
| 88 | + } | |
| 87 | 89 | if ($this->validate()) { |
| 88 | 90 | $user = new User(); |
| 89 | 91 | $user->username = $this->username; | ... | ... |
frontend/views/accounts/blog.php
| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | 'clientOptions' => [ |
| 43 | 43 | 'changeYear' => true, |
| 44 | 44 | 'changeMonth' => true, |
| 45 | + 'yearRange' => "1970:".date('Y'), | |
| 45 | 46 | ], |
| 46 | 47 | ]). |
| 47 | 48 | "</span> |
| ... | ... | @@ -57,6 +58,7 @@ |
| 57 | 58 | 'clientOptions' => [ |
| 58 | 59 | 'changeYear' => true, |
| 59 | 60 | 'changeMonth' => true, |
| 61 | + 'yearRange' => "1970:".date('Y'), | |
| 60 | 62 | ], |
| 61 | 63 | ]) |
| 62 | 64 | ."</span>" | ... | ... |
frontend/views/company/blog-list.php
| 1 | 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 | 11 | use yii\widgets\LinkPager; |
| 5 | 12 | use yii\widgets\ListView; |
| 6 | 13 | |
| 7 | - /* @var $this yii\web\View */ | |
| 8 | 14 | $this->params[ 'company' ] = $company; |
| 9 | 15 | $this->title = 'My Yii Application'; |
| 10 | 16 | ?> |
| ... | ... | @@ -19,6 +25,6 @@ |
| 19 | 25 | </div> |
| 20 | 26 | <div class="navi-buttons-wr style"> |
| 21 | 27 | <?= LinkPager::widget([ |
| 22 | - 'pagination' => $pagination, | |
| 28 | + 'pagination' => $blog->pagination, | |
| 23 | 29 | ]); ?> |
| 24 | 30 | </div> | ... | ... |
frontend/views/layouts/company.php
| ... | ... | @@ -228,12 +228,26 @@ |
| 228 | 228 | </li> |
| 229 | 229 | <li><img src="/images/sidebar-ico/ico-3.png" alt=""/> |
| 230 | 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 | 239 | </div> |
| 233 | 240 | </li> |
| 234 | 241 | <li><img src="/images/sidebar-ico/ico-5.png" alt=""/> |
| 235 | 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 | 251 | </div> |
| 238 | 252 | </li> |
| 239 | 253 | <?= $this->render('/patrial/show_phone_list', [ | ... | ... |
frontend/views/layouts/performer.php
| ... | ... | @@ -258,7 +258,7 @@ |
| 258 | 258 | <span class="sidebar-views-txt">Стоимость работ:<br/></span> |
| 259 | 259 | <?php |
| 260 | 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 | 262 | } else { |
| 263 | 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 | 7 | <?php endif; ?> |
| 5 | -<?php endforeach;?> | |
| 6 | 8 | \ No newline at end of file |
| 9 | +<?php endforeach; ?> | |
| 7 | 10 | \ No newline at end of file | ... | ... |
frontend/views/performer/blog-list.php
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @var ArrayDataProvider $blog | |
| 3 | + * @var ActiveDataProvider $blog | |
| 4 | 4 | * @var Pagination $pagination |
| 5 | 5 | * @var yii\web\View $this |
| 6 | 6 | */ |
| 7 | - use yii\data\ArrayDataProvider; | |
| 7 | + use yii\data\ActiveDataProvider; | |
| 8 | 8 | use yii\data\Pagination; |
| 9 | 9 | use yii\widgets\LinkPager; |
| 10 | 10 | use yii\widgets\ListView; |
| ... | ... | @@ -23,7 +23,6 @@ |
| 23 | 23 | </div> |
| 24 | 24 | <div class="navi-buttons-wr style"> |
| 25 | 25 | <?= LinkPager::widget([ |
| 26 | - 'pagination' => $pagination, | |
| 26 | + 'pagination' => $blog->pagination, | |
| 27 | 27 | ]); ?> |
| 28 | 28 | </div> |
| 29 | - | ... | ... |
frontend/views/search/performer.php
| 1 | 1 | <?php |
| 2 | + /** | |
| 3 | + * @var View $this | |
| 4 | + * @var SearchPerformerForm $model | |
| 5 | + */ | |
| 2 | 6 | |
| 3 | 7 | use common\models\Vacancy; |
| 8 | + use frontend\models\SearchPerformerForm; | |
| 4 | 9 | use kartik\select2\Select2; |
| 5 | 10 | use yii\helpers\ArrayHelper; |
| 6 | 11 | use \yii\helpers\Html; |
| 7 | 12 | use yii\helpers\Url; |
| 8 | 13 | use yii\jui\SliderInput; |
| 9 | 14 | use yii\web\JsExpression; |
| 15 | + use yii\web\View; | |
| 10 | 16 | use yii\widgets\ActiveForm; |
| 11 | 17 | use yii\widgets\LinkSorter; |
| 12 | 18 | use yii\widgets\ListView; |
| 13 | 19 | |
| 14 | - /* @var $this yii\web\View */ | |
| 15 | - | |
| 16 | 20 | $sort_array = $dataProvider->sort->getAttributeOrders(); |
| 17 | 21 | $active_key = array_keys($sort_array)[ 0 ]; |
| 18 | 22 | $active_value = $sort_array[ $active_key ]; | ... | ... |
frontend/views/site/registration.php
| ... | ... | @@ -117,7 +117,7 @@ |
| 117 | 117 | </div> |
| 118 | 118 | <div class="input-blocks-wrapper"> |
| 119 | 119 | <div class="input-blocks"> |
| 120 | - <?= $form->field($model, 'city') | |
| 120 | + <?= $form->field($model, 'city', ['enableClientValidation' => false, 'options' => ['class' => 'required-no-star']]) | |
| 121 | 121 | ->widget(Select2::classname(), [ |
| 122 | 122 | 'options' => [ 'placeholder' => 'Выбор города ...' ], |
| 123 | 123 | 'pluginOptions' => [ | ... | ... |
frontend/web/css/style.css
| ... | ... | @@ -5063,6 +5063,9 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + |
| 5063 | 5063 | left: -15px; |
| 5064 | 5064 | width: 15px; |
| 5065 | 5065 | } |
| 5066 | +.input-blocks .required.required-no-star:before { | |
| 5067 | + display: none; | |
| 5068 | +} | |
| 5066 | 5069 | .has-success label {color: inherit !important;} |
| 5067 | 5070 | .input-blocks .has-success:before { |
| 5068 | 5071 | ... | ... |