/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ContentType::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(['tct_id' => $this->tct_id, 'tcl_media_type' => $this->tcl_media_type, 'tcl_priority' => $this->tcl_priority, 'tcl_support' => $this->tcl_support, 'tcl_counter' => $this->tcl_counter, 'first_update' => $this->first_update, 'last_update' => $this->last_update, 'tcl_support2' => $this->tcl_support2]); $query->andFilterWhere(['like', 'tcl_name', $this->tcl_name])->andFilterWhere(['like', 'first_user', $this->first_user])->andFilterWhere(['like', 'first_ip', $this->first_ip])->andFilterWhere(['like', 'last_user', $this->last_user])->andFilterWhere(['like', 'last_ip', $this->last_ip]); return $dataProvider; }
public function actionIndex() { error_reporting(0); $model = new ContentType(); if (!isset($_POST['ContentType'])) { $model->startDate = date('Y-m-d'); $model->endDate = date('Y-m-d'); // echo "makan"; die(); $model->load(Yii::$app->request->post()); } else { $model->load(Yii::$app->request->post()); echo "<pre>"; print Yii::$app->request->post(); echo "makan 2"; die; } if (isset($_POST['ContentType'])) { $dataProvider = $this->searchReport(Yii::$app->request->post()); } else { $dataProvider = $this->searchReport(Yii::$app->request->queryParams); } return $this->render('index', ['dataProvider' => $dataProvider, 'model' => $model]); }