/**
  * 
  * @param type $params
  * @return \yii\data\ActiveDataProvider
  */
 public function search($params = [])
 {
     $query = ServiceUser::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => WidgetPageSize::getPageSize()]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     return $dataProvider;
 }
예제 #2
0
 /**
  * Creating model search query.
  * @return ActiveDataProvider|\yii\data\DataProviderInterface
  */
 public function search($params = [])
 {
     $query = Advert::find()->with('owner.profile');
     $dataProvider = new \roman444uk\yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => \roman444uk\yii\widgets\WidgetPageSize::getPageSize()]]);
     if ($params && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $this->buildQuery($query, $params);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Creating model search query.
  * @return ActiveDataProvider|\yii\data\DataProviderInterface
  */
 public function search($params = [])
 {
     $query = City::find();
     $dataProvider = new \roman444uk\yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => \roman444uk\yii\widgets\WidgetPageSize::getPageSize()]]);
     if ($params && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     if (!empty($params['name'])) {
         $ids = [];
         foreach ((new \yii\sphinx\Query())->from(self::tableName())->match($params['content'])->all() as $row) {
             array_push($ids, $row['id']);
         }
         $query->andWhere([self::tableName() . '.id' => $ids]);
     }
     $query->orderBy(self::tableName() . '.created_at desc');
     return $dataProvider;
 }
예제 #4
0
 /**
  * 
  * 
  * @param type $params
  * 
  * @return \yii\db\ActiveDataProvider instance
  */
 public function search($params = [])
 {
     $query = User::find();
     $query->with(['roles', 'serviceIdentities']);
     if (!Yii::$app->user->isSuperadmin) {
         $query->where(['superadmin' => 0]);
     }
     $dataProvider = new \roman444uk\yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => WidgetPageSize::getPageSize(), 'defaultPageLast' => true], 'sort' => ['defaultOrder' => ['id' => SORT_ASC]]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     if ($this->gridRoleSearch) {
         $query->joinWith(['roles']);
     }
     $query->andFilterWhere(['id' => $this->id, 'superadmin' => $this->superadmin, 'status' => $this->status, Yii::$app->getModule('users')->auth_item_table . '.name' => $this->gridRoleSearch, 'registration_ip' => $this->registration_ip, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'email_confirmed' => $this->email_confirmed]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
예제 #5
0
 /**
  * Creating model search query.
  * @return ActiveDataProvider|\yii\data\DataProviderInterface
  */
 public function search($params = [])
 {
     $query = Advert::find()->with('owner.profile', 'files');
     // query city, bookmarks and likes
     $tableAdvert = self::tableName();
     $tableBookmark = Yii::$app->getModule('bookmarks')->tableBookmark;
     $query->select("{$tableAdvert}.*, ({$tableAdvert}.id = {$tableBookmark}.target_id) as bookmarked, city.name as cityName");
     $query->join('left join', $tableBookmark, "{$tableBookmark}.target_id = {$tableAdvert}.id");
     $query->join('left join', 'city', 'advert.city_id = city.id');
     // creating data provider
     $dataProvider = new \roman444uk\yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => \roman444uk\yii\widgets\WidgetPageSize::getPageSize('advert-list')]]);
     if ($params && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $this->buildQuery($query, $params);
     if ($this->search_bookmarks) {
         $query->andWhere(["{$tableAdvert}.id" => Yii::$app->getModule('bookmarks')->manager->getIdList($this->bookmark_user_id, ['Advert'], true)]);
     }
     return $dataProvider;
 }