From b5de253e5e21b955e31e721b385cf701b2ae772a Mon Sep 17 00:00:00 2001 From: Yarik Date: Sat, 12 Mar 2016 12:38:36 +0200 Subject: [PATCH] test --- common/models/CustomerSearch.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/SearchController.php | 51 --------------------------------------------------- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/common/models/CustomerSearch.php b/common/models/CustomerSearch.php index c8c60bb..8a7d3d6 100644 --- a/common/models/CustomerSearch.php +++ b/common/models/CustomerSearch.php @@ -97,6 +97,58 @@ 'query' => $query, ]); + $dataProvider->setSort([ + 'defaultOrder' => [ + 'name' => SORT_ASC, + ], + 'attributes' => [ + 'name' => [ + 'asc' => [ + 'company_info.name' => SORT_ASC, + 'firstname' => SORT_ASC, + 'lastname' => SORT_ASC, + ], + 'desc' => [ + 'company_info.name' => SORT_DESC, + 'firstname' => SORT_DESC, + 'lastname' => SORT_DESC, + ], + 'default' => SORT_ASC, + 'label' => 'Название', + ], + 'staff' => [ + 'asc' => [ + 'company_info.staff' => SORT_ASC, + ], + 'desc' => [ + 'company_info.staff' => SORT_DESC, + ], + 'default' => SORT_DESC, + 'label' => 'Количество сотрудников', + ], + 'visit' => [ + 'asc' => [ + 'user_info.date_visit' => SORT_ASC, + ], + 'desc' => [ + 'user_info.date_visit' => SORT_DESC, + ], + 'default' => SORT_DESC, + 'label' => 'Последний визит', + ], + 'city' => [ + 'asc' => [ + 'user_info.city' => SORT_ASC, + ], + 'desc' => [ + 'user_info.city' => SORT_DESC, + ], + 'default' => SORT_ASC, + 'label' => 'Город', + ], + ], + ]); + $this->load($params); if(!$this->validate()) { diff --git a/frontend/controllers/SearchController.php b/frontend/controllers/SearchController.php index cce4259..e4b3acf 100755 --- a/frontend/controllers/SearchController.php +++ b/frontend/controllers/SearchController.php @@ -75,57 +75,6 @@ use common\models\Social; $dataProvider->setPagination([ 'pageSize' => 5, ]); - $dataProvider->setSort([ - 'defaultOrder' => [ - 'name' => SORT_ASC, - ], - 'attributes' => [ - 'name' => [ - 'asc' => [ - 'company_info.name' => SORT_ASC, - 'firstname' => SORT_ASC, - 'lastname' => SORT_ASC, - ], - 'desc' => [ - 'company_info.name' => SORT_DESC, - 'firstname' => SORT_DESC, - 'lastname' => SORT_DESC, - ], - 'default' => SORT_ASC, - 'label' => 'Название', - ], - 'staff' => [ - 'asc' => [ - 'company_info.staff' => SORT_ASC, - ], - 'desc' => [ - 'company_info.staff' => SORT_DESC, - ], - 'default' => SORT_DESC, - 'label' => 'Количество сотрудников', - ], - 'visit' => [ - 'asc' => [ - 'user_info.date_visit' => SORT_ASC, - ], - 'desc' => [ - 'user_info.date_visit' => SORT_DESC, - ], - 'default' => SORT_DESC, - 'label' => 'Последний визит', - ], - 'city' => [ - 'asc' => [ - 'user_info.city' => SORT_ASC, - ], - 'desc' => [ - 'user_info.city' => SORT_DESC, - ], - 'default' => SORT_ASC, - 'label' => 'Город', - ], - ], - ]); $model->load(Yii::$app->request->queryParams); return $this->render('customer', [ 'model' => $model, -- libgit2 0.21.4