コード例 #1
0
 /**
  * Lists all Output models.
  * @return mixed
  */
 public function actionIndex()
 {
     //$searchModel = new OutputSearch();
     //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $dataProvider = new ActiveDataProvider(['query' => Output::find()->where(['thang' => Yii::$app->session['tahun'], 'kdgiat' => Yii::$app->session['upt']])->orderBy('kdoutput ASC'), 'pagination' => ['pageSize' => 20]]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
コード例 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Output::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, 'thang' => $this->thang, 'kdsatker' => $this->kdsatker, 'kddept' => $this->kddept, 'kdunit' => $this->kdunit, 'kdprogram' => $this->kdprogram, 'kdgiat' => $this->kdgiat, 'kdoutput' => $this->kdoutput, 'vol' => $this->vol]);
     return $dataProvider;
 }