public function show() { //Seriously php? Can't resolve context without this? Fail. $context = $this->context; $template = array(); $cmd = CommandFactory::getCommand('SubmitRlcApplication'); $rlc_form2 = new PHPWS_Form(); $cmd->initForm($rlc_form2); // Add hidden fields for fields from page 1 $rlc_form2->addHidden('first_name', $context->get('first_name')); $rlc_form2->addHidden('middle_name', $context->get('middle_name')); $rlc_form2->addHidden('last_name', $context->get('last_name')); $rlc_form2->addHidden('rlc_first_choice', $context->get('rlc_first_choice')); $rlc_form2->addHidden('rlc_second_choice', $context->get('rlc_second_choice')); $rlc_form2->addHidden('rlc_third_choice', $context->get('rlc_third_choice')); $rlc_form2->addHidden('why_specific_communities', $context->get('why_specific_communities')); $rlc_form2->addHidden('strengths_weaknesses', $context->get('strengths_weaknesses')); $rlc_form2->addHidden('term', $context->get('term')); $rlcIds = array($context->get('rlc_first_choice'), $context->get('rlc_second_choice'), $context->get('rlc_third_choice')); for ($i = 0; $i < 3; $i++) { # Skip the question lookup if "none" was selected if ($rlcIds[$i] == -1) { continue; } $rlc = new HMS_Learning_Community($rlcIds[$i]); // If we're missing a question... send them back. We might could throw an exception here. $question = $rlc->getFreshmenQuestion(); if (!isset($question)) { NQ::simple('hms', hms\NotificationView::ERROR, "There was an error looking up the community questions."); $cmd = CommandFactory::getCommand('ShowRlcApplicationPage1View'); $cmd->setTerm($context->get('term')); $cmd->redirect(); } $rlc_form2->addTextArea("rlc_question_{$i}"); $rlc_form2->setLabel("rlc_question_{$i}", $rlc->getFreshmenQuestion()); $rlc_form2->addCssClass("rlc_question_{$i}", 'form-control'); } $rlc_form2->mergeTemplate($template); $template = $rlc_form2->getTemplate(); Layout::addPageTitle("RLC Application"); javascript('jquery'); return PHPWS_Template::process($template, 'hms', 'student/rlc_signup_form_page2.tpl'); }