diff --git a/common/models/BlogSearch.php b/common/models/BlogSearch.php index 15f26c1..8fbb1fc 100644 --- a/common/models/BlogSearch.php +++ b/common/models/BlogSearch.php @@ -130,8 +130,8 @@ $query->andFilterWhere([ 'like', - 'name', - $this->name, + 'LOWER(name)', + mb_strtolower($this->name), ]) ->andFilterWhere([ 'like', diff --git a/frontend/controllers/CompanyController.php b/frontend/controllers/CompanyController.php index a1683e1..ae5c266 100755 --- a/frontend/controllers/CompanyController.php +++ b/frontend/controllers/CompanyController.php @@ -251,29 +251,22 @@ throw new BadRequestHttpException('Пользователь не найден'); } - $query = Blog::find() - ->where([ 'user_id' => $company_id ]); - - $countQuery = clone $query; - - $pagination = new Pagination([ - 'totalCount' => $countQuery->count(), - 'pageSize' => 5, - ]); - - $article = $query->offset($pagination->offset) - ->limit($pagination->limit) - ->with('comments') - ->all(); - - $blog = new ArrayDataProvider([ - 'allModels' => $article, + $blog = new ActiveDataProvider([ + 'query' => $company->getBlog(), + 'pagination' => new Pagination([ + 'pageSize' => 5, + ]), + 'sort' => new Sort([ + 'defaultOrder' => [ + 'date_add' => SORT_DESC, + 'name' => SORT_ASC, + ], + ]), ]); return $this->render('blog-list', [ 'company' => $company, 'blog' => $blog, - 'pagination' => $pagination, ]); } diff --git a/frontend/controllers/PerformerController.php b/frontend/controllers/PerformerController.php index c059059..b5a1c1f 100755 --- a/frontend/controllers/PerformerController.php +++ b/frontend/controllers/PerformerController.php @@ -10,6 +10,7 @@ use yii\data\ActiveDataProvider; use yii\data\ArrayDataProvider; use yii\data\Pagination; + use yii\data\Sort; use yii\helpers\ArrayHelper; use yii\web\BadRequestHttpException; use yii\web\Controller; @@ -217,28 +218,22 @@ throw new BadRequestHttpException('Пользователь не найден'); } - $query = $user->getBlog(); - - $countQuery = clone $query; - - $pagination = new Pagination([ - 'totalCount' => $countQuery->count(), - 'pageSize' => 5, - ]); - - $article = $query->offset($pagination->offset) - ->limit($pagination->limit) - ->with('comments') - ->all(); - - $blog = new ArrayDataProvider([ - 'allModels' => $article, + $blog = new ActiveDataProvider([ + 'query' => $user->getBlog(), + 'pagination' => new Pagination([ + 'pageSize' => 5, + ]), + 'sort' => new Sort([ + 'defaultOrder' => [ + 'date_add' => SORT_DESC, + 'name' => SORT_ASC, + ], + ]), ]); return $this->render('blog-list', [ 'user' => $user, 'blog' => $blog, - 'pagination' => $pagination, ]); } diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 63629f9..fee6be1 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -266,8 +266,6 @@ class SiteController extends Controller if ($user = $model->signup()) { - - $user_info = new UserInfo(); $user_info->load(Yii::$app->request->post(),'SignupForm'); diff --git a/frontend/models/SearchPerformerForm.php b/frontend/models/SearchPerformerForm.php index d90e913..d711463 100644 --- a/frontend/models/SearchPerformerForm.php +++ b/frontend/models/SearchPerformerForm.php @@ -49,7 +49,7 @@ class SearchPerformerForm extends Model 'city' => 'Город', 'specialization' => 'Специализация', 'type' => 'Тип исполнителя', - 'additional_parameters' => 'Тип исполнителя', + 'additional_parameters' => 'Дополнительно', 'working_conditions' => 'Условия работы', 'rating' => 'Рейтинг', 'online' => 'Статус', diff --git a/frontend/models/SignupForm.php b/frontend/models/SignupForm.php index 7638a01..463518e 100755 --- a/frontend/models/SignupForm.php +++ b/frontend/models/SignupForm.php @@ -36,7 +36,7 @@ class SignupForm extends Model { return [ ['username', 'filter', 'filter' => 'trim'], - ['username', 'required'], + [['username', 'city'], 'required'], ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], ['username', 'string', 'min' => 2, 'max' => 255], @@ -83,7 +83,9 @@ class SignupForm extends Model */ public function signup() { - + if(empty($this->city)) { + $this->city = $this->city_custom; + } if ($this->validate()) { $user = new User(); $user->username = $this->username; diff --git a/frontend/views/accounts/blog.php b/frontend/views/accounts/blog.php index 81a5763..ae5a4d3 100644 --- a/frontend/views/accounts/blog.php +++ b/frontend/views/accounts/blog.php @@ -42,6 +42,7 @@ 'clientOptions' => [ 'changeYear' => true, 'changeMonth' => true, + 'yearRange' => "1970:".date('Y'), ], ]). " @@ -57,6 +58,7 @@ 'clientOptions' => [ 'changeYear' => true, 'changeMonth' => true, + 'yearRange' => "1970:".date('Y'), ], ]) ."" diff --git a/frontend/views/company/blog-list.php b/frontend/views/company/blog-list.php index 4085252..4778886 100755 --- a/frontend/views/company/blog-list.php +++ b/frontend/views/company/blog-list.php @@ -1,10 +1,16 @@ params[ 'company' ] = $company; $this->title = 'My Yii Application'; ?> @@ -19,6 +25,6 @@ diff --git a/frontend/views/layouts/company.php b/frontend/views/layouts/company.php index 4695869..b3aa66e 100755 --- a/frontend/views/layouts/company.php +++ b/frontend/views/layouts/company.php @@ -228,12 +228,26 @@
  • - Последний визит:
    params[ 'company' ]->userInfo->lastVisit ?> + Последний визит:
    + params[ 'company' ]->isOnline) { + echo 'Онлайн'; + } else { + echo $this->params[ 'company' ]->userInfo->lastVisitCabinet; + } + ?>
  • - Сотрудники:
    params[ 'company' ]->companyInfo->staff ?> + Сотрудники:
    + params[ 'company' ]->companyInfo->staff)) { + echo $this->params[ 'company' ]->companyInfo->staff; + } else { + echo 0; + } + ?>
  • render('/patrial/show_phone_list', [ diff --git a/frontend/views/layouts/performer.php b/frontend/views/layouts/performer.php index f9c9ec6..8911b1d 100755 --- a/frontend/views/layouts/performer.php +++ b/frontend/views/layouts/performer.php @@ -258,7 +258,7 @@ Стоимость работ:
    params[ 'user' ]->userInfo->salary )) { - echo $this->params[ 'user' ]->userInfo->salary . ' ' . $this->params[ 'user' ]->userInfo->currency->label; + echo 'от '.$this->params[ 'user' ]->userInfo->salary . ' ' . $this->params[ 'user' ]->userInfo->currency->label.' за час'; } else { echo 'Не указано'; } diff --git a/frontend/views/patrial/show_site_list.php b/frontend/views/patrial/show_site_list.php index 3240301..d6ac60d 100644 --- a/frontend/views/patrial/show_site_list.php +++ b/frontend/views/patrial/show_site_list.php @@ -1,5 +1,8 @@ - - -
  • Сайт
  • + + +
  • +
    +
    +
  • - \ No newline at end of file + \ No newline at end of file diff --git a/frontend/views/performer/blog-list.php b/frontend/views/performer/blog-list.php index 00cf6d8..5763160 100755 --- a/frontend/views/performer/blog-list.php +++ b/frontend/views/performer/blog-list.php @@ -1,10 +1,10 @@ - diff --git a/frontend/views/search/performer.php b/frontend/views/search/performer.php index d7dd55b..f40e9ae 100755 --- a/frontend/views/search/performer.php +++ b/frontend/views/search/performer.php @@ -1,18 +1,22 @@ sort->getAttributeOrders(); $active_key = array_keys($sort_array)[ 0 ]; $active_value = $sort_array[ $active_key ]; diff --git a/frontend/views/site/registration.php b/frontend/views/site/registration.php index daf9553..a954158 100644 --- a/frontend/views/site/registration.php +++ b/frontend/views/site/registration.php @@ -117,7 +117,7 @@
    - field($model, 'city') + field($model, 'city', ['enableClientValidation' => false, 'options' => ['class' => 'required-no-star']]) ->widget(Select2::classname(), [ 'options' => [ 'placeholder' => 'Выбор города ...' ], 'pluginOptions' => [ diff --git a/frontend/web/css/style.css b/frontend/web/css/style.css index 01fb4e9..d385abe 100755 --- a/frontend/web/css/style.css +++ b/frontend/web/css/style.css @@ -5063,6 +5063,9 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + left: -15px; width: 15px; } +.input-blocks .required.required-no-star:before { + display: none; +} .has-success label {color: inherit !important;} .input-blocks .has-success:before { -- libgit2 0.21.4