Example #1
0
 public function show()
 {
     if (\UserStatus::isGuest()) {
         return '';
     }
     $terms = \Term::getTermsAssoc();
     $current = \Term::getCurrentTerm();
     if (isset($terms[$current])) {
         $terms[$current] .= ' (Current)';
     }
     $form = new \PHPWS_Form('term_selector');
     $cmd = \CommandFactory::getCommand('SelectTerm');
     $cmd->initForm($form);
     $form->addDropBox('term', $terms);
     $tags = $form->getTemplate();
     $currentTerm = \Term::getSelectedTerm();
     $tags['TERM_OPTIONS'] = array();
     foreach ($tags['TERM_VALUE'] as $key => $value) {
         $selected = '';
         if ($key == $currentTerm) {
             $selected = 'selected="selected"';
         }
         $tags['TERM_OPTIONS'][] = array('id' => $key, 'term' => $value, 'selected' => $selected);
     }
     javascript('jquery');
     javascriptMod('hms', 'jqueryCookie');
     javascript('modules/hms/SelectTerm');
     return \PHPWS_Template::process($tags, 'hms', 'admin/SelectTerm.tpl');
 }
Example #2
0
 public function show()
 {
     $username = UserStatus::getUsername();
     $currentTerm = Term::getCurrentTerm();
     $student = StudentFactory::getStudentByUsername($username, $currentTerm);
     $applicationTerm = $student->getApplicationTerm();
     $tpl = array();
     $tpl['TITLE'] = 'Contact Form';
     $form = new PHPWS_Form();
     $form->addText('name');
     $form->setLabel('name', 'Name');
     $form->addText('email');
     $form->setLabel('email', 'Email Address');
     $form->addText('phone');
     $form->setLabel('phone', 'Phone number');
     $form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
     $form->setLabel('stype', 'Classification');
     $form->addTextArea('comments');
     $form->setLabel('comments', 'Question, Comments, or Description of the Problem');
     $form->addSubmit('Submit');
     $form->mergeTemplate($tpl);
     $cmd = CommandFactory::getCommand('SubmitContactForm');
     $cmd->setUsername($username);
     $cmd->setApplicationTerm($applicationTerm);
     $cmd->setStudentType($student->getType());
     $cmd->initForm($form);
     $tpl = $form->getTemplate();
     //var_dump($tpl);exit;
     return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
 }
 public function getAdminPagerTags()
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'Term.php');
     $student = StudentFactory::getStudentByUsername($this->username, Term::getCurrentTerm());
     $rlc_list = HMS_Learning_Community::getRlcList();
     $tags = array();
     $tags['NAME'] = $student->getProfileLink();
     $rlcCmd = CommandFactory::getCommand('ShowRlcApplicationReView');
     $rlcCmd->setAppId($this->getId());
     $tags['1ST_CHOICE'] = $rlcCmd->getLink($rlc_list[$this->getFirstChoice()], '_blank');
     if (isset($rlc_list[$this->getSecondChoice()])) {
         $tags['2ND_CHOICE'] = $rlc_list[$this->getSecondChoice()];
     }
     if (isset($rlc_list[$this->getThirdChoice()])) {
         $tags['3RD_CHOICE'] = $rlc_list[$this->getThirdChoice()];
     }
     $tags['FINAL_RLC'] = HMS_RLC_Application::generateRLCDropDown($rlc_list, $this->getID());
     $tags['CLASS'] = $student->getClass();
     //        $tags['SPECIAL_POP']    = ;
     //        $tags['MAJOR']          = ;
     //        $tags['HS_GPA']         = ;
     $tags['GENDER'] = $student->getPrintableGender();
     $tags['DATE_SUBMITTED'] = date('d-M-y', $this->getDateSubmitted());
     $denyCmd = CommandFactory::getCommand('DenyRlcApplication');
     $denyCmd->setApplicationId($this->getID());
     $tags['DENY'] = $denyCmd->getLink('Deny');
     return $tags;
 }
 public function __construct($username)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     $student = StudentFactory::getStudentByUsername($username, Term::getCurrentTerm());
     $this->student = $student;
     $this->term = $student->getApplicationTerm();
 }
 public function execute(CommandContext $context)
 {
     $term = $context->get('term');
     if (!isset($term) || is_null($term) || empty($term)) {
         throw new InvalidArgumentException('Missing term.');
     }
     $cmd = CommandFactory::getCommand('ShowStudentMenu');
     $feature = ApplicationFeature::getInstanceByNameAndTerm('RlcApplication', $term);
     // Make sure the RLC application feature is enabled
     if (is_null($feature) || !$feature->isEnabled()) {
         NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, RLC applications are not avaialable for this term.");
         $cmd->redirect();
     }
     // Check feature's deadlines
     if ($feature->getStartDate() > time()) {
         NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, it is too soon to fill out an RLC application.");
         $cmd->redirect();
     } else {
         if ($feature->getEndDate() < time()) {
             NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, the RLC application deadline has already passed. Please contact University Housing if you are interested in applying for a RLC.");
             $cmd->redirect();
         }
     }
     // Get the Student object
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
     $view = new RlcApplicationPage1View($context, $student);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'FreshmenMainMenuView.php');
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
     $view = new FreshmenMainMenuView($student);
     $context->setContent($view->show());
 }
Example #7
0
 public function showForStudent(Student $student, $term)
 {
     if ($student->getApplicationTerm() <= Term::getCurrentTerm()) {
         return true;
     } else {
         return false;
     }
 }
Example #8
0
 public function showForStudent(Student $student, $term)
 {
     // New Incoming Freshmen
     if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
         return true;
     }
     return false;
 }
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'cancel_housing_application')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to cancel housing applications.');
     }
     // Check for a housing application id
     $applicationId = $context->get('applicationId');
     if (!isset($applicationId) || is_null($applicationId)) {
         throw new InvalidArgumentException('Missing housing application id.');
     }
     // Check for a cancellation reason
     $cancelReason = $context->get('cancel_reason');
     if (!isset($cancelReason) || is_null($cancelReason)) {
         throw new InvalidArgumentException('Missing cancellation reason.');
     }
     // Load the housing application
     PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
     $application = HousingApplicationFactory::getApplicationById($applicationId);
     // Load the student
     $student = $application->getStudent();
     $username = $student->getUsername();
     $term = $application->getTerm();
     // Load the cancellation reasons
     $reasons = HousingApplication::getCancellationReasons();
     // Check for an assignment and remove it
     // Decide which term to use - If this application is in a past fall term, then use the current term
     if ($term < Term::getCurrentTerm() && Term::getTermSem($term) == TERM_FALL) {
         $assignmentTerm = Term::getCurrentTerm();
     } else {
         $assignmentTerm = $term;
     }
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     $assignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $assignmentTerm);
     if (isset($assignment)) {
         // TODO: Don't hard code cancellation refund percentage
         HMS_Assignment::unassignStudent($student, $assignmentTerm, 'Application cancellation: ' . $reasons[$cancelReason], UNASSIGN_CANCEL, 100);
     }
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     $rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($username, $term);
     if (!is_null($rlcAssignment)) {
         $rlcAssignment->delete();
     }
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     $rlcApplication = HMS_RLC_Application::getApplicationByUsername($username, $term);
     if (!is_null($rlcApplication)) {
         $rlcApplication->denied = 1;
         $rlcApplication->save();
         HMS_Activity_Log::log_activity($username, ACTIVITY_DENIED_RLC_APPLICATION, \Current_User::getUsername(), Term::toString($term) . ' Denied RLC Application due to Contract Cancellation');
     }
     // Cancel the application
     $application->cancel($cancelReason);
     $application->save();
     echo 'success';
     exit;
 }
 public function execute(CommandContext $context)
 {
     $term = Term::getCurrentTerm();
     // Get the list of role memberships this user has
     // NB: This gets memberships for all terms.. must filter later
     $hms_perm = new HMS_Permission();
     $memberships = $hms_perm->getMembership('room_change_approve', NULL, UserStatus::getUsername());
     // Use the roles to instantiate a list of floors this user has access to
     $floors = array();
     foreach ($memberships as $member) {
         if ($member['class'] == 'hms_residence_hall') {
             $hall = new HMS_Residence_Hall($member['instance']);
             // Filter out halls that aren't in the current term
             if ($hall->getTerm() != $term) {
                 continue;
             }
             $floors = array_merge($floors, $hall->getFloors());
         } else {
             if ($member['class'] == 'hms_floor') {
                 $f = new HMS_Floor($member['instance']);
                 // Filter out floors that aren't in the current term
                 if ($f->getTerm() != $term) {
                     continue;
                 }
                 $floors[] = $f;
             } else {
                 throw new Exception('Unknown object type.');
             }
         }
     }
     if (empty($floors)) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         NQ::simple('hms', hms\NotificationView::ERROR, "You do not have the 'RD' role on any residence halls or floors.");
         $cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
         $cmd->redirect();
     }
     // Remove duplicate floors
     $uniqueFloors = array();
     foreach ($floors as $floor) {
         $uniqueFloors[$floor->getId()] = $floor;
     }
     // Use the list of floors to get a unique list of hall names
     $hallNames = array();
     foreach ($uniqueFloors as $floor) {
         $hall = $floor->get_parent();
         $hallNames[$hall->getId()] = $hall->getHallName();
     }
     // Get the set of room changes which are not complete based on the floor list
     $needsApprovalChanges = RoomChangeRequestFactory::getRoomChangesNeedsApproval($term, $uniqueFloors);
     $approvedChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Approved'));
     $allPendingChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Pending', 'Hold'));
     $completedChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Complete'));
     $inactiveChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Cancelled', 'Denied'));
     $view = new RoomChangeApprovalView($needsApprovalChanges, $approvedChanges, $allPendingChanges, $completedChanges, $inactiveChanges, $hallNames, $term);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     $term = Term::getCurrentTerm();
     // Create the student
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
     // If the student has a pending request load it from the db
     $request = RoomChangeRequestFactory::getPendingByStudent($student, $term);
     $view = new RoomChangeRequestForm($student, $term);
     $context->setContent($view->show());
 }
 public static function checkForWaiver($username, $term = NULL)
 {
     $db = new PHPWS_DB('hms_eligibility_waiver');
     $db->addWhere('asu_username', $username);
     if (!isset($term)) {
         $db->addWhere('term', Term::getCurrentTerm());
     } else {
         $db->addWhere('term', $term);
     }
     return !is_null($db->select('row'));
 }
