public function show() { $tpl = array(); $tpl['ENTRY_TERM'] = Term::toString($this->student->getApplicationTerm()); $tpl['REQUIRED_TERMS'] = array(); $appsOnFile = HousingApplication::getAllApplicationsForStudent($this->student); # Make a list of the terms the student has completed $termsOnFile = array(); if (isset($appsOnFile) && !is_null($appsOnFile)) { foreach ($appsOnFile as $term => $app) { $termsOnFile[] = $term; } } foreach ($this->requiredTerms as $t) { if ($t['required'] == 0) { continue; } $completed = ''; if (in_array($t['term'], $termsOnFile)) { $completed = ' <span style="color: #0000AA">(Completed)</span>'; } // If the application is cancelled, overwrite the "complete" text with "cancelled" if (isset($appsOnFile[$t['term']]) && $appsOnFile[$t['term']]->isCancelled()) { $completed = ' <span style="color: #F00">(Cancelled)</span>'; } if (Term::getTermSem($t['term']) == TERM_FALL) { $tpl['REQUIRED_TERMS'][] = array('REQ_TERM' => Term::toString($t['term']) . ' - ' . Term::toString(Term::getNextTerm($t['term'])), 'COMPLETED' => $completed); } else { $tpl['REQUIRED_TERMS'][] = array('REQ_TERM' => Term::toString($t['term']), 'COMPLETED' => $completed); } } $contactCmd = CommandFactory::getCommand('ShowContactForm'); $tpl['CONTACT_LINK'] = $contactCmd->getLink('contact us'); # Setup the form for the 'continue' button. $form = new PHPWS_Form(); $this->submitCmd->initForm($form); $form->mergeTemplate($tpl); $tpl = $form->getTemplate(); $studentType = $this->student->getType(); Layout::addPageTitle("Welcome"); if (count($appsOnFile) > 0) { // User is now past step one. No longer just welcoming, we are now welcoming back. return PHPWS_Template::process($tpl, 'hms', 'student/welcome_back_screen.tpl'); } if ($studentType == TYPE_FRESHMEN || $studentType == TYPE_NONDEGREE || $this->student->isInternational()) { return PHPWS_Template::process($tpl, 'hms', 'student/welcome_screen_freshmen.tpl'); } else { return PHPWS_Template::process($tpl, 'hms', 'student/welcome_screen_transfer.tpl'); } }
public function show() { $terms = HousingApplication::getAvailableApplicationTermsForStudent($this->student); $applications = HousingApplication::getAllApplicationsForStudent($this->student); $tpl = array(); foreach ($terms as $t) { # If the student has a withdrawn application, # then show a message instead of the normal menu block. if (isset($applications[$t['term']]) && $applications[$t['term']]->isCancelled()) { $termBlock = new StudentMenuWithdrawnTermBlock($this->student, $t['term']); } else { // Look up the student again in each term, because student type can change depending on which term we ask about $student = StudentFactory::getStudentByBannerId($this->student->getBannerId(), $t['term']); $termBlock = new StudentMenuTermBlock($student, $t['term']); } $tpl['TERMBLOCK'][] = array('TERMBLOCK_CONTENT' => $termBlock->show()); } Layout::addPageTitle("Main Menu"); return PHPWS_Template::process($tpl, 'hms', 'student/freshmenMenu.tpl'); }
/** * $roommates is the focus of getProfileView(). It's structure is helpful in * StudentProfileView. It also makes it a little easier to recognize which roommmates * are requested ones so they can be emphasized in the template (admin/fancy-student-info.tpl) * Note that a student can only have a single pending/confirmed roommate request but multiple * assigned roommates! * */ public function getProfileView() { PHPWS_Core::initModClass('hms', 'StudentProfileView.php'); PHPWS_Core::initModClass('hms', 'HMS_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Roommate.php'); PHPWS_Core::initModClass('hms', 'HousingApplication.php'); PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php'); PHPWS_Core::initModClass('hms', 'HMS_Bed.php'); $studentUsername = $this->student->getUsername(); $assignment = HMS_Assignment::getAssignmentByBannerId($this->student->getBannerId(), $this->term); $pendingRoommate = HMS_Roommate::get_pending_roommate($studentUsername, $this->term); $confirmedRoommate = HMS_Roommate::get_confirmed_roommate($studentUsername, $this->term); if (!is_null($assignment)) { $assignedRoommates = $assignment->get_parent()->get_parent()->get_assignees(); } // // If student is assigned to room... // if (!is_null($assignment)) { foreach ($assignedRoommates as $roomie) { // make sure $roomie isn't the student being profiled or the requested roomies if ($roomie != FALSE && $roomie->getUsername() != $studentUsername) { $roomieUsername = $roomie->getUsername(); if (is_null($confirmedRoommate) || $roomieUsername != $confirmedRoommate->getUsername()) { if (is_null($pendingRoommate) || $roomieUsername != $pendingRoommate->getUsername()) { // Get student object and room link $roomLink = $this->getRoommateRoomLink($roomie->getUsername()); // if $roomie was assigned but not requested $this->roommates['ASSIGNED'][] = $roomie->getProfileLink() . " - {$roomLink}"; } } } } } // // Check status of requested roommates // if (!is_null($confirmedRoommate)) { if (!is_null($assignment)) { $confirmedRmAssignment = HMS_Assignment::getAssignment($confirmedRoommate->getUsername(), $this->term); if (!is_null($confirmedRmAssignment)) { // if confirmed roommate is assigned to different room than profile student if ($assignment->get_parent()->room_id != $confirmedRmAssignment->get_parent()->room_id) { $this->setRoommateVar($confirmedRoommate, "confirmed", "mismatched_rooms"); } else { $this->setRoommateVar($confirmedRoommate, "confirmed"); } } else { // if profile student's room is full if (!$assignment->get_parent()->get_parent()->has_vacancy()) { $this->setRoommateVar($confirmedRoommate, "confirmed", "no_bed_available"); } else { $this->setRoommateVar($confirmedRoommate, "confirmed"); } } } else { $this->setRoommateVar($confirmedRoommate, "confirmed"); } } else { if (!is_null($pendingRoommate)) { if (!is_null($assignment)) { $pendingRmAssignment = HMS_Assignment::getAssignment($pendingRoommate->getUsername(), $this->term); if (!is_null($pendingRmAssignment)) { // if pending roommate is assigned to different room than profile student if ($assignment->get_parent()->room_id != $pendingRmAssignment->get_parent()->room_id) { $this->setRoommateVar($pendingRoommate, "pending", "mismatched_rooms"); } else { $this->setRoommateVar($pendingRoommate, "pending"); } } else { // if profile student's room is full if (!$assignment->get_parent()->get_parent()->has_vacancy()) { $this->setRoommateVar($pendingRoommate, "pending", "no_bed_available"); } else { $this->setRoommateVar($pendingRoommate, "pending"); } } } else { $this->setRoommateVar($pendingRoommate, "pending"); } } } $applications = HousingApplication::getAllApplicationsForStudent($this->student); $subTypeApps = array(); // Convert each of the general HousingApplication objets to its specific sub type (e.g. FallApplication) foreach ($applications as $app) { $subTypeApps[] = HousingApplicationFactory::getApplicationById($app->id); } return new StudentProfileView($this->student, $subTypeApps, $assignment, $this->roommates); }