Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::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;
     }
     if ($this->created_at_from_date != '') {
         $this->created_at_from = DDateTimeHelper::DateToUnix($this->created_at_from_date, '00:00:00');
     }
     if ($this->created_at_to_date != '') {
         $this->created_at_to = DDateTimeHelper::DateToUnix($this->created_at_to_date, '23:59:59');
     }
     //var_dump($this->created_at_to);die;
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'birthday' => $this->birthday, 'deposit' => $this->deposit, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'nickname', $this->nickname])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name]);
     if ($this->created_at_from < $this->created_at_to && $this->created_at_to != 0) {
         $query->andFilterWhere(['between', 'created_at', $this->created_at_from, $this->created_at_to]);
     } elseif ($this->created_at_from != 0 && $this->created_at_to == 0) {
         $query->andFilterWhere(['>=', 'created_at', $this->created_at_from]);
     } elseif ($this->created_at_from == 0 && $this->created_at_to != 0) {
         $query->andFilterWhere(['<=', 'created_at', $this->created_at_to]);
     }
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function beforeValidate()
 {
     if ($this->start_date != '') {
         $this->start_at = DDateTimeHelper::DateToUnix($this->start_date);
     }
     return parent::beforeValidate();
 }
Ejemplo n.º 3
0
 public function beforeValidate()
 {
     $this->price = $this->setZeroInPrices($this->price);
     $this->start = DDateTimeHelper::DateToUnix($this->date_from, $this->time_from);
     $this->end = DDateTimeHelper::DateToUnix($this->date_to, $this->time_to);
     //echo'<pre>';print_r($this->price_md_h);echo'</pre>';die;
     return parent::beforeValidate();
 }
Ejemplo n.º 4
0
 public function beforeValidate()
 {
     $this->password = DStringHelper::generate_password(7);
     $date_str = $this->birth_day . '-' . $this->birth_month . '-' . $this->birth_year;
     //13-07-2015
     $this->birthday = DDateTimeHelper::DateToUnix($date_str);
     //		$date_str = '02-01-1996';
     //		echo'<pre>';print_r($date_str);echo'</pre>';//die;
     //		echo'<pre>';print_r($this->birthday);echo'</pre>';//die;
     //		$this->birthday = DDateTimeHelper::DateToUnix($date_str, '', 2);
     //		echo'<pre>';print_r($this->birthday);echo'</pre>';//die;
     //		echo'<pre>';print_r(date('d-m-y', $this->birthday));echo'</pre>';die;
     return parent::beforeValidate();
 }