Example #13
0
 public function showForStudent(Student $student, $term)
 {
     // for freshmen
     if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
         return true;
     }
     // for returning students (summer terms)
     if ($term > $student->getApplicationTerm() && $term != PHPWS_Settings::get('hms', 'lottery_term') && (Term::getTermSem($term) == TERM_SUMMER1 || Term::getTermSem($term) == TERM_SUMMER2)) {
         return true;
     }
     return false;
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'CheckinFactory.php');
     PHPWS_Core::initModClass('hms', 'RoomDamageFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     PHPWS_Core::initModClass('hms', 'BedFactory.php');
     $term = Term::getCurrentTerm();
     $bannerId = $context->get('bannerId');
     $hallId = $context->get('hallId');
     $errorCmd = CommandFactory::getCommand('ShowCheckoutStart');
     if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Missing student ID.');
         $errorCmd->redirect();
     }
     if (!isset($hallId)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
         $errorCmd->redirect();
     }
     // If search string is all numeric, make sure it looks like a valid Banner ID
     if (is_numeric($bannerId) && preg_match("/[\\d]{9}/", $bannerId) == false) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Imporperly formatted Banner ID.');
         $errorCmd->redirect();
     }
     // Try to lookup the student in Banner
     try {
         // If it's all numeric assume it's a student ID, otherwise assume it's a username
         if (is_numeric($bannerId) && strlen((string) $bannerId) == 9) {
             $student = StudentFactory::getStudentByBannerId($bannerId, $term);
         } else {
             $student = StudentFactory::getStudentByUsername($bannerId, $term);
         }
     } catch (StudentNotFoundException $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
         $errorCmd->redirect();
     }
     // Find the earliest checkin that matches hall the user selected
     $hall = new HMS_Residence_Hall($hallId);
     $checkin = CheckinFactory::getPendingCheckoutForStudentByHall($student, $hall);
     if (!isset($checkin)) {
         NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, we couldn't find a matching check-in at {$hall->getHallName()} for this student to check-out of.");
         $errorCmd->redirect();
     }
     $bed = BedFactory::getBedByPersistentId($checkin->getBedPersistentId(), $term);
     $room = $bed->get_parent();
     // Get the damages for this student's room
     $damages = RoomDamageFactory::getDamagesByRoom($room);
     PHPWS_Core::initModClass('hms', 'CheckoutFormView.php');
     $view = new CheckoutFormView($student, $hall, $room, $bed, $damages, $checkin);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     $this->searchString = $context->get('studentSearchQuery');
     // NB: this is the *search term*, not the semester
     $this->hmsTerm = Term::getCurrentTerm();
     // If the search string is empty, just return an empty json array
     if (!isset($this->searchString) || $this->searchString == '') {
         echo json_encode(array());
         exit;
     }
     // Strip any non-alphanumeric characters, escape slashes
     $this->searchString = pg_escape_string($this->searchString);
     // Check for a direct banner ID match
     if (preg_match("/^[0-9]{9}/", $this->searchString)) {
         // String is all-numeric, probably a Banner ID
         // If the seach string is exactly 9 digits, then try to find a match
         $sql = $this->getBannerIdSearchSql();
     } else {
         // Do fancy string matching instead
         $sql = $this->getFuzzyTextSql();
     }
     // TODO join for only assigned students / applied students in current/future terms
     // Add a limit on the number of results
     $sql .= " LIMIT " . self::resultLimit;
     //test($sql,1);
     $this->db = new PHPWS_DB('hms_student_autocomplete');
     $results = PHPWS_DB::getAll($sql);
     //test($results,1);
     if (is_null($results)) {
         echo json_encode();
         exit;
     }
     // Log any DB errors and echo an empty result
     if (PHPWS_Error::logIfError($results)) {
         echo json_encode(array());
         exit;
     }
     $resultObjects = array();
     foreach ($results as $row) {
         $obj = new stdClass();
         $obj->banner_id = $row['banner_id'];
         $obj->name = $row['first_name'] . ' ' . $row['last_name'];
         $obj->username = $row['username'];
         $resultObjects[] = $obj;
     }
     $jsonResult = json_encode($resultObjects);
     //test($jsonResult,1);
     echo $jsonResult;
     exit;
     // NB: using setContent adds escape characters to quotes in the JSON string... WRONG.
     //$context->setContent(json_encode($jsonResult));
 }
 public function show()
 {
     $term = Term::getCurrentTerm();
     $student = StudentFactory::getStudentByBannerId($this->checkin->getBannerId(), $term);
     $bed = new HMS_Bed($this->checkin->getBedId());
     $tpl = array();
     $tpl['NAME'] = $student->getName();
     $tpl['ASSIGNMENT'] = $bed->where_am_i();
     $pdfCmd = CommandFactory::getCommand('GenerateInfoCard');
     $pdfCmd->setCheckinId($this->checkin->getId());
     $tpl['INFO_CARD_LINK'] = $pdfCmd->getLink('Resident Information Card', '_blank');
     return PHPWS_Template::process($tpl, 'hms', 'admin/checkinComplete.tpl');
 }
Example #17
0
 public function copy($to_term, $room_id, $assignments)
 {
     if (!$this->id) {
         return false;
     }
     // echo "in hms_beds, making a copy of this bed<br>";
     $new_bed = clone $this;
     $new_bed->reset();
     $new_bed->term = $to_term;
     $new_bed->room_id = $room_id;
     $new_bed->clearRoomChangeReserved();
     try {
         $new_bed->save();
     } catch (Exception $e) {
         throw $e;
     }
     // Copy assignment
     if ($assignments) {
         // echo "loading assignments for this bed<br>";
         PHPWS_Core::initModClass('hms', 'HousingApplication.php');
         PHPWS_Core::initModClass('hms', 'Term.php');
         PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
         PHPWS_Core::initModClass('hms', 'StudentFactory.php');
         try {
             $this->loadAssignment();
         } catch (Exception $e) {
             throw $e;
         }
         if (isset($this->_curr_assignment)) {
             try {
                 try {
                     $student = StudentFactory::getStudentByUsername($this->_curr_assignment->asu_username, Term::getCurrentTerm());
                     $app = HousingApplication::getApplicationByUser($this->_curr_assignment->asu_username, Term::getCurrentTerm());
                 } catch (StudentNotFoundException $e) {
                     NQ::simple('hms', hms\NotificationView::ERROR, 'Could not copy assignment for ' . $this->_curr_assignment->asu_username);
                     return;
                 }
                 // meal option defaults to standard
                 $meal_option = BANNER_MEAL_STD;
                 if (!is_null($app)) {
                     $meal_option = $app->getMealPlan();
                 }
                 $note = "Assignment copied from " . Term::getPrintableCurrentTerm() . " to " . Term::toString($to_term);
                 HMS_Assignment::assignStudent($student, $to_term, null, $new_bed->id, $meal_option, $note, false, $this->_curr_assignment->getReason());
             } catch (Exception $e) {
                 throw $e;
             }
         }
     }
 }
 public function showForStudent(Student $student, $term)
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
     if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
         return false;
     }
     $app = HousingApplicationFactory::getAppByStudent($student, $term);
     // Must be a returning student and either have not re-applied or have re-applied to the waiting list already
     if ($student->getApplicationTerm() <= Term::getCurrentTerm() && is_null($app) || !is_null($app) && $app->application_type == 'offcampus_waiting_list') {
         return true;
     }
     return false;
 }
Example #19
0
 public function showForStudent(Student $student, $term)
 {
     // Freshmen only
     if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
         return true;
     }
     // Possibly available for continuing students in the summer terms (this is sort of a hack)
     //TODO: find a better way to implement this
     $termSem = Term::getTermSem($term);
     if ($student->getApplicationTerm() <= Term::getCurrentTerm() && ($termSem == TERM_SUMMER1 || $termSem == TERM_SUMMER2)) {
         return true;
     }
     return false;
 }
Example #20
0
 public function showForStudent(Student $student, $term)
 {
     if ($student->getType() != TYPE_FRESHMEN && $student->getType() != TYPE_TRANSFER) {
         return false;
     }
     // Application term must be in the future
     if ($student->getApplicationTerm() <= Term::getCurrentTerm()) {
         return false;
     }
     $sem = substr($term, 4, 2);
     if ($sem != TERM_SUMMER1 && $sem != TERM_SUMMER2 && $sem != TERM_FALL) {
         return false;
     }
     return true;
 }
 public function execute(CommandContext $context)
 {
     $term = Term::getCurrentTerm();
     $gender = $context->get('gender');
     if (!isset($gender)) {
         echo "Missing gender!";
     }
     $db = PdoFactory::getPdoInstance();
     $query = "select bedid, hall_name, room_number\n                FROM hms_hall_structure\n                LEFT OUTER JOIN hms_assignment ON hms_assignment.bed_id = hms_hall_structure.bedid\n                WHERE\n                    bed_term = :term and\n                    hms_assignment.bed_id IS NULL and\n                    (room_gender = :gender OR room_gender = 2) and\n                    offline = 0 and\n                    overflow = 0 and\n                    parlor = 0 and\n                    ra_roommate = 0 and\n                    private = 0 and\n                    reserved = 0 and\n                    room_change_reserved = 0\n                ORDER BY hall_name, room_number";
     $stmt = $db->prepare($query);
     $params = array('term' => $term, 'gender' => $gender);
     $stmt->execute($params);
     echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
     exit;
 }
 /**
  * Checks each hall, floor, and room for the given term and returns 
  * an associative array containing all of the invalid items.
  **/
 public function check($term = null)
 {
     $results = array();
     if (!isset($term)) {
         $term = Term::getCurrentTerm();
     }
     $halls = HMS_Residence_Hall::get_halls($term);
     foreach ($halls as $hall) {
         $floors = $hall->get_floors();
         if (!isset($floors)) {
             $results[$hall->hall_name] = "No Floors in Hall!";
         } else {
             foreach ($floors as $floor) {
                 if ($hall->gender_type != COED && $floor->gender_type != $hall->gender_type) {
                     $results[$hall->hall_name][$floor->floor_number] = "Gender Mismatch With Hall";
                     continue;
                 }
                 $rooms = $floor->get_rooms();
                 if (!isset($rooms)) {
                     $results[$hall->hall_name][$floor->floor_number] = "No rooms in Floor!";
                 } else {
                     foreach ($rooms as $room) {
                         if ($floor->gender_type != COED && $room->gender_type != $floor->gender_type) {
                             $results[$hall->hall_name][$floor->floor_number][$room->room_number] = "Gender Mismatch with Floor " . "(Floor: " . $floor->gender_type . ") (Room: " . $room->gender_type . ")";
                         }
                     }
                 }
                 $suites = $floor->get_suites();
                 if (isset($suites)) {
                     foreach ($suites as $suite) {
                         $rooms = $suite->get_rooms();
                         $suite_gender = null;
                         foreach ($rooms as $room) {
                             if (!isset($suite_gender)) {
                                 $suite_gender = $room->gender_type;
                                 continue;
                             }
                             if ($room->gender_type != $suite_gender) {
                                 $results[$hall->hall_name][$floor->floor_number][$room->room_number] = "Suite Gender Mismatch";
                             }
                         }
                     }
                 }
             }
         }
     }
     return $results;
 }
Example #23
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;
 }
Example #24
0
 public function applyExceptions(&$student)
 {
     /*
      * This is a hack to fix some freshmen students who have application terms in the future but are considered type 'C' by the registrar's office.
      * See Trac #719
      */
     PHPWS_Core::initModClass('hms', 'Term.php');
     if ($student->getApplicationTerm() > Term::getCurrentTerm() && $student->getType() == TYPE_CONTINUING) {
         $student->setType(TYPE_FRESHMEN);
     }
     // This is a hack to fix the student type for international grad students
     $type = $student->getType();
     if ((!isset($type) || $type == '') && $student->getStudentLevel() == LEVEL_GRAD && $student->isInternational() == 1) {
         $student->setType(TYPE_GRADUATE);
         $student->setClass(CLASS_SENIOR);
     }
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     $lotteryTerm = PHPWS_Settings::get('hms', 'lottery_term');
     if (is_null($lotteryTerm)) {
         PHPWS_Core::initModClass('hms', 'exception/InvalidConfigurationException.php');
         throw new InvalidConfigurationException('Lottery term is not configured.');
     }
     if ($lotteryTerm < Term::getCurrentTerm()) {
         PHPWS_Core::initModClass('hms', 'exception/InvalidConfigurationException.php');
         throw new InvalidConfigurationException('Lottery term must be in the future. You probably forgot to update it.');
     }
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $lotteryTerm);
     PHPWS_Core::initModClass('hms', 'ReturningMainMenuView.php');
     $view = new ReturningMainMenuView($student, $lotteryTerm);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     $term = Term::getCurrentTerm();
     // Get the current student
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
     // Check for an assignment
     $assignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $term);
     // If not assigned, then redirect to the main menu with an error
     if (is_null($assignment)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'You do not have a room assignment for the current semester.');
         $cmd = CommandFactory::getCommand('ShowStudentMenu');
         $cmd->redirect();
     }
     $tpl['NAME'] = $student->getFullName();
     $tpl['ASSIGNMENT'] = $assignment->where_am_i();
     $tpl['TERM'] = Term::toString($term);
     $context->setContent(\PHPWS_Template::process($tpl, 'hms', 'student/residenceVerification.tpl'));
 }
 public function execute(CommandContext $context)
 {
     // Check permissions
     if (!Current_User::allow('hms', 'checkin')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to checkin students.');
     }
     $term = Term::getCurrentTerm();
     // Check role-based permissions for list of hall or all halls
     // TODO (for now just listing all halls)
     PHPWS_Core::initModClass('hms', 'ResidenceHallFactory.php');
     $halls = ResidenceHallFactory::getHallNamesAssoc($term);
     if (!isset($halls) || count($halls) < 1) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'No residence halls are setup for this term, so the check-in cannot be accessed.');
         $context->goBack();
     }
     PHPWS_Core::initModClass('hms', 'CheckOutStartView.php');
     $view = new CheckoutStartView($halls, $term);
     $context->setContent($view->show());
 }
 public function show()
 {
     $tpl = array();
     $termList = array();
     // Current term
     $currTerm = Term::getCurrentTerm();
     $termList[] = $currTerm;
     // Always add the current term
     // Find the next two summer terms (could be next year if Fall
     // is the current term, could be this year if Spring is current term)
     $summerTerm1 = $currTerm;
     while (Term::getTermSem($summerTerm1) != TERM_SUMMER1) {
         $summerTerm1 = Term::getNextTerm($summerTerm1);
     }
     $summerTerm2 = Term::getNextTerm($summerTerm1);
     $currSem = Term::getTermSem($currTerm);
     if ($currSem == TERM_SUMMER1) {
         // If the current term is Summer 1, then we've already added it above,
         // so just add summer 2
         $termList[] = Term::getNextTerm($currTerm);
     } else {
         if ($currSem != TERM_SUMMER2) {
             // Add both of the next summer terms then
             $termList[] = $summerTerm1;
             $termList[] = $summerTerm2;
         }
     }
     // Re-application term
     if ($this->lotteryTerm > $currTerm) {
         // If the lottery term is in the future
         $termList[] = $this->lotteryTerm;
     }
     foreach ($termList as $t) {
         $termBlock = new StudentMenuTermBlock($this->student, $t);
         $tpl['TERMBLOCK'][] = array('TERMBLOCK_CONTENT' => $termBlock->show());
     }
     Layout::addPageTitle("Main Menu");
     return PHPWS_Template::process($tpl, 'hms', 'student/returningMenu.tpl');
 }
 public function execute(CommandContext $context)
 {
     // Check permissions
     if (!Current_User::allow('hms', 'checkin')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to checkin students.');
     }
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     $term = Term::getCurrentTerm();
     $bannerId = $context->get('banner_id');
     $hallId = $context->get('residence_hall_hidden');
     $errorCmd = CommandFactory::getCommand('ShowCheckinStart');
     if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Missing Banner ID.');
         $errorCmd->redirect();
     }
     if (!isset($hallId)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
         $errorCmd->redirect();
     }
     if (preg_match("/^[\\d]{9}\$/", $bannerId) == false) {
         NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, that didn't look like a valid ID number. Please try again.");
         $errorCmd->redirect();
     }
     // Try to lookup the student in Banner
     try {
         StudentFactory::getStudentByBannerId($bannerId, $term);
     } catch (StudentNotFoundException $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
         $errorCmd->redirect();
     }
     // Everything checks out, so redirect to the form
     $cmd = CommandFactory::getCommand('ShowCheckinForm');
     $cmd->setBannerId($bannerId);
     $cmd->setHallId($hallId);
     $cmd->redirect();
 }
 public function execute(CommandContext $context)
 {
     $applicationId = $context->get('applicationId');
     if (!isset($applicationId)) {
         throw new InvalidArgumentException('Missing application id.');
     }
     PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
     $application = HousingApplicationFactory::getApplicationById($applicationId);
     $student = $application->getStudent();
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     // Decide which term to use - If this application is in a past fall term, then use the current term
     $term = $application->getTerm();
     if ($term < Term::getCurrentTerm() && Term::getTermSem($term) == TERM_FALL) {
         $assignmentTerm = Term::getCurrentTerm();
     } else {
         $assignmentTerm = $term;
     }
     $assignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $assignmentTerm);
     PHPWS_Core::initModClass('hms', 'HousingApplicationCancelView.php');
     $view = new HousingApplicationCancelView($student, $application, $assignment);
     echo $view->show();
     exit;
 }