예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CmbisKpi::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(['kpi_id' => $this->kpi_id, 'kpi_percent_target' => $this->kpi_percent_target, 'kpi_group' => $this->kpi_group]);
     $query->andFilterWhere(['like', 'kpi_name', $this->kpi_name])->andFilterWhere(['like', 'kpi_b_year', $this->kpi_b_year])->andFilterWhere(['like', 'kpi_function', $this->kpi_function])->andFilterWhere(['like', 'kpi_desc', $this->kpi_desc]);
     return $dataProvider;
 }
예제 #2
0
 public function actionKpilist()
 {
     $Kpi = CmbisKpi::find()->orderBy('kpi_id')->all();
     $Kpilist = \yii\helpers\ArrayHelper::map($Kpi, 'kpi_id', 'kpi_name');
     $CmbisKpi = new CmbisKpi();
     $post = Yii::$app->request->post();
     $kpi_id = null;
     if (!empty($post)) {
         $kpi_id = $post['CmbisKpi']['kpi_id'];
     }
     return $this->render('/kpi/kpilist', ['Kpilist' => $Kpilist, 'Kpi' => $CmbisKpi, 'kpi_id' => $kpi_id]);
 }