예제 #1
0
 public function search($params)
 {
     $query = Feedback::find();
     //		$query->joinWith(['parent']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => Yii::$app->request->cookies->getValue('_grid_page_size', 20)], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['feedback.id' => $this->id, 'feedback.status' => $this->status, 'feedback.parent_id' => $this->parent_id, 'feedback.admin_comment' => $this->admin_comment, 'feedback.created_at' => $this->created_at, 'feedback.updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'feedback.name', $this->name])->andFilterWhere(['like', 'feedback.title', $this->title]);
     return $dataProvider;
 }
 /**
  * Show list of approved feedbacks
  *
  * @return string
  */
 public function actionIndex()
 {
     $provider = new ActiveDataProvider(['query' => Feedback::find()->andWhere(['status' => Feedback::STATUS_APPROVED, 'parent_id' => null])->orderBy('id DESC'), 'pagination' => ['pageSize' => 10]]);
     return $this->render('index', compact('provider'));
 }