예제 #1
0
 protected function findModel($id)
 {
     if (($model = Emails::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Emails::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'receiver_name', $this->receiver_name])->andFilterWhere(['like', 'receiver_email', $this->receiver_email])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'attachment', $this->attachment]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Emails::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(['email_id' => $this->email_id]);
     $query->andFilterWhere(['like', 'receiver_name', $this->receiver_name])->andFilterWhere(['like', 'receiver_email', $this->receiver_email])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'attachment', $this->attachment]);
     return $dataProvider;
 }
예제 #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Emails::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(['IdEmail' => $this->IdEmail]);
     $query->andFilterWhere(['like', 'senderName', $this->senderName])->andFilterWhere(['like', 'senderEmail', $this->senderEmail])->andFilterWhere(['like', 'Subject', $this->Subject])->andFilterWhere(['like', 'Content', $this->Content])->andFilterWhere(['like', 'Note', $this->Note]);
     return $dataProvider;
 }
예제 #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $emp_id = null)
 {
     if ($emp_id == null) {
         $query = Emails::find();
     } else {
         $query = Emails::find()->where(['employee_id' => $emp_id]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_ASC]]]);
     $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, 'employee_id' => $this->employee_id, 'status' => $this->status]);
     //$query->andFilterWhere(['like', 'email_address', $this->email_address]);
     return $dataProvider;
 }
예제 #6
0
 /**
  * @return array|\yii\db\ActiveRecord[]
  */
 public static function arrayEmails()
 {
     return Emails::find()->select('email_address as value, email_address as label')->where("email_address > '' AND status = 1")->orderBy('email_address')->asArray()->all();
 }