示例#1
0
 public function showForStudent(Student $student, $term)
 {
     // for freshmen
     if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
         return false;
     }
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     $application = HousingApplication::checkForApplication($student->getUsername(), $term);
     $assignment = HMS_Assignment::checkForAssignment($student->getUsername(), $term);
     // for returning students (summer terms)
     if ($term > $student->getApplicationTerm() && $assignment !== TRUE && $application !== FALSE) {
         return true;
     }
     return false;
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     $term = $context->get('term');
     # Double check that the student is eligible
     if (!HMS_Lottery::determineEligibility(UserStatus::getUsername())) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'You are not eligible to re-apply for on-campus housing for this semester.');
         $menuCmd = CommandFactory::getCommand('ShowStudentMenu');
         $menuCmd->redirect();
     }
     # Check if the student has already applied. If so, redirect to the student menu
     $result = HousingApplication::checkForApplication(UserStatus::getUsername(), $term);
     if ($result !== FALSE) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'You have already re-applied for on-campus housing for that term.');
         $menuCmd = CommandFactory::getCommand('ShowStudentMenu');
         $menuCmd->redirect();
     }
     # Make sure the student agreed to the terms, if not, send them back to the terms & agreement command
     $event = $context->get('event');
     $_SESSION['application_data'] = array();
     # If they haven't agreed, redirect to the agreement
     if (is_null($event) || !isset($event) || $event != 'signing_complete' && $event != 'viewing_complete') {
         $onAgree = CommandFactory::getCommand('ShowReApplication');
         $onAgree->setTerm($term);
         $agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
         $agreementCmd->setTerm($term);
         $agreementCmd->setAgreedCommand($onAgree);
         $agreementCmd->redirect();
     }
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
     PHPWS_Core::initModClass('hms', 'ReApplicationFormView.php');
     $view = new ReApplicationFormView($student, $term);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
     PHPWS_Core::initModClass('hms', 'exception/InvalidTermException.php');
     $term = $context->get('term');
     $username = UserStatus::getUsername();
     $student = StudentFactory::getStudentByUsername($username, $term);
     $sem = Term::getTermSem($term);
     // Check for an existing application and delete it
     $app_result = HousingApplication::checkForApplication($username, $term);
     // If there's an existing housing application, handle deleting it
     if ($app_result !== FALSE) {
         switch ($sem) {
             case TERM_SPRING:
                 $application = new SpringApplication($app_result['id']);
                 break;
             case TERM_SUMMER1:
             case TERM_SUMMER2:
                 $application = new SummerApplication($app_result['id']);
                 break;
             case TERM_FALL:
                 $application = new FallApplication($app_result['id']);
                 break;
             default:
                 throw new InvalidTermException('Invalid term specified.');
         }
         // Save the old created on dates for re-use on new application
         $oldCreatedOn = $application->getCreatedOn();
         $oldCreatedBy = $application->getCreatedBy();
         $application->delete();
     }
     switch ($sem) {
         case TERM_FALL:
             $appType = 'fall';
             break;
         case TERM_SPRING:
             $appType = 'spring';
             break;
         case TERM_SUMMER1:
         case TERM_SUMMER2:
             $appType = 'summer';
             break;
         default:
             throw new Exception('Unknown application type');
     }
     $application = HousingApplicationFactory::getApplicationFromSession($_SESSION['application_data'], $term, $student, $appType);
     // If old created dates exist, use them as the 'created on' dates
     if (isset($oldCreatedOn)) {
         $application->setCreatedOn($oldCreatedOn);
         $application->setCreatedBy($oldCreatedBy);
     }
     $application->setCancelled(0);
     // Hard code a summer meal option for all summer applications.
     // Application for other terms use whatever the student selected
     if ($sem == TERM_SUMMER1 || $sem == TERM_SUMMER2) {
         $application->setMealPlan(BANNER_MEAL_5WEEK);
     }
     $result = $application->save();
     if ($result == TRUE) {
         // Log the fact that the application was submitted
         PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
         HMS_Activity_Log::log_activity($username, ACTIVITY_SUBMITTED_APPLICATION, $username);
         try {
             // report the application to banner;
             $application->reportToBanner();
         } catch (Exception $e) {
             // ignore any errors reporting this to banner, they'll be logged and admins notified
             // we've saved the student's application locally, so it's ok if this doesn't work
         }
         // Send the email confirmation
         PHPWS_Core::initModClass('hms', 'HMS_Email.php');
         HMS_Email::send_hms_application_confirmation($student, $application->getTerm());
     }
     $friendly_term = Term::toString($application->getTerm());
     NQ::simple('hms', hms\NotificationView::SUCCESS, "Your application for {$friendly_term} was successfully processed!  You will receive an email confirmation in the next 24 hours.");
     PHPWS_Core::initModClass('hms', 'applicationFeature/RlcApplication.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     $rlcReg = new RLCApplicationRegistration();
     if (ApplicationFeature::isEnabledForStudent($rlcReg, $term, $student) && HMS_RLC_Application::checkForApplication($student->getUsername(), $term) == FALSE && $application->rlc_interest == 1) {
         $rlcCmd = CommandFactory::getCommand('ShowRlcApplicationPage1View');
         $rlcCmd->setTerm($term);
         $rlcCmd->redirect();
     } else {
         $successCmd = CommandFactory::getCommand('ShowStudentMenu');
         $successCmd->redirect();
     }
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
     PHPWS_Core::initModClass('hms', 'exception/InvalidTermException.php');
     $term = $context->get('term');
     $username = UserStatus::getUsername();
     $student = StudentFactory::getStudentByUsername($username, $term);
     $sem = Term::getTermSem($term);
     // Check for an existing application and load it
     $application = NULL;
     $app_result = HousingApplication::checkForApplication($username, $term);
     if ($app_result !== FALSE) {
         switch ($sem) {
             case TERM_SPRING:
                 $application = new SpringApplication($app_result['id']);
                 break;
             case TERM_SUMMER1:
             case TERM_SUMMER2:
                 $application = new SummerApplication($app_result['id']);
                 break;
             case TERM_FALL:
                 $application = new FallApplication($app_result['id']);
                 break;
             default:
                 throw new InvalidTermException('Invalid term specified.');
         }
     } else {
         // TODO What if there is no application found? Should I cry?
         // Execution shouldn't be able to make it this far if an application doesn't exist.
         throw new Exception('No application found.');
     }
     // Update the Emergency Contact and Missing Person information
     // TODO Sanity check all this new contact information
     /* Emergency Contact */
     $application->setEmergencyContactName($context->get('emergency_contact_name'));
     $application->setEmergencyContactRelationship($context->get('emergency_contact_relationship'));
     $application->setEmergencyContactPhone($context->get('emergency_contact_phone'));
     $application->setEmergencyContactEmail($context->get('emergency_contact_email'));
     /* Emergency Medical Condition */
     $application->setEmergencyMedicalCondition($context->get('emergency_medical_condition'));
     /* Missing Person */
     $application->setMissingPersonName($context->get('missing_person_name'));
     $application->setMissingPersonRelationship($context->get('missing_person_relationship'));
     $application->setMissingPersonPhone($context->get('missing_person_phone'));
     $application->setMissingPersonEmail($context->get('missing_person_email'));
     // Save the modified application
     $result = $application->save();
     if ($result == TRUE) {
         // Log the fact that the application updated
         PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
         HMS_Activity_Log::log_activity($username, ACTIVITY_EMERGENCY_CONTACT_UPDATED, $username);
         try {
             // report the application to banner;
             $application->reportToBanner();
         } catch (Exception $e) {
             // ignore any errors reporting this to banner, they'll be logged and admins notified.
             // we've saved the student's application locally, so it's ok if this doesn't work.
         }
         // Send the email confirmation
         PHPWS_Core::initModClass('hms', 'HMS_Email.php');
         HMS_Email::send_emergency_contact_updated_confirmation($student, $application->getTerm());
     }
     // Notify user of success
     //$friendly_term = Term::toString($application->getTerm());
     //NQ::simple('hms', hms\NotificationView::SUCCESS, "Your Emergency Contact & Missing Person information for $friendly_term was successfully modified! You will receive an email confirmation in the next 24 hours.");
     // Redirect to the student menu
     $successCmd = CommandFactory::getCommand('ShowStudentMenu');
     $successCmd->redirect();
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'RlcMembershipFactory.php');
     $roommates = $context->get('roommates');
     $mealPlan = $context->get('meal_plan');
     $term = PHPWS_Settings::get('hms', 'lottery_term');
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
     // Check for an RLC assignment in the self-select status
     $rlcAssignment = RlcMembershipFactory::getMembership($student, $term);
     $roomId = $context->get('roomId');
     if (!isset($roomId) || is_null($roomId) || empty($roomId)) {
         throw new InvalidArgumentException('Missing room id.');
     }
     // Put everything into lowercase before we get started
     foreach ($roommates as $key => $username) {
         $roommates[$key] = strtolower($username);
     }
     /**
      * Sanity checking
      */
     $errorCmd = CommandFactory::getCommand('LotteryShowChooseRoommates');
     $errorCmd->setRoomId($roomId);
     // Make sure the student assigned his/her self to a bed
     if (!in_array(UserStatus::getUsername(), $roommates)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'You must assign yourself to a bed. Please try again.');
         $errorCmd->redirect();
     }
     // Get a count of how many times each user name appears
     $counts = array_count_values($roommates);
     foreach ($roommates as $roommate) {
         if ($roommate == NULL || $roommate == '') {
             continue;
         }
         // Make sure this user name only appears once
         if ($counts[$roommate] > 1) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} may only be assigned to one bed. Please try again.");
             $errorCmd->redirect();
         }
         try {
             $studentObj = StudentFactory::getStudentByUsername($roommate, $term);
         } catch (StudentNotFoundException $e) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} is not a valid user name. Please try again.");
             $errorCmd->redirect();
         }
         $bannerId = $studentObj->getBannerId();
         // Make sure every user name is a valid student
         if (is_null($bannerId) || empty($bannerId)) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} is not a valid user name. Please try again.");
             $errorCmd->redirect();
         }
         /*
          * We can't check the student type here, because we're working in the future with students who are possibly still considered freshmen (which will always show up as type F)
          * What we can do is make sure their application term is less than the lottery term
          */
         $roommateAppTerm = $studentObj->getApplicationTerm();
         if (!isset($roommateAppTerm) || is_null($roommateAppTerm) || empty($roommateAppTerm)) {
             NQ::simple('hms', hms\NotificationView::ERROR, "The Housing Management System does not have complete student data for {$roommate}. Please select a different roommate.");
             $errorCmd->redirect();
         }
         // Make sure the student's application term is less than the current term
         if ($studentObj->getApplicationTerm() > Term::getCurrentTerm()) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} is not a continuing student. Only continuing students (i.e. not a first semester freshmen) may be selected as roommates. Please select a different roommate.");
             $errorCmd->redirect();
         }
         // Make sure the student is not withdrawn for the lottery term (again, we can't actually check for 'continuing' here)
         if ($studentObj->getType() == TYPE_WITHDRAWN) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} is not a continuing student. Only continuing students (i.e. not a first semester freshmen) may be selected as roommates. Please select a different roommate.");
             $errorCmd->redirect();
         }
         // If this student is an RLC-self-selection, then each roommate much be in the same RLC and in the selfselect-invite state too
         if ($rlcAssignment != null && $rlcAssignment->getStateName() == 'selfselect-invite') {
             // This student is an RLC-self-select, so check the roommate's RLC status
             $roommateRlcAssign = RlcMembershipFactory::getMembership($studentObj, $term);
             // Make sure the roommate is a member of the same RLC and is eligible for self-selection
             if ($roommateRlcAssign == null || $roommateRlcAssign->getStateName() != 'selfselect-invite' || $rlcAssignment->getRlc()->getId() != $roommateRlcAssign->getRlc()->getId()) {
                 NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} must be a member of the same learning community as you, and must also be eligible for self-selction.");
                 $errorCmd->redirect();
             }
             // Otherwise (if not RLC members), make sure each roommate entered the lottery and has a valid application (not cancelled)
         } else {
             if (HousingApplication::checkForApplication($roommate, $term) === FALSE) {
                 NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} did not re-apply for housing. Please select a different roommate.");
                 $errorCmd->redirect();
             }
         }
         // Make sure every student's gender matches, and that those are compatible with the room
         if ($studentObj->getGender() != $student->getGender()) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} is not the same gender as you. Please choose a roommate of the same gender.");
             $errorCmd->redirect();
         }
         // Make sure none of the students are assigned yet
         if (HMS_Assignment::checkForAssignment($roommate, $term) === TRUE) {
             NQ::simple('hms', hms\NotificationView::ERROR, "{$roommate} is already assigned to a room. Please choose a different roommate.");
             $errorCmd->redirect();
         }
     }
     // If we've made it this far, then everything is ok.. redirect to the confirmation screen
     $confirmCmd = CommandFactory::getCommand('LotteryShowConfirm');
     $confirmCmd->setRoomId($roomId);
     $confirmCmd->setRoommates($roommates);
     $confirmCmd->setMealPlan($mealPlan);
     $confirmCmd->redirect();
 }
示例#6
0
 public function can_live_together()
 {
     $requestor = strToLower($this->requestor);
     $requestee = strToLower($this->requestee);
     $term = $this->term;
     // Check if the requestor has a confirmed roommate
     if (HMS_Roommate::has_confirmed_roommate($requestor, $term)) {
         return E_ROOMMATE_ALREADY_CONFIRMED;
     }
     // Check if the requestee has a confirmed roommate
     if (HMS_Roommate::has_confirmed_roommate($requestee, $term)) {
         return E_ROOMMATE_REQUESTED_CONFIRMED;
     }
     // Use SOAP for the rest of the checks
     $requestor_info = StudentFactory::getStudentByUsername($requestor, $term);
     // Make sure the requestee is actually a user
     try {
         $requestee_info = StudentFactory::getStudentByUsername($requestee, $term);
     } catch (StudentNotFoundException $snfe) {
         return E_ROOMMATE_USER_NOINFO;
     }
     // Make sure we have compatible genders
     if ($requestor_info->getGender() != $requestee_info->getGender()) {
         return E_ROOMMATE_GENDER_MISMATCH;
     }
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     // Make sure the requestee has filled out an application
     if (HousingApplication::checkForApplication($requestee, $term) === false) {
         return E_ROOMMATE_NO_APPLICATION;
     }
     // Students can only request a student of the same "type"
     // This is based on the application term (because students starting
     // in the summer will have different types). The students must have
     // the same application term, unless either student's application
     // term is a summer session of the same year
     /*
             if ($requestor_info->getType() != $requestee_info->getType()) {
                 return E_ROOMMATE_TYPE_MISMATCH;
             }*/
     $aTerm = $requestor_info->getApplicationTerm();
     $aYear = Term::getTermYear($aTerm);
     $aSem = Term::getTermSem($aTerm);
     $bTerm = $requestee_info->getApplicationTerm();
     $bYear = Term::getTermYear($bTerm);
     $bSem = Term::getTermSem($bTerm);
     // There's a mismatch if the years don't match OR (the years match AND (either student started in the Spring))
     // This allows people with summer application terms to request each other, but prevents continuing students from requesting each other
     // (even if the one student started in the Spring and has a 'F' student type at the time the request is made)
     if ($aYear != $bYear || $aYear == $bYear && ($aSem == TERM_SPRING && $bSem != TERM_SPRING || $bSem == TERM_SPRING && $aSem != TERM_SPRING)) {
         return E_ROOMMATE_TYPE_MISMATCH;
     }
     // Transfer students can only request other transfers - Prevents freshmen from requesting transfers and vice versa
     if ($requestor_info->getType() == TYPE_TRANSFER && $requestee_info->getType() != TYPE_TRANSFER || $requestee_info->getType() == TYPE_TRANSFER && $requestor_info->getType() != TYPE_TRANSFER) {
         return E_ROOMMATE_TYPE_MISMATCH;
     }
     /*
     // Make sure RLC Applications are compatible
     if (!$this->check_rlc_applications()) {
     return E_ROOMMATE_RLC_APPLICATION;
     }
     
     // If either student is assigned to an RLC, do not allow the request
     if (!$this->check_rlc_assignments()) {
     return E_ROOMMATE_RLC_ASSIGNMENT;
     }
     */
     return E_SUCCESS;
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'assignment_maintenance')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to assign students.');
     }
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'FallApplication.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Room.php');
     PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
     PHPWS_Core::initModClass('hms', 'BannerQueue.php');
     // NB: Username must be all lowercase
     $username = strtolower(trim($context->get('username')));
     $term = Term::getSelectedTerm();
     // Setup command to redirect to in case of error
     $errorCmd = CommandFactory::getCommand('ShowAssignStudent');
     $errorCmd->setUsername($username);
     /***
      * Input Sanity Checking
      */
     // Must supply a user name
     if (is_null($username)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Invalid or missing username.');
         $errorCmd->redirect();
     }
     // Must supply at least a room ID
     $roomId = $context->get('room');
     if (is_null($roomId) || $roomId == 0) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'You must select a room.');
         $errorCmd->redirect();
     }
     // Must choose an assignment type
     $assignmentType = $context->get('assignment_type');
     if (!isset($assignmentType) || is_null($assignmentType) || $assignmentType < 0) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'You must choose an assignment type.');
         $errorCmd->redirect();
     }
     // Check to make sure the student has an application on file
     $applicationStatus = HousingApplication::checkForApplication($username, $term);
     if ($applicationStatus == FALSE) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'Warning: No housing application found for this student in this term.');
     }
     // If the student is already assigned, redirect to the confirmation screen. If the student is already assigned
     // and the confirmation flag is true, then set a flag and proceed.
     $moveNeeded = FALSE;
     if (HMS_Assignment::checkForAssignment($username, $term)) {
         if ($context->get('moveConfirmed') == 'true') {
             // Move has been confirmed
             $moveNeeded = true;
         } else {
             // Redirect to the move confirmation interface
             $moveConfirmCmd = CommandFactory::getCommand('ShowAssignmentMoveConfirmation');
             $moveConfirmCmd->setUsername($username);
             $moveConfirmCmd->setRoom($context->get('room'));
             $moveConfirmCmd->setBed($context->get('bed'));
             $moveConfirmCmd->setMealPlan($context->get('meal_plan'));
             $moveConfirmCmd->setAssignmentType($assignmentType);
             $moveConfirmCmd->setNotes($context->get('note'));
             $moveConfirmCmd->redirect();
         }
     }
     try {
         $student = StudentFactory::getStudentByUsername($username, $term);
     } catch (StudentNotFoundException $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Invalid user name, no such student found.');
         $errorCmd->redirect();
     }
     // Check age, issue a warning for over 25
     if (strtotime($student->getDOB()) < strtotime("-25 years")) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'Student is 25 years old or older!');
     }
     $gender = $student->getGender();
     if (!isset($gender) || is_null($gender)) {
         throw new InvalidArgumentException('Missing student gender.');
     }
     // Create the room object so we can check gender
     $room = new HMS_Room($roomId);
     if (!$room) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Error creating the room object.');
         $errorCmd->redirect();
     }
     // Create the hall object for later
     $floor = $room->get_parent();
     $hall = $floor->get_parent();
     // If the room is Co-ed, make sure the user has permission to assign to co-ed rooms
     if ($room->getGender() == COED && !Current_User::allow('hms', 'coed_assignment')) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Error: You do not have permission to assign students to co-ed rooms.');
         $errorCmd->redirect();
     }
     // Make sure the student's gender matches the gender of the room, unless the room is co-ed.
     if ($room->getGender() != $gender && $room->getGender() != COED) {
         // Room gender does not match student's gender, so check if we can change it
         if ($room->can_change_gender($gender) && Current_User::allow('hms', 'room_attributes')) {
             $room->setGender($gender);
             $room->save();
             NQ::simple('hms', hms\NotificationView::WARNING, 'Warning: Changing room gender.');
         } else {
             NQ::simple('hms', hms\NotificationView::ERROR, 'Error: The student\'s gender and the room\'s gender do not match and the room could not be changed.');
             $errorCmd->redirect();
         }
     }
     // If the user is attempting to re-assign and has confirmed the move,
     // then unassign the student first.
     if ($moveNeeded) {
         try {
             //TODO don't hard-code refund percentage to 100%
             HMS_Assignment::unassignStudent($student, $term, '(re-assign)', UNASSIGN_REASSIGN, 100);
         } catch (Exception $e) {
             NQ::simple('hms', hms\NotificationView::ERROR, "Error deleting current assignment. {$username} was not removed.");
             $errorCmd->redirect();
         }
     }
     // Actually try to make the assignment, decide whether to use the room id or the bed id
     $bed = $context->get('bed');
     try {
         if (isset($bed) && $bed != 0) {
             HMS_Assignment::assignStudent($student, $term, NULL, $bed, $context->get('meal_plan'), $context->get('note'), false, $context->get('assignment_type'));
         } else {
             HMS_Assignment::assignStudent($student, $term, $context->get('room'), NULL, $context->get('meal_plan'), $context->get('note'), false, $context->get('assignment_type'));
         }
     } catch (AssignmentException $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Assignment error: ' . $e->getMessage());
         $errorCmd->redirect();
     }
     // Show a success message
     if ($context->get('moveConfirmed') == 'true') {
         NQ::simple('hms', hms\NotificationView::SUCCESS, 'Successfully moved ' . $username . ' to ' . $hall->hall_name . ' room ' . $room->room_number);
     } else {
         NQ::simple('hms', hms\NotificationView::SUCCESS, 'Successfully assigned ' . $username . ' to ' . $hall->hall_name . ' room ' . $room->room_number);
     }
     $successCmd = CommandFactory::getCommand('ShowAssignStudent');
     $successCmd->redirect();
 }