/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Grades::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([ 'grade_id' => $this->grade_id, 'grade_scholar_id' => $this->grade_scholar_id, ]); $query->andFilterWhere(['like', 'grade_school_year', $this->grade_school_year]) ->andFilterWhere(['like', 'grade_school_term', $this->grade_school_term]) ->andFilterWhere(['like', 'grade_value', $this->grade_value]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Grades::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('gradeScholar'); $query->andFilterWhere([ 'grade_id' => $this->grade_id, 'grade_schoolYear' => $this->grade_schoolYear, 'grade_Term' => $this->grade_Term, 'grade_scholar_id' => $this->grade_scholar_id, ]); $query->andFilterWhere(['like', 'scholars.scholar_lastName', $this->grade_scholar_lastName]) ->andFilterWhere(['like', 'scholars.scholar_firstName', $this->grade_scholar_firstName]) ->andFilterWhere(['like', 'scholars.scholar_middleName', $this->grade_scholar_middleName]) ->andFilterWhere(['like', 'grade_value', $this->grade_value]) ->andFilterWhere(['like', 'grade_grade_form', $this->grade_grade_form]); return $dataProvider; }
/** * Updates an existing Grades model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate() { $username = Yii::$app->user->identity->username; $users = User::find()->all(); $grades = Grades::find()->all(); $model = new Grades(); $tuitions = Tuitionfees::find()->all(); foreach ($users as $user) { foreach ($tuitions as $tuition) { if ($user->username == $username && $user->id == $tuition->tuitionfee_id) { $id = $tuition->tuitionfee_id; $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { $fileName = $model->tuitionfee_id . "regform"; $model->file = UploadedFile::getInstance($model, 'file'); if ($model->file != null) { $model->file->saveAs('uploads/' . $fileName . '.' . $model->file->extension); $model->tuitionfee_registrationForm = 'uploads/' . $fileName . '.' . $model->file->extension; } $model->save(); return $this->redirect(['view', 'id' => $model->tuitionfee_id]); return $this->redirect(['view', 'id' => $model->tuitionfee_id]); } else { return $this->render('update', ['model' => $model]); } } } } }
public function actionIndex() { $grades = Grades::find()->all(); $schools = Schools::find()->all(); $users = User::find()->all(); $scholars = Scholars::find()->all(); $tuitions = Tuition::find()->all(); return $this->render('index',array('users'=>$users,'scholars'=>$scholars,'schools'=>$schools,'grades'=>$grades,'tuition'=>$tuitions)); }
/** * Lists all Compile models. * @return mixed */ public function actionIndex() { $schools = Schools::find()->all(); $users = User::find()->all(); $scholars = Scholars::find()->all(); $allowances = Allowance::find()->all(); $benefits = Benefit::find()->all(); $grades = Grades::find()->all(); return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'allowances' => $allowances, 'benefits' => $benefits, 'grades' => $grades)); }
/** * Finds the Grades model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Grades the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Grades::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getGrades() { return $this->hasMany(Grades::className(), ['grade_scholar_id' => 'scholar_id']); }
/** * Updates an existing Tuition model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate() { $username=Yii::$app->user->identity->username; $users= User::find()->all(); $grades = Grades::find()->all(); $tuitions = Tuition::find()->all(); $model = new Grades(); foreach($users as $user){ foreach($tuitions as $tuition){ if($user->username==$username&&$user->id==$tuition->tuitionfee_scholar_id){ $id=$tuition->tuitionfee_scholar_id; $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->grade_id]); } else { return $this->render('update', [ 'model' => $model, ]); } } } } }
/** * @return \yii\db\ActiveQuery */ public function getCompileGrade() { return $this->hasOne(Grades::className(), ['grade_id' => 'compile_grade_id']); }
/* @var $this yii\web\View */ /* @var $searchModel frontend\models\GradeSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->params['breadcrumbs'][] = $this->title; ?> <div class="grades-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo'<table width=100% border=2><tr><td><h3><center>Grade Subject</center></h3></td><td><h3><center>Grade Value</center></h3></td><td><h3><center>No.of Units</center></h3></td><td><h3><center>School Year</center></h3></td><td><h3><center>Term</center></h3></td></tr>'; $users = User::find()->all(); $grades = Grades::find()->all(); $scholars = Scholars::find()->all(); $gpa1=0;$gpa2=0; $username=Yii::$app->user->identity->username; foreach($users as $ctr){ if($ctr->username==$username){ foreach($scholars as $scholarctr){ foreach($grades as $grade){ if($scholarctr->scholar_user_id==$ctr->id && $grade->grade_scholar_id==$scholarctr->scholar_user_id){ $past=$grade; echo'<tr><td><h4><center>'.$past->grade_subject.'<br></center></h4></td><td><h4><center>'.$past->grade_value.'</center></h4></td><td><h4><center>'.$past->grade_units.'</center></h4></td><td><h4><center>'.$past->grade_schoolYear.'</center></h4></td><td><h4><center>'.$past->grade_Term.'</center></h4></td></tr>'; }