Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Courses::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(['credit_hours' => $this->credit_hours, 'level' => $this->level, 'dept_ID' => $this->dept_ID]);
     $query->andFilterWhere(['like', 'course_ID', $this->course_ID])->andFilterWhere(['like', 'course_name', $this->course_name]);
     return $dataProvider;
 }
Пример #2
0
 public function getAll()
 {
     return ArrayHelper::map(Courses::find()->all(), 'id', 'courses');
 }
Пример #3
0
 public function actionVideo()
 {
     $courses = Courses::find()->orderBy(['id' => SORT_DESC])->all();
     return $this->render('video', ['courses' => $courses]);
 }