示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = FeedbackModel::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]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Feedback::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, 'getdata' => $this->getdata, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'message', $this->message]);
     return $dataProvider;
 }
示例#3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Feedback::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, 'id_usuario' => $this->id_usuario, 'id_usuario_destino' => $this->id_usuario_destino, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'mensaje', $this->mensaje])->andFilterWhere(['like', 'img', $this->img]);
     return $dataProvider;
 }
示例#4
0
 public function actionAnswer($id)
 {
     if (!Yii::$app->user->can('admin')) {
         Yii::$app->session->setFlash('error', 'Нет доступа!');
         return $this->redirect('/');
     }
     $model = Feedback::find()->where(['id' => $id])->one();
     $model->status = 2;
     $model->update_at = time();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->mailer->compose('answerFeedback', ['model' => $model])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' (отправлено роботом)'])->setTo($model->email)->setSubject('Ответ на ваше обращение')->send();
         Yii::$app->session->setFlash('success', 'Ответ дан.');
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('answer', ['model' => $model]);
     }
 }
示例#5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     if (Yii::$app->user->can('admin')) {
         $query = Feedback::find();
     } else {
         $query = Feedback::find()->where(['user_id' => Yii::$app->user->id]);
     }
     $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, 'user_id' => $this->user_id, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'short_description', $this->short_description])->andFilterWhere(['like', 'full_description', $this->full_description])->andFilterWhere(['like', 'category', $this->category])->andFilterWhere(['like', 'answer', $this->answer])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
示例#6
0
 public function actionAll()
 {
     $dataProvider = new ActiveDataProvider(['query' => Feedback::find(), 'pagination' => ['pageSize' => 3]]);
     return $this->render('list', ['dataProvider' => $dataProvider]);
 }
示例#7
0
 static function roughFeedback()
 {
     $feedbacks = Feedback::find()->where(['status' => 0])->orWhere(['status' => 1])->all();
     return sizeof($feedbacks);
 }
示例#8
0
 /**
  * Lists all Feedback models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Feedback::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }