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'); }
public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'ApplicationFeature.php'); PHPWS_Core::initModClass('hms', 'StudentFactory.php'); PHPWS_Core::initModClass('hms', 'HousingApplication.php'); PHPWS_Core::initModClass('hms', 'HousingApplicationWelcomeView.php'); $term = $context->get('term'); $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term); $submitCmd = CommandFactory::getCommand('ShowHousingApplicationForm'); $submitCmd->setTerm($term); //TODO get rid of the magic string $feature = ApplicationFeature::getInstanceByNameAndTerm('Application', $term); // If there is no feature, or if we're not inside the feature's deadlines... if (is_null($feature) || $feature->getStartDate() > time() || $feature->getEndDate() < time() || !$feature->isEnabled()) { PHPWS_Core::initModClass('hms', 'HousingApplicationNotAvailableView.php'); $view = new HousingApplicationNotAvailableView($student, $feature, $term); } else { $requiredTerms = HousingApplication::getAvailableApplicationTermsForStudent($student); $view = new HousingApplicationWelcomeView($student, $submitCmd, $requiredTerms); } $context->setContent($view->show()); }