Ejemplo n.º 1
0
 public function show()
 {
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (isset($this->profile) && !is_null($this->profile)) {
         $tpl['ICON'] = FEATURE_COMPLETED_ICON;
         $editCmd = CommandFactory::getCommand('ShowRoommateProfileForm');
         $editCmd->setTerm($this->term);
         $tpl['EDIT_PROFILE'] = $editCmd->getLink('view and edit your profile');
     } else {
         if (time() < $this->startDate) {
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
         } else {
             if (time() > $this->endDate) {
                 $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
                 // fade out header
                 $tpl['STATUS'] = "locked";
                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
             } else {
                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                 $createCmd = CommandFactory::getCommand('ShowRoommateProfileForm');
                 $createCmd->setTerm($this->term);
                 $tpl['CREATE_PROFILE'] = $createCmd->getLink('Create your profile');
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/StudentProfileMenuBlock.tpl');
 }
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (!is_null($this->application) && $this->application->getApplicationType() == 'offcampus_waiting_list') {
         $tpl['ICON'] = FEATURE_COMPLETED_ICON;
         $tpl['ALREADY_APPLIED'] = "";
     } else {
         if (time() < $this->startDate) {
             $tpl['ICON'] = FEATURE_NOTYET_ICON;
             $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
         } else {
             if (time() > $this->endDate) {
                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
                 // fade out header
                 $tpl['STATUS'] = "locked";
                 $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
             } else {
                 //TODO
                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                 $waitListCommand = CommandFactory::getCommand('ShowOffCampusWaitListApplication');
                 $waitListCommand->setTerm($this->term);
                 $tpl['WAIT_LIST_LINK'] = $waitListCommand->getLink('Apply to the waiting list');
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/OffCampusWaitingListMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     if (is_null($this->application)) {
         // No application
         $tpl['ICON'] = FEATURE_NOTYET_ICON;
         $tpl['NOT_APP'] = "";
         // this needs to be here to trigger the line in the template
     } else {
         if (time() < $this->startDate) {
             // too early
             $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
             $tpl['ICON'] = FEATURE_NOTYET_ICON;
         } else {
             if (time() > $this->endDate) {
                 // too late
                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
                 $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
             } else {
                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                 $cmd = CommandFactory::getCommand('ShowEmergencyContactForm');
                 $cmd->setTerm($this->application->getTerm());
                 $tpl['UPDATE_CONTACT'] = $cmd->getLink('update your emergency contact info');
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/updateEmergencyContactMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (time() < $this->startDate) {
         $tpl['ICON'] = FEATURE_NOTYET_ICON;
         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
     } else {
         if (time() > $this->endDate) {
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             // fade out header
             $tpl['STATUS'] = "locked";
             $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
         } else {
             if (is_null($this->profile)) {
                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                 $tpl['NO_PROFILE'] = '';
             } else {
                 $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                 $searchCmd = CommandFactory::getCommand('ShowRoommateProfileSearch');
                 $searchCmd->setTerm($this->term);
                 $tpl['SEARCH_ROOMMATES'] = $searchCmd->getLink('Search roommate profiles.');
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/searchProfilesMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     // Don't show the app-feature if it's not time
     if ($this->startDate <= time()) {
         $cmd = CommandFactory::getCommand('ShowVerifyAssignment');
         $cmd->setUsername($this->student->getUsername());
         $tpl['VIEW_APP'] = $cmd->getLink('here');
         $tpl['ICON'] = FEATURE_OPEN_ICON;
         return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/verifyAssignmentMenuBlock.tpl');
     } else {
         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
         $tpl['ICON'] = FEATURE_NOTYET_ICON;
         return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/verifyAssignmentMenuBlock.tpl');
     }
 }
Ejemplo n.º 6
0
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'RoomChangeParticipantFactory.php');
     $tpl = array();
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     if (time() < $this->startDate) {
         // too early
         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
         $tpl['ICON'] = FEATURE_NOTYET_ICON;
     } else {
         if (time() > $this->endDate) {
             // too late
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
         } else {
             if (is_null($this->assignment)) {
                 // Not assigned anywhere
                 $tpl['ICON'] = FEATURE_NOTYET_ICON;
                 $tpl['NOT_ASSIGNED'] = "";
             } else {
                 if (!is_null($this->changeRequest) && !$this->changeRequest->getState() instanceof CompletedChangeRequest && !$this->changeRequest->getState() instanceof DeniedChangeRequest) {
                     // has pending request
                     // Currently has a request open, so check to see if this student has approved it
                     $participant = RoomChangeParticipantFactory::getParticipantByRequestStudent($this->changeRequest, $this->student);
                     $state = $participant->getState();
                     // If this student needs to approve their part of this request
                     if ($state instanceof ParticipantStateNew) {
                         $approvalCmd = CommandFactory::getCommand('ShowRoomChangeRequestApproval');
                         $tpl['APPROVAL_CMD'] = $approvalCmd->getLink('View the request');
                     } else {
                         // Request if pending, but this student doesn't need to do anything
                         $tpl['PENDING'] = "";
                     }
                     $tpl['ICON'] = FEATURE_OPEN_ICON;
                 } else {
                     $tpl['ICON'] = FEATURE_OPEN_ICON;
                     $changeReqCmd = CommandFactory::getCommand('ShowRoomChangeRequestForm');
                     $tpl['NEW_REQUEST'] = $changeReqCmd->getLink('request a room change');
                 }
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/roomChangeMenuBlock.tpl');
 }
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $tpl = array();
     $now = time();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if ($this->startDate > $now) {
         // Too early!
         $tpl['ICON'] = FEATURE_NOTYET_ICON;
         $tpl['BEGIN_DEADLINE'] = HMS_Util::get_long_date_time($this->startDate);
     } else {
         if ($this->endDate < $now) {
             // Too late
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             // fade out header
             $tpl['STATUS'] = "locked";
             $tpl['END_DEADLINE'] = HMS_Util::get_long_date_time($this->endDate);
         } else {
             if (!isset($this->application)) {
                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
                 $tpl['STATUS'] = "locked";
                 $tpl['DID_NOT_APPLY'] = "";
             } else {
                 if (isset($this->application) && isset($this->application->waiting_list_date)) {
                     $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                     $tpl['SIGNED_UP'] = "";
                 } else {
                     if (isset($this->application)) {
                         $tpl['ICON'] = FEATURE_OPEN_ICON;
                         $cmd = CommandFactory::getCommand('ShowWaitingListSignup');
                         $cmd->setTerm($this->term);
                         $tpl['APPLY_LINK'] = $cmd->getLink("apply to the On-campus Housing Waiting List");
                     } else {
                     }
                 }
             }
         }
     }
     Layout::addPageTitle("Re-Application Waiting List");
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/reApplicationWaitingListMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     // Show availability dates!
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (time() < $this->startDate) {
         $tpl['ICON'] = FEATURE_NOTYET_ICON;
         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
     } else {
         if (time() > $this->endDate) {
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             // fade out header
             $tpl['STATUS'] = "locked";
             $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
         } else {
             if (is_null($this->application)) {
                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                 $cmd = CommandFactory::getCommand('ShowHousingApplicationForm');
                 $cmd->setTerm($this->term);
                 $tpl['APP_NOW'] = $cmd->getURI();
             } else {
                 $appCommand = CommandFactory::getCommand('ShowApplicationView');
                 if (!is_null($this->application)) {
                     $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                     $appCommand->setAppId($this->application->id);
                 }
                 $tpl['VIEW_APP'] = $appCommand->getLink('view your application');
                 if (time() < $this->editDate) {
                     $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                     $newApp = CommandFactory::getCommand('ShowHousingApplicationForm');
                     $newApp->setTerm($this->term);
                     $tpl['NEW_APP'] = $newApp->getLink('submit a new application');
                 }
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/applicationMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (!is_null($this->rlcAssignment) && !is_null($this->roomAssignment) && $this->rlcAssignment->getStateName() == 'selfselect-assigned') {
         $tpl['ICON'] = FEATURE_COMPLETED_ICON;
         $tpl['SELF_ASSIGNMENT'] = $this->roomAssignment->where_am_i();
         $tpl['ASSIGNED_COMMUNITY_NAME'] = $this->rlcAssignment->getRlcName();
     } else {
         if (!is_null($this->rlcAssignment) && !is_null($this->roomAssignment)) {
             // Student is already assigned, but didn't self-select
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             $tpl['ASSIGNMENT'] = '';
         } else {
             if (time() < $this->startDate) {
                 // To early
                 $tpl['ICON'] = FEATURE_NOTYET_ICON;
                 $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
             } else {
                 if (time() > $this->endDate) {
                     // Too late
                     $tpl['ICON'] = FEATURE_LOCKED_ICON;
                     // fade out header
                     $tpl['STATUS'] = "locked";
                     $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
                 } else {
                     if (is_null($this->rlcAssignment)) {
                         // Student has no RLC assignment, therefore is not eligible
                         $tpl['ICON'] = FEATURE_LOCKED_ICON;
                         $tpl['NOT_ELIGIBLE'] = "";
                         //dummy tag, text is in template
                     } else {
                         if ($this->rlcAssignment->getStateName() == 'selfselect-invite') {
                             // Student has a pending invite to self-select a room
                             $tpl['ICON'] = FEATURE_OPEN_ICON;
                             $rlcId = $this->rlcAssignment->getRlcId();
                             $rlcList = RlcFactory::getRlcList($this->term);
                             $tpl['INVITED_COMMUNITY_NAME'] = $rlcList[$rlcId];
                             $cmd = CommandFactory::getCommand('RlcSelfAssignStart');
                             $cmd->setTerm($this->term);
                             $tpl['SELECT_LINK'] = $cmd->getLink('accept the invitation and select a room');
                         } else {
                             // Deadlines are open, but student isn't eligible
                             $tpl['ICON'] = FEATURE_LOCKED_ICON;
                             $tpl['NOT_ELIGIBLE'] = "";
                             //dummy tag, text is in template
                         }
                     }
                 }
             }
         }
     }
     // Show roommate requests, if any
     if (time() > $this->startDate && $this->roommateRequests != false && !is_null($this->roommateRequests) && $this->roomAssignment != true && !PEAR::isError($this->roomAssignment)) {
         $tpl['roommates'] = array();
         $tpl['ROOMMATE_REQUEST'] = '';
         // dummy tag
         foreach ($this->roommateRequests as $invite) {
             $cmd = CommandFactory::getCommand('LotteryShowRoommateRequest');
             $cmd->setRequestId($invite['id']);
             $roommie = StudentFactory::getStudentByUsername($invite['requestor'], $this->term);
             $tpl['roommates'][]['ROOMMATE_LINK'] = $cmd->getLink($roommie->getName());
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/rlcSelfSelection.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     $hardCapReached = LotteryProcess::hardCapReached($this->term);
     if (!is_null($this->assignment)) {
         // Student has already been assigned.
         $tpl['ICON'] = FEATURE_COMPLETED_ICON;
         //$tpl['ASSIGNED'] = $this->assignment->where_am_i();
         $tpl['ASSIGNED'] = '';
     } else {
         if ($hardCapReached) {
             // Hard cap has been reached
             $tpl['ICON'] = FEATURE_LOCKED_ICON;
             $tpl['HARD_CAP'] = "";
             // dummy tag
         } else {
             if (!is_null($this->application) && $this->application->isWinner()) {
                 // Student has won, let them choose their room
                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                 $chooseRoomCmd = CommandFactory::getCommand('LotteryShowChooseHall');
                 $tpl['SELECT_LINK'] = $chooseRoomCmd->getLink('Click here to select your room');
             } else {
                 if (!is_null($this->application)) {
                     // Student has already re-applied
                     $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                     $tpl['ALREADY_APPLIED'] = "";
                     // dummy tag, text is in template
                 } else {
                     if (time() < $this->startDate) {
                         // Too early
                         $tpl['ICON'] = FEATURE_NOTYET_ICON;
                         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
                     } else {
                         if (time() > $this->endDate) {
                             // Too late
                             $tpl['ICON'] = FEATURE_LOCKED_ICON;
                             // fade out header
                             $tpl['STATUS'] = "locked";
                             $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
                         } else {
                             if (HMS_Lottery::determineEligibility(UserStatus::getUsername())) {
                                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                                 $reAppCommand = CommandFactory::getCommand('ShowReApplication');
                                 $reAppCommand->setTerm($this->term);
                                 $tpl['ELIGIBLE'] = "";
                                 //dummy tag, text is in template
                                 $tpl['LOTTERY_TERM_1'] = Term::toString($this->term);
                                 $tpl['NEXT_TERM_1'] = Term::toString(Term::getNextTerm($this->term));
                                 $tpl['ENTRY_LINK'] = $reAppCommand->getLink('Click here to re-apply.');
                             } else {
                                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
                                 $tpl['NOT_ELIGIBLE'] = "";
                                 //dummy tag, text is in template
                                 $tpl['LOTTERY_TERM_2'] = Term::toString($this->term);
                                 $tpl['NEXT_TERM_2'] = Term::toString(Term::getNextTerm($this->term));
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$hardCapReached && time() > $this->startDate) {
         if ($this->roommateRequests != FALSE && !is_null($this->roommateRequests) && $this->assignment != TRUE && !PEAR::isError($this->assignment)) {
             $tpl['roommates'] = array();
             $tpl['ROOMMATE_REQUEST'] = '';
             // dummy tag
             foreach ($this->roommateRequests as $invite) {
                 $cmd = CommandFactory::getCommand('LotteryShowRoommateRequest');
                 $cmd->setRequestId($invite['id']);
                 $roommie = StudentFactory::getStudentByUsername($invite['requestor'], $this->term);
                 $tpl['roommates'][]['ROOMMATE_LINK'] = $cmd->getLink($roommie->getName());
                 //$tpl['roommates'][]['ROOMMATE_LINK'] = PHPWS_Text::secureLink(HMS_SOAP::get_name($invite['requestor']), 'hms', array('type'=>'student', 'op'=>'lottery_show_roommate_request', 'id'=>$invite['id']));
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/reApplicationMenuBlock.tpl');
 }
Ejemplo n.º 11
0
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (isset($this->assignment) && $this->assignment->getStateName() == 'declined') {
         // Student declined the invite
         $tpl['ICON'] = FEATURE_LOCKED_ICON;
         $tpl['DECLINED'] = "";
         //dummy tag
     } else {
         if (isset($this->application) && !is_null($this->application->id) && isset($this->assignment) && $this->assignment->getStateName() == 'confirmed') {
             // Student has applied, been accepted, been invited, and confirmed that invitation to a particular community. The student can no longer view/edit the application.
             $tpl['ICON'] = FEATURE_COMPLETED_ICON;
             $tpl['CONFIRMED_RLC_NAME'] = $this->assignment->getRlcName();
         } else {
             if (isset($this->assignment) && $this->assignment->getStateName() == 'invited') {
                 // Studnet has applied, been assigned, and been sent an invite email
                 $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                 $tpl['INVITED_COMMUNITY_NAME'] = $this->assignment->getRlcName();
                 $acceptCmd = CommandFactory::getCommand('ShowAcceptRlcInvite');
                 $acceptCmd->setTerm($this->term);
                 $tpl['INVITED_CONFIRM_LINK'] = $acceptCmd->getLink('accept or decline your invitation');
             } else {
                 if (isset($this->application) && !is_null($this->application->id)) {
                     $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                     // Let student view their application
                     $viewCmd = CommandFactory::getCommand('ShowRlcApplicationReView');
                     $viewCmd->setAppId($this->application->getId());
                     $tpl['VIEW_APP'] = $viewCmd->getLink('view your application');
                     // The student can also delete their application if
                     // they aren't already assigned
                     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
                     if (!HMS_RLC_Assignment::checkForAssignment(UserStatus::getUsername(), $this->term)) {
                         $delCmd = CommandFactory::getCommand('DeleteRlcApplication');
                         $delCmd->setTerm($this->term);
                         $confCmd = CommandFactory::getCommand('JSConfirm');
                         $confCmd->setLink('delete your application');
                         $confCmd->setTitle('delete your application');
                         $confCmd->setQuestion('Are you sure you want to delete your RLC Application?');
                         $confCmd->setOnConfirmCommand($delCmd);
                         $tpl['DELETE_TEXT'] = 'You may also ';
                         $tpl['DELETE_APP'] = $confCmd->getLink('delete your application') . '.';
                     }
                     if (time() < $this->editDate) {
                         $newCmd = CommandFactory::getCommand('ShowRlcApplicationView');
                         $newCmd->setTerm($this->term);
                         $tpl['NEW_APP'] = $newCmd->getLink('submit a new application');
                     }
                 } else {
                     if (time() < $this->startDate) {
                         $tpl['ICON'] = FEATURE_LOCKED_ICON;
                         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
                     } else {
                         if (time() > $this->endDate) {
                             $tpl['ICON'] = FEATURE_LOCKED_ICON;
                             // fade out header
                             $tpl['STATUS'] = "locked";
                             $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
                         } else {
                             $tpl['ICON'] = FEATURE_OPEN_ICON;
                             $applyCmd = CommandFactory::getCommand('ShowRlcApplicationView');
                             $applyCmd->setTerm($this->term);
                             $tpl['APP_NOW'] = $applyCmd->getLink('Apply for a Residential Learning Community now.');
                         }
                     }
                 }
             }
         }
     }
     Layout::addPageTitle("RLC Application Menu");
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/RlcApplicationMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $roommate = HMS_Roommate::get_confirmed_roommate(UserStatus::getUsername(), $this->term);
     $requests = HMS_Roommate::countPendingRequests(UserStatus::getUsername(), $this->term);
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     // Roommate has been selected and confirmed
     if (!is_null($roommate)) {
         $name = $roommate->getFullName();
         $tpl['ROOMMATE_MSG'] = "<b>{$name}</b> has confirmed your roommate request. Roommate requests are subject to space availability.";
         $tpl['ICON'] = FEATURE_COMPLETED_ICON;
         if (time() < $this->editDate) {
             $cmd = CommandFactory::GetCommand('ShowRoommateBreak');
             $rm = HMS_Roommate::getByUsernames(UserStatus::getUsername(), $roommate->getUsername(), $this->term);
             $cmd->setRoommateId($rm->id);
             $tpl['ROOMMATE_BREAK'] = $cmd->getLink('Remove roommate request');
         }
     } else {
         if (time() < $this->startDate) {
             $tpl['ROOMMATE_MSG'] = '<b>It is too early to choose a roommate.</b> You can choose a roommate on ' . HMS_Util::getFriendlyDate($this->startDate) . '.';
             $tpl['ICON'] = FEATURE_NOTYET_ICON;
         } else {
             if (time() > $this->endDate) {
                 $tpl['ROOMMATE_MSG'] = '<b>It is too late to choose a roommate.</b> The deadline passed on ' . HMS_Util::getFriendlyDate($this->endDate) . '.';
                 // fade out header
                 $tpl['STATUS'] = "locked";
                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
             } else {
                 if ($requests > 0) {
                     $tpl['ROOMMATE_REQUESTS'] = HMS_Roommate::display_requests(UserStatus::getUsername(), $this->term);
                     if ($requests == 1) {
                         $tpl['ROOMMATE_REQUESTS_MSG'] = "<b style='color: #F00'>You have a roommate request.</b> Please click the name below to confirm or reject the request.";
                     } else {
                         $tpl['ROOMMATE_REQUESTS_MSG'] = "<b style='color: #F00'>You have roommate requests.</b> Please click a name below to confirm or reject a request.";
                     }
                 } else {
                     if (HMS_Roommate::has_roommate_request(UserStatus::getUsername(), $this->term)) {
                         $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                         $tpl['ROOMMATE_MSG'] = "<b>You have selected a roommate</b> and are awaiting their approval.";
                         $requestee = HMS_Roommate::get_unconfirmed_roommate(UserStatus::getUsername(), $this->term);
                         if (time() < $this->editDate) {
                             $rm = HMS_Roommate::getByUsernames(UserStatus::getUsername(), $requestee, $this->term);
                             $cmd = CommandFactory::getCommand('RoommateRequestCancel');
                             $cmd->setRoommateId($rm->id);
                             $tpl['ROOMMATE_BREAK'] = $cmd->getLink('Cancel Request');
                         }
                     } else {
                         $tpl['ICON'] = FEATURE_OPEN_ICON;
                         $tpl['ROOMMATE_MSG'] = 'If you know who you want your roommate to be, <b>you may select your roommate now</b>. You will need to know your roommate\'s ASU user name (their e-mail address). You have until ' . HMS_Util::getFriendlyDate($this->endDate) . ' to choose a roommate. Click the link below to select your roommate.';
                         $cmd = CommandFactory::getCommand('ShowRequestRoommate');
                         $cmd->setTerm($this->term);
                         $tpl['ROOMMATE_LINK'] = $cmd->getLink('Select Your Roommate');
                     }
                 }
             }
         }
     }
     Layout::addPageTitle("Roommate Selection");
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/roommateMenuBlock.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
     $tpl['STATUS'] = "";
     if (isset($this->assignment) && $this->assignment->getStateName() == 'declined') {
         // Student declined the invite
         $tpl['ICON'] = FEATURE_LOCKED_ICON;
         $tpl['DECLINED'] = "";
         //dummy tag
     } else {
         if (isset($this->application) && !is_null($this->application->id) && isset($this->assignment) && $this->assignment->getStateName() == 'confirmed') {
             // Student has applied, been accepted, been invited, and confirmed that invitation to a particular community. The student can no longer view/edit the application.
             $tpl['ICON'] = FEATURE_COMPLETED_ICON;
             $tpl['CONFIRMED_RLC_NAME'] = $this->assignment->getRlcName();
         } else {
             if (isset($this->assignment) && $this->assignment->getStateName() == 'invited') {
                 // Studnet has applied, been assigned, and been sent an invite email
                 $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                 $tpl['INVITED_COMMUNITY_NAME'] = $this->assignment->getRlcName();
                 $acceptCmd = CommandFactory::getCommand('ShowAcceptRlcInvite');
                 $acceptCmd->setTerm($this->term);
                 $tpl['INVITED_CONFIRM_LINK'] = $acceptCmd->getLink('accept or decline your invitation');
             } else {
                 if (!is_null($this->rlcApp)) {
                     // Student has already re-applied
                     $tpl['ICON'] = FEATURE_COMPLETED_ICON;
                     $tpl['ALREADY_APPLIED'] = "";
                     // dummy tag, text is in template
                 } else {
                     if (time() < $this->startDate) {
                         // Too early
                         $tpl['ICON'] = FEATURE_NOTYET_ICON;
                         $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
                     } else {
                         if (time() > $this->endDate) {
                             // Too late
                             $tpl['ICON'] = FEATURE_LOCKED_ICON;
                             // fade out header
                             $tpl['STATUS'] = "locked";
                             $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
                         } else {
                             // Student has not re-applied yet
                             if (is_null($this->application)) {
                                 # No housing application, therefore not eligible
                                 $tpl['ICON'] = FEATURE_LOCKED_ICON;
                                 $tpl['NOT_ELIGIBLE'] = "";
                                 //dummy tag, text is in template
                                 $tpl['LOTTERY_TERM_2'] = Term::toString($this->term);
                                 $tpl['NEXT_TERM_2'] = Term::toString(Term::getNextTerm($this->term));
                             } else {
                                 # Eligible
                                 $tpl['ICON'] = FEATURE_OPEN_ICON;
                                 $reAppCommand = CommandFactory::getCommand('ShowRlcReapplication');
                                 $reAppCommand->setTerm($this->term);
                                 $tpl['ELIGIBLE'] = "";
                                 //dummy tag, text is in template
                                 $tpl['LOTTERY_TERM_1'] = Term::toString($this->term);
                                 $tpl['NEXT_TERM_1'] = Term::toString(Term::getNextTerm($this->term));
                                 $tpl['ENTRY_LINK'] = $reAppCommand->getLink('Click here to re-apply.');
                             }
                         }
                     }
                 }
             }
         }
     }
     return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/rlcReapplicationMenuBlock.tpl');
 }