public function actionIndex()
 {
     $data['state'] = State::find()->indexBy('s_id')->asArray()->all();
     $data['Faculty'] = Institution::getCurrentFaculty();
     $data['level'] = EducationLevel::find()->indexBy('el_id')->asArray()->all();
     $data['course'] = Course::find()->indexBy('course_id')->asArray()->all();
     return $this->render('index', $data);
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Course::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(['course_id' => $this->course_id]);
     $query->andFilterWhere(['like', 'course_code', $this->course_code])->andFilterWhere(['like', 'course_name', $this->course_name]);
     return $dataProvider;
 }