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 @@