/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LearningArea::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, 'grade_level_id' => $this->grade_level_id, 'subject_id' => $this->subject_id, 'sequence' => $this->sequence, 'semester' => $this->semester, 'revision' => $this->revision]); return $dataProvider; }
public function actionLists($id) { $subjects = LearningArea::find()->where(['grade_level_id' => $id])->orderBy('sequence', SORT_ASC)->all(); $count = count($subjects); if ($subjects > 0) { for ($x = 0; $x < $count; $x++) { //$name = Subject::find()->where(['id' => $subject->id])->all(); echo "<option value='" . $subjects[$x]['subject_id'] . "'>" . $subjects[$x]->subject->subject_name . "</option>"; } } else { echo "<option></option>"; } }