public function actionLogin() { $session = Yii::$app->session; if ($session->has('accountTypeID')) { $accountTypeID = $session->get('accountTypeID'); if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_SUPERUSER) { $url = Yii::$app->params['siteHostBackendUrl'] . 'home/superuser'; return DefaultController::redirectToUrl($url); } else { if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR) { $url = Yii::$app->params['siteHostBackendUrl'] . 'home/administrator'; return DefaultController::redirectToUrl($url); } else { if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_REGISTRAR) { $url = Yii::$app->params['siteHostBackendUrl'] . 'home/registrar'; return DefaultController::redirectToUrl($url); } else { if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_BACK_OFFICE) { $url = Yii::$app->params['siteHostBackendUrl'] . 'home/backoffice'; return DefaultController::redirectToUrl($url); } else { if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_INSTRUCTOR) { $url = Yii::$app->params['siteHostBackendUrl'] . 'home/instructor'; return DefaultController::redirectToUrl($url); } else { if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_SECURITY) { $url = Yii::$app->params['siteHostBackendUrl'] . 'home/security'; return DefaultController::redirectToUrl($url); } else { if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_STUDENT) { return DefaultController::redirectToLogOut(); } } } } } } } } else { return $this->render('login'); } }
public function actionAdminprofile() { $session = Yii::$app->session; $url = Yii::$app->params['siteHostBackendUrl'] . 'home/error'; if ($session->has('accountTypeID')) { $accountTypeID = (int) $session->get('accountTypeID'); if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_SUPERUSER || $accountTypeID == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR) { if (isset($_GET)) { if (isset($_GET['adminID'])) { $adminID = $_GET['adminID']; $_AccountAdminDetailsForm = new AccountAdminDetailsForm(); $adminDetails = $_AccountAdminDetailsForm->getAdminDetailsByID($adminID); $_Ref_CountriesForm = new Ref_CountriesForm(); $countryName = $_Ref_CountriesForm->getCountryNameByCountryCode($adminDetails['CountryCode']); $_Ref_LocationForm = new Ref_LocationForm(); $location = $_Ref_LocationForm->getLocationByCityID($adminDetails['CityID']); if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR && $adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR || $accountTypeID == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR && $adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_SUPERUSER) { return DefaultController::redirectToUrl($url); } else { if ($adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_SUPERUSER || $adminDetails['AccountTypeID'] == '1') { $adminAccountType = 'Superuser'; } else { if ($adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR || $adminDetails['AccountTypeID'] == '2') { $adminAccountType = 'Administrator'; } else { if ($adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_REGISTRAR || $adminDetails['AccountTypeID'] == '3') { $adminAccountType = 'Registrar'; } else { if ($adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_BACK_OFFICE || $adminDetails['AccountTypeID'] == '4') { $adminAccountType = 'Back Office'; } else { if ($adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_INSTRUCTOR || $adminDetails['AccountTypeID'] == '5') { $adminAccountType = 'Instructor'; } else { if ($adminDetails['AccountTypeID'] == DefaultForm::ACCOUNT_TYPE_SECURITY || $adminDetails['AccountTypeID'] == '6') { $adminAccountType = 'Security'; } else { $adminAccountType = 'Undefined'; } } } } } } $adminStatus = (int) $adminDetails['Status']; if ($adminStatus == DefaultForm::ACCOUNT_STATUS_ADMIN_INACTIVE) { $adminStatus = 'Inactive'; } else { if ($adminStatus == DefaultForm::ACCOUNT_STATUS_ADMIN_ACTIVE) { $adminStatus = 'Active'; } else { if ($adminStatus == DefaultForm::ACCOUNT_STATUS_ADMIN_DEACTIVATED) { $adminStatus = 'Deactivated'; } else { if ($adminStatus == DefaultForm::ACCOUNT_STATUS_ADMIN_LOCKED_BY_SELF) { $adminStatus = 'Locked By Self'; } else { if ($adminStatus == DefaultForm::ACCOUNT_STATUS_ADMIN_LOCKED_BY_THE_ADMINISTRATOR) { $adminStatus = 'Locked By The Administrator'; } else { if ($adminStatus == DefaultForm::ACCOUNT_STATUS_ADMIN_DELETED) { $adminStatus = 'Deleted'; } else { $adminStatus = 'Undefined'; } } } } } } return $this->render('adminprofile', array('adminData' => $adminDetails, 'countryName' => $countryName, 'location' => $location, 'adminID' => $adminID, 'adminAccountType' => $adminAccountType, 'status' => $adminStatus)); } } else { return DefaultController::redirectToUrl($url); } } else { return DefaultController::redirectToUrl($url); } } else { return DefaultController::redirectToUrl($url); } } else { return DefaultController::redirectToLogOut(); } }
public function actionSecurity() { $session = Yii::$app->session; $url = Yii::$app->params['siteHostBackendUrl'] . 'home/error'; if ($session->has('accountTypeID')) { $accountTypeID = $session->get('accountTypeID'); if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_SUPERUSER || $accountTypeID == DefaultForm::ACCOUNT_TYPE_ADMINISTRATOR || $accountTypeID == DefaultForm::ACCOUNT_TYPE_SECURITY) { return $this->render('security'); } else { return DefaultController::redirectToUrl($url); } } else { return DefaultController::redirectToLogOut(); } }