Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function search()
- {
- $criteria = new CDbCriteria;
- $titlepagesField = 'titlepages_' . Yii::app()->language;
- $criteria->compare($this->getTableAlias() . '.' . $titlepagesField, $this->$titlepagesField, true);
- $descriptionaboutField = 'descriptionabout_' . Yii::app()->language;
- $criteria->compare($this->getTableAlias() . '.' . $descriptionaboutField, $this->$descriptionaboutField, true);
- $criteria->compare($this->getTableAlias() . '.id', $this->id, true);
- $criteria->compare($this->getTableAlias() . '.username', $this->username, true);
- $criteria->compare($this->getTableAlias() . '.email', $this->email, true);
- $criteria->compare($this->getTableAlias() . '.phone', $this->phone, true);
- $criteria->compare($this->getTableAlias() . '.type', $this->type);
- $criteria->compare($this->getTableAlias() . '.role', $this->role);
- $criteria->compare($this->getTableAlias() . '.balance', $this->balance, true);
- $criteria->compare($this->getTableAlias() . '.is_use_api', $this->is_use_api);
- $criteria->compare($this->getTableAlias() . '.agency_name', $this->agency_name);
- $criteria->compare($this->getTableAlias() . '.city', $this->city);
- $criteria->compare($this->getTableAlias() . '.useVkontakte', $this->useVkontakte);
- $criteria->compare($this->getTableAlias() . '.useTwitter', $this->useTwitter);
- if ($this->date_created)
- $criteria->compare($this->getTableAlias() . '.date_created', $this->date_created, true);
- if ($this->active != 'all')
- $criteria->compare('active', $this->active);
- if (issetModule('tariffPlans') && issetModule('paidservices') && Yii::app()->user->checkAccess('tariff_plans_admin')) {
- //$criteria->with = array('userTariffPlan');
- $criteria->with = array(
- 'userTariffPlanAll' => array(
- 'select' => '{{users_tariff_plans}}.*',
- 'joinType' => 'LEFT OUTER JOIN',
- ),
- );
- $criteria->together = true;
- return new CustomActiveDataProvider($this, array(
- 'criteria' => $criteria,
- 'sort' => array(
- 'attributes' => array(
- 'id',
- 'active',
- 'type',
- 'is_use_api',
- 'useVkontakte',
- 'useTwitter',
- 'role',
- 'username',
- 'agency_name',
- 'city',
- 'phone',
- 'email',
- 'searchWithTariffPlan' => array(
- 'asc' => 'userTariffPlanAll.date_end',
- 'desc' => 'userTariffPlanAll.date_end DESC',
- ),
- 'date_created',
- 'balance',
- ),
- 'defaultOrder' => $this->getTableAlias() . '.id DESC'
- ),
- 'pagination' => array(
- 'pageSize' => param('adminPaginationPageSize', 20),
- ),
- ));
- }
- return new CustomActiveDataProvider($this, array(
- 'criteria' => $criteria,
- 'sort' => array('defaultOrder' => $this->getTableAlias() . '.id DESC'),
- 'pagination' => array(
- 'pageSize' => param('adminPaginationPageSize', 20),
- ),
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement