Exemplo n.º 1
0
 public function actionIndex()
 {
     $searchModel = new ContentTypeSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->isAjax && $searchModel->load(Yii::$app->request->get())) {
         Yii::$app->response->format = 'json';
         return ActiveForm::validate($searchModel);
     }
     return $this->render('index', ['dataProvider' => $dataProvider, 'model' => $searchModel]);
 }
 public function searchReport($params)
 {
     if (isset($params['ContentTypeSearch'])) {
         $query = ContentTypeSearch::find()->where(['between', 'last_update', $params['ContentTypeSearch']['startDate'] . ' 00:00:00', $params['ContentTypeSearch']['endDate'] . ' 23:59:59']);
     } else {
         $query = ContentTypeSearch::find()->where(['between', 'last_update', '1970-01-01 00:00:00', '1970-01-01 00:00:00 23:59:59']);
     }
     $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;
 }
 /**
  * Lists all ContentType models.
  * @return mixed
  */
 public function actionIndex()
 {
     $model = new ContentTypeSearch();
     $dataProvider = $model->searchReport(Yii::$app->request->post());
     return $this->render('index', ['dataProvider' => $dataProvider, 'model' => $model]);
 }