/** * Lists all Compile models. * @return mixed */ public function actionIndex() { $schools = School::find()->all(); $users = User::find()->all(); $scholars = Scholar::find()->all(); $allowances = Allowance::find()->all(); $grades = Grade::find()->all(); return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'allowances' => $allowances, 'grades' => $grades)); }
public function actionIndex() { $grades = Grade::find()->all(); $schools = School::find()->all(); $users = User::find()->all(); $scholars = Scholar::find()->all(); $tuitions = Tuition::find()->all(); return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'grades' => $grades, 'tuition' => $tuitions)); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Grade::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->joinWith('scholarScholar'); $query->joinWith('subjectSubject'); $query->joinWith('subjectSubject'); $query->andFilterWhere(['grade_id' => $this->grade_id, 'subject_subject_id' => $this->subject_subject_id, 'subject_scholar_scholar_id' => $this->subject_scholar_scholar_id, 'subject_scholar_school_school_id' => $this->subject_scholar_school_school_id, 'grade_school_year_start' => $this->grade_school_year_start, 'grade_school_year_end' => $this->grade_school_year_end]); $query->andFilterWhere(['like', 'grade_raw_grade', $this->grade_raw_grade])->andFilterWhere(['like', 'grade_approval_status', $this->grade_approval_status])->andFilterWhere(['like', 'grade_approved_by', $this->grade_approved_by])->andFilterWhere(['like', 'scholar.scholar_first_name', $this->firstName])->andFilterWhere(['like', 'scholar.scholar_middle_name', $this->middleName])->andFilterWhere(['like', 'scholar.scholar_last_name', $this->lastName])->andFilterWhere(['like', 'subject.subject_name', $this->subjectName])->andFilterWhere(['like', 'subject.subject_term', $this->subjectTerm])->andFilterWhere(['like', 'subject.subject_units', $this->subjectUnits])->andFilterWhere(['like', 'subject.subject_taken_status', $this->takenStatus]); return $dataProvider; }
$form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'subject_term')->textInput(); ?> <?php echo $form->field($model, 'subject_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'subject_units')->textInput(['maxlength' => true]); ?> <?php $modelCustomers = Grade::find()->all(); foreach ($modelCustomers as $modelCustomer) { if ($modelCustomer->subject_subject_id == $model->subject_id) { $test = $form->field($modelCustomer, 'grade_raw_grade')->textInput(['maxlength' => true]); } } ?> <?php echo $test; ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
/** * Updates an existing Subject model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $model2s = Grade::find()->all(); foreach ($model2s as $model2) { if ($model->subject_id == $model2->subject_subject_id) { if ($model2->grade_approval_status == 'Not Approved') { if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model2->load(Yii::$app->request->post()) && $model2->save()) { return $this->redirect(['index', 'id' => $model2->grade_id]); } return $this->redirect(['index', 'id' => $model->subject_id]); } else { return $this->render('update', ['model' => $model]); } } else { \Yii::$app->getSession()->setFlash('error', 'The record has already been reviewed by the SM Foundation'); return $this->redirect(['index', 'id' => $model->subject_id]); } } } }