Exemplo n.º 1
0
 /**
  * Lists all SysUser models.
  * @return mixed
  */
 public function actionIndex()
 {
     $query = SysUser::find();
     $rules = \yii\helpers\Json::decode(Yii::$app->request->get('rules'));
     if ($rules) {
         $translator = new Translator($rules);
         $query->andWhere($translator->where())->addParams($translator->params());
     }
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]);
     return $this->render('index', ['dataProvider' => $dataProvider, 'rules' => $rules]);
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SysUser::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'temp_pswd_flag' => $this->temp_pswd_flag, 'last_pswd_reset' => $this->last_pswd_reset, 'active' => $this->active, 'is_account' => $this->is_account, 'deleted' => $this->deleted, 'creation_date' => $this->creation_date, 'last_update' => $this->last_update, 'idsys_creator' => $this->idsys_creator, 'idsys_updater' => $this->idsys_updater]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'next_pswd_reset', $this->next_pswd_reset])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'activation_token', $this->activation_token])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token]);
     return $dataProvider;
 }