예제 #1
0
 public function actionNotification()
 {
     $new_msg = Inbox::find()->unread()->asArray()->all();
     $result = [];
     $result['count'] = count($new_msg);
     $result['items'] = $new_msg;
     echo Json::encode($result);
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Inbox::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['UpdatedInDB' => $this->UpdatedInDB, 'ReceivingDateTime' => $this->ReceivingDateTime, 'Class' => $this->Class, 'ID' => $this->ID]);
     $query->andFilterWhere(['like', 'Text', $this->Text])->andFilterWhere(['like', 'SenderNumber', $this->SenderNumber])->andFilterWhere(['like', 'Coding', $this->Coding])->andFilterWhere(['like', 'UDH', $this->UDH])->andFilterWhere(['like', 'SMSCNumber', $this->SMSCNumber])->andFilterWhere(['like', 'TextDecoded', $this->TextDecoded])->andFilterWhere(['like', 'RecipientID', $this->RecipientID])->andFilterWhere(['like', 'Processed', $this->Processed]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Inbox::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, 'date_received' => $this->date_received, 'read' => $this->read]);
     $query->orFilterWhere(['ilike', 'sender', $this->searchModel])->orFilterWhere(['ilike', 'recipient', $this->searchModel])->orFilterWhere(['ilike', 'message_text', $this->searchModel])->orFilterWhere(['ilike', 'recipient_type', $this->searchModel]);
     return $dataProvider;
 }