public function getGradeLevelName($id) { $level = GradeLevel::findOne($id); return $level['name']; }
use yii\bootstrap\Dropdown; use app\models\Tuition; use app\models\GradeLevel; use app\models\SiblingDiscount; $sbm = new SiblingDiscount(); $sbd = SiblingDiscount::find()->all(); if (!empty($array)) { $enrollment_float = $array[0]['enrollment']; $admission_float = $array[0]['admission']; $tuition_fee_float = $array[0]['tuition_fee']; $misc_fee_float = $array[0]['misc_fee']; $ancillary_float = $array[0]['ancillary']; $monthly_float = $array[0]['monthly']; $yearly_float = $array[0]['yearly']; $books_float = $array[0]['books']; $grade_level = GradeLevel::findOne($array[0]['grade_level_id'])['name']; $enrollment = number_format($array[0]['enrollment'], 2); $admission = number_format($array[0]['admission'], 2); $tuition_fee = number_format($array[0]['tuition_fee'], 2); $misc_fee = number_format($array[0]['misc_fee'], 2); $ancillary = number_format($array[0]['ancillary'], 2); $monthly = number_format($array[0]['monthly'], 2); $yearly = number_format($array[0]['yearly'], 2); $books = number_format($array[0]['books'], 2); } else { $grade_level = 0; $enrollment = 0; $admission = 0; $tuition_fee = 0; $misc_fee = 0; $ancillary = 0;
/** * Finds the GradeLevel model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return GradeLevel the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = GradeLevel::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }