public function actionSuperuser() { $sessionName = 'accountTypeID'; $url = Yii::$app->params['siteHostBackendUrl'] . 'home/error'; $sessionValue = DefaultController::getSessionValue($sessionName); if ($sessionValue != '') { $accountTypeID = $sessionValue; if ($accountTypeID == DefaultForm::ACCOUNT_TYPE_SUPERUSER) { return $this->render('superuser'); } else { return DefaultController::redirectToUrl($url); } } else { return DefaultController::redirectToLogOut(); } }
public function actionSaveprofilephoto() { $request = Yii::$app->request; if ($request->isAjax) { $post = $request->post(); $studentID = $post['StudentID']; $sessionName = 'previousFilename'; $filenameHasSession = DefaultController::checkSession($sessionName); if ($filenameHasSession == true) { $sessionCurrentValue = DefaultController::getSessionValue($sessionName); if ($sessionCurrentValue != '') { $_AccountStudentDetailsForm = new AccountStudentDetailsForm(); $updateStudentProfilePhoto = $_AccountStudentDetailsForm->updateStudentProfilePhotoByStudentID($sessionCurrentValue, $studentID); if (isset($updateStudentProfilePhoto['status'])) { if (isset($updateStudentProfilePhoto['message'])) { $status = $updateStudentProfilePhoto['status']; $message = $updateStudentProfilePhoto['message']; DefaultController::removeSession($sessionName); $returnData = array('status' => $status, 'message' => $message); } else { $returnData = array('status' => DefaultForm::ERROR_CODE_REQUEST_DEFAULT, 'message' => DefaultForm::ERROR_MESSAGE_SYSTEM_DEFAULT); } } else { $returnData = array('status' => DefaultForm::ERROR_CODE_REQUEST_DEFAULT, 'message' => DefaultForm::ERROR_MESSAGE_SYSTEM_DEFAULT); } } else { $returnData = array('status' => DefaultForm::ERROR_CODE_REQUEST_DEFAULT, 'message' => 'Could not retrieve filename.'); } } else { $returnData = array('status' => DefaultForm::ERROR_CODE_REQUEST_DEFAULT, 'message' => 'Could not retrieve filename.'); } } else { $returnData = array('status' => DefaultForm::ERROR_CODE_REQUEST_DEFAULT, 'message' => DefaultForm::ERROR_MESSAGE_AJAX_REQUEST_DEFAULT); } return json_encode($returnData); }