public function actionStudentprofile() { $session = Yii::$app->session; if ($session->has('accountTypeID')) { $accountTypeID = (int) $session->get('accountTypeID'); if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_SUPERUSER || $accountTypeID == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR || $accountTypeID == DefaultForm::ACCOUNT_TYPE_REGISTRAR || $accountTypeID == DefaultForm::ACCOUNT_TYPE_BACK_OFFICE || $accountTypeID == DefaultForm::ACCOUNT_TYPE_INSTRUCTOR) { if (isset($_GET['studentID'])) { $studentID = $_GET['studentID']; $_AccountStudentDetailsForm = new AccountStudentDetailsForm(); $studentData = $_AccountStudentDetailsForm->getStudentDataByID($studentID); if ($studentData != false) { $_Ref_CountriesForm = new Ref_CountriesForm(); $countryName = $_Ref_CountriesForm->getCountryNameByCountryCode($studentData['CountryCode']); $_Ref_LocationForm = new Ref_LocationForm(); $location = $_Ref_LocationForm->getLocationByCityID($studentData['CityID']); if ($studentData['ProfilePhotoFilename'] == '' || is_null($studentData['ProfilePhotoFilename']) || empty($studentData['ProfilePhotoFilename'])) { if ($studentData['Gender'] == 2 || $studentData['Gender'] == '2') { $studentProfilePhoto = 'ProfilePhotoDefaultFemale.png'; } else { $studentProfilePhoto = 'ProfilePhotoDefaultMale.png'; } } else { $studentProfilePhoto = $studentData['ProfilePhotoFilename']; } $_Ref_SpecializationsForm = new Ref_SpecializationsForm(); $specialization1Name = $_Ref_SpecializationsForm->getSpecializationNameByID($studentData['SpecializationID1']); if ($specialization1Name == "") { $specialization1Name = "None"; } $specialization2Name = $_Ref_SpecializationsForm->getSpecializationNameByID($studentData['SpecializationID2']); if ($specialization2Name == "") { $specialization2Name = "None"; } $_Ref_CoursesForm = new Ref_CoursesForm(); $course1Name = $_Ref_CoursesForm->getCourseNameByID($studentData['SpecializationID1']); if ($course1Name == "") { $course1Name = "None"; } $course2Name = $_Ref_CoursesForm->getCourseNameByID($studentData['SpecializationID2']); if ($course2Name == "") { $course2Name = "None"; } $_AccountStudentsForm = new AccountStudentsForm(); $studentAccess = $_AccountStudentsForm->getStudentUsernameAndStatusByID($studentID); $studentUsername = $studentAccess['Username']; if ($studentUsername == '') { $studentUsername = '******'; } $studentStatus = (int) $studentAccess['Status']; if ($studentStatus == DefaultForm::ACCOUNT_STATUS_STUDENT_INACTIVE) { $studentStatus = 'Inactive'; } else { if ($studentStatus == DefaultForm::ACCOUNT_STATUS_STUDENT_ACTIVE) { $studentStatus = 'Active'; } else { if ($studentStatus == DefaultForm::ACCOUNT_STATUS_STUDENT_DEACTIVATED) { $studentStatus = 'Deactivated'; } else { if ($studentStatus == DefaultForm::ACCOUNT_STATUS_STUDENT_LOCKED_BY_SELF) { $studentStatus = 'Locked By Self'; } else { if ($studentStatus == DefaultForm::ACCOUNT_STATUS_STUDENT_LOCKED_BY_THE_ADMINISTRATOR) { $studentStatus = 'Locked By The Administrator'; } else { if ($studentStatus == DefaultForm::ACCOUNT_STATUS_STUDENT_DELETED) { $studentStatus = 'Deleted'; } else { $studentStatus = 'Undefined'; } } } } } } $_PaymentsForm = new PaymentsForm(); $payments = $_PaymentsForm->getPaymentsByID($studentID); $_NotesForm = new NotesForm(); $notesOnSubscription = $_NotesForm->getNotesOnSubscriptionByID($studentID); $notesOnBehavior = $_NotesForm->getNotesOnBehaviorByID($studentID); return $this->render('studentprofile', array('studentData' => $studentData, 'countryName' => $countryName, 'location' => $location, 'studentProfilePhoto' => $studentProfilePhoto, 'specialization1Name' => $specialization1Name, 'specialization2Name' => $specialization2Name, 'course1Name' => $course1Name, 'course2Name' => $course2Name, 'username' => $studentUsername, 'status' => $studentStatus, 'payments' => $payments, 'notesOnSubscription' => $notesOnSubscription, 'notesOnBehavior' => $notesOnBehavior)); } else { return $this->render('error'); } } else { return $this->render('error'); } } else { return DefaultController::redirectToLogOut(); } } else { return DefaultController::redirectToLogOut(); } }