public function show() { PHPWS_Core::initModClass('hms', 'HMS_Lottery.php'); PHPWS_Core::initModClass('hms', 'LotteryApplication.php'); $this->setTitle('Special Interest Group'); javascript('jquery'); $tpl = array(); $groups = HMS_Lottery::getSpecialInterestGroupsMap(); // If a group was selected if (!is_null($this->group) && $this->group != 'none') { $tpl['GROUP_PAGER'] = LotteryApplication::specialInterestPager($this->group, PHPWS_Settings::get('hms', 'lottery_term')); $tpl['GROUP'] = $groups[$this->group]; } // Show the drop down box of groups $form = new PHPWS_Form('special_interest'); $form->setMethod('get'); $form->addDropBox('group', $groups); $form->setClass('group', 'form-control'); $form->setMatch('group', $this->group); $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval'); $cmd->initForm($form); $form->mergeTemplate($tpl); $tpl = $form->getTemplate(); return PHPWS_Template::process($tpl, 'hms', 'admin/special_interest_approval.tpl'); }
public function execute(CommandContext $context) { // Check permissions if (!Current_User::allow('hms', 'special_interest_approval')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to approve special interest group requests.'); } PHPWS_Core::initModClass('hms', 'LotteryApplication.php'); if (is_null($context->get('id'))) { throw new InvalidArgumentException('Missing application id.'); } $app = new LotteryApplication($context->get('id')); $app->special_interest = null; $app->save(); NQ::simple('hms', hms\NotificationView::SUCCESS, "Removed {$app->getUsername()}"); $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval'); $cmd->setGroup($context->get('group')); $cmd->redirect(); }
public function execute(CommandContext $context) { if (!Current_User::allow('hms', 'lottery_admin')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to administer re-application features.'); } PHPWS_Core::initModClass('hms', 'LotteryApplication.php'); PHPWS_Core::initModClass('hms', 'StudentFactory.php'); $viewCmd = CommandFactory::getCommand('ShowLotteryAdminEntry'); //TODO: use the lottery term setting here instead? $term = Term::getSelectedTerm(); $username = $context->get('asu_username'); if (!isset($username) || empty($username)) { NQ::simple('hms', hms\NotificationView::ERROR, 'You must enter a valid user name.'); $viewCmd->redirect(); } try { $student = StudentFactory::getStudentByUsername($context->get('asu_username'), $term); } catch (StudentNotFoundException $e) { NQ::simple('hms', hms\NotificationView::ERROR, 'Inavlid user name. No student with that user name could be found.'); $viewCmd->redirect(); } $physicalDisability = $context->get('physical_disability'); $psychDisability = $context->get('psych_disability'); $genderNeed = $context->get('gender_need'); $medicalNeed = $context->get('medical_need'); $application = new LotteryApplication(0, $term, $student->getBannerId(), $student->getUsername(), $student->getGender(), $student->getType(), $student->getApplicationTerm(), null, BANNER_MEAL_STD, $physicalDisability, $psychDisability, $genderNeed, $medicalNeed, 0, NULL, 0, NULL, 0, 0, 0, 0); try { $application->save(); } catch (Exception $e) { NQ::simple('hms', hms\NotificationView::ERROR, 'There was a problem saving the application.'); $viewCmd->redirect(); } NQ::simple('hms', hms\NotificationView::SUCCESS, 'The lottery application was created successfully.'); $viewCmd->redirect(); }
/** * @return integer position of this LotteryApplication in the on-campus waiting list. */ public function getWaitListPosition() { if (!isset(self::$waitingList)) { self::$waitingList = self::getRemainingWaitListApplications($term = $this->getTerm()); } $position = array_search($this->getUsername(), self::$waitingList); if ($position === FALSE) { return 'unknown'; } // Fix the off-by-one indexing return $position + 1; }
public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'LotteryApplication.php'); PHPWS_Core::initModClass('hms', 'HousingApplication.php'); // Check permissions if (!Current_User::allow('hms', 'special_interest_approval')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to approve special interest group requests.'); } // Must have ID and group name set. if (is_null($context->get('id'))) { throw new InvalidArgumentException('Missing application id.'); } if (is_null($context->get('group'))) { throw new InvalidArgumentException('Missing interest group name.'); } // Load up application. $app = new LotteryApplication($context->get('id')); // Unset proper preference in student's application. switch ($context->get('group')) { case 'watauga_global': $app->setWataugaGlobalPref(0); break; case 'honors': $app->setHonorsPref(0); break; case 'teaching': $app->setTeachingFellowsPref(0); break; case 'sorority': $app->setSororityPref(0); break; case 'special_needs': $app->setPhysicalDisability(0); $app->setPsychDisability(0); $app->setMedicalNeed(0); $app->setGenderNeed(0); break; } // Save, notify, and buh-bye $app->save(); NQ::simple('hms', hms\NotificationView::SUCCESS, "Denied {$app->getUsername()}"); $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval'); $cmd->setGroup($context->get('group')); $cmd->redirect(); }
public function show() { Layout::addPageTitle("Lottery Waiting List"); return LotteryApplication::waitingListPager(); }
public function execute(CommandContext $context) { // Check to see if the user is coming back from DocuSign contract $event = $context->get('event'); if (isset($event) && $event != null && ($event == 'signing_complete' || $event == 'viewing_complete')) { $roommateRequestId = $context->get('roommateRequestId'); if (isset($roommateRequestId) && $roommateRequestId != null) { $roommateCmd = CommandFactory::getCommand('LotteryShowRoommateRequest'); $roommateCmd->setRequestId($roommateRequestId); $roommateCmd->redirect(); } else { $hallCmd = CommandFactory::getCommand('LotteryShowChooseHall'); $hallCmd->redirect(); } } $term = $context->get('term'); $errorCmd = CommandFactory::getCommand('RlcSelfAssignStart'); $errorCmd->setTerm($term); // Load the student $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term); // Load the RLC Assignment $rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($student->getUsername(), $term); // Check for accept or decline status $acceptance = $context->get('acceptance'); if (!isset($acceptance) || $acceptance == null) { NQ::simple('hms', hms\NotificationView::ERROR, 'Please indicate whether you accept or decline this invitation.'); $errorCmd->redirect(); } // Student declined if ($acceptance == 'decline') { // student declined $rlcAssignment->changeState(new RlcAssignmentDeclinedState($rlcAssignment)); NQ::simple('hms', hms\NotificationView::SUCCESS, 'You have <strong>declined</strong> your Residential Learning Community invitation.'); // Log this! HMS_Activity_Log::log_activity($student->getUsername(), ACTIVITY_DECLINE_RLC_INVITE, UserStatus::getUsername(), $rlcAssignment->getRlcName()); $menuCmd = CommandFactory::getCommand('ShowStudentMenu'); $menuCmd->redirect(); } $termsCheck = $context->get('terms_cond'); // Make sure student accepted the terms if ($acceptance == 'accept' && !isset($termsCheck)) { // Student accepted the invite, but didn't check the terms/conditions box NQ::simple('hms', hms\NotificationView::ERROR, 'Please check the box indicating that you agree to the learning communitiy terms and conditions.'); $errorCmd->redirect(); } // Check phone number $cellPhone = $context->get('cellphone'); $doNotCall = $context->get('do_not_call'); if (is_null($doNotCall) && (!isset($cellPhone) || $cellPhone == '')) { NQ::simple('hms', hms\NotificationView::ERROR, 'Please enter your cell phone number, or check the box to indicate you do not want to give a phone number.'); $errorCmd->redirect(); } /* Emergency Contact Sanity Checking */ $emergencyName = $context->get('emergency_contact_name'); $emergencyRelationship = $context->get('emergency_contact_relationship'); $emergencyPhone = $context->get('emergency_contact_phone'); $emergencyEmail = $context->get('emergency_contact_email'); if (empty($emergencyName) || empty($emergencyRelationship) || empty($emergencyPhone) || empty($emergencyEmail)) { NQ::simple('hms', hms\NotificationView::ERROR, 'Please complete all of the emergency contact person information.'); $errorCmd->redirect(); } /* Missing Persons Sanity Checking */ $missingPersonName = $context->get('missing_person_name'); $missingPersonRelationship = $context->get('missing_person_relationship'); $missingPersonPhone = $context->get('missing_person_phone'); $missingPersonEmail = $context->get('missing_person_email'); if (empty($missingPersonName) || empty($missingPersonRelationship) || empty($missingPersonPhone) || empty($missingPersonEmail)) { NQ::simple('hms', hms\NotificationView::ERROR, 'Please complete all of the missing persons contact information.'); $errorCmd->redirect(); } // Check for an existing housing application $housingApp = HousingApplicationFactory::getAppByStudent($student, $term, 'lottery'); if (is_null($housingApp)) { // Make a new Housing Application // TODO: imporve this to mirror the regular housing application... $housingApp = new LotteryApplication(0, $term, $student->getBannerId(), $student->getUsername(), $student->getGender(), 'C', $student->getApplicationTerm(), $cellPhone, BANNER_MEAL_STD, 0, 0, 0, 0, $student->isInternational(), NULL, 0, 0, 0, 0, 0, null); } else { // Update the existing cell phone $housingApp->setCellPhone($cellPhone); $housingApp->setEmergencyContactName($emergencyName); $housingApp->setEmergencyContactRelationship($emergencyRelationship); $housingApp->setEmergencyContactPhone($emergencyPhone); $housingApp->setEmergencyContactEmail($emergencyEmail); $housingApp->setMissingPersonName($missingPersonName); $housingApp->setMissingPersonRelationship($missingPersonRelationship); $housingApp->setMissingPersonPhone($missingPersonPhone); $housingApp->setMissingPersonEmail($missingPersonEmail); } $housingApp->save(); $returnCmd = CommandFactory::getCommand('RlcSelfSelectInviteSave'); $returnCmd->setTerm($term); // If we're confirming a roommate request, then set the ID on the return command $roommateRequestId = $context->get('roommateRequestId'); if (isset($roommateRequestId) && $roommateRequestId != null) { $returnCmd->setRoommateRequestId($roommateRequestId); } $agreementCmd = CommandFactory::getCommand('ShowTermsAgreement'); $agreementCmd->setTerm($term); $agreementCmd->setAgreedCommand($returnCmd); $agreementCmd->redirect(); }
public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'StudentFactory.php'); PHPWS_Core::initModClass('hms', 'LotteryApplication.php'); PHPWS_Core::initModClass('hms', 'HMS_Lottery.php'); PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php'); // TODO Use the HousingApplicationFactory class to get all this data $term = $context->get('term'); # Double check that the student is eligible if (!HMS_Lottery::determineEligibility(UserStatus::getUsername())) { NQ::simple('hms', hms\NotificationView::ERROR, 'You are not eligible to re-apply for on-campus housing for this semester.'); $menuCmd = CommandFactory::getCommand('ShowStudentMenu'); $menuCmd->redirect(); } $errorCmd = CommandFactory::getCommand('ShowReApplication'); $errorCmd->setTerm($term); $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term); // Data sanity checking $doNotCall = $context->get('do_not_call'); $number = $context->get('number'); if (is_null($doNotCall)) { // do not call checkbox was not selected, so check the number if (is_null($number)) { NQ::simple('hms', hms\NotificationView::ERROR, 'Please provide a cell-phone number or click the checkbox stating that you do not wish to share your number with us.'); $errorCmd->redirect(); } } if (!is_null($doNotCall)) { $cellPhone = null; } else { $cellPhone = $number; } $mealPlan = $context->get('meal_plan'); $specialNeeds = $context->get('special_needs'); $physicalDisability = isset($specialNeeds['physical_disability']) ? 1 : 0; $psychDisability = isset($specialNeeds['psych_disability']) ? 1 : 0; $genderNeed = isset($specialNeeds['gender_need']) ? 1 : 0; $medicalNeed = isset($specialNeeds['medical_need']) ? 1 : 0; /** * Special interest housing groups */ // Sororities - If they checked the box, and their pref is APH, // then record her sorority choice $sororityCheck = $context->get('sorority_check'); if (isset($sororityCheck) && $context->get('sorority_pref') == 'aph') { $sororityPref = $context->get('sorority_drop'); } else { $sororityPref = null; } // Teaching Fellows, Watauga Global, and Honors //$tfPref = ($context->get('tf_pref') == 'with_tf')?1:0; $wgPref = $context->get('wg_pref') == 'with_wg' ? 1 : 0; $honorsPref = $context->get('honors_pref') == 'with_honors' ? 1 : 0; // Learning Community Interest $rlcInterest = $context->get('rlc_interest'); $rlcInterest = isset($rlcInterest) ? 1 : 0; // Contract early release $earlyRelease = $context->get('early_release'); if ($earlyRelease == 'no') { $earlyRelease = NULL; } // International $international = $student->isInternational(); $magicWinner = 0; // The student's type should always be 'C' (continuing), // even if thes student began in the Spring. $studentType = 'C'; /************************** * Emergency Contact Info * */ $application = new LotteryApplication(0, $term, $student->getBannerId(), $student->getUsername(), $student->getGender(), $studentType, $student->getApplicationTerm(), $cellPhone, $mealPlan, $physicalDisability, $psychDisability, $genderNeed, $medicalNeed, $international, NULL, $magicWinner, $sororityPref, $wgPref, $honorsPref, $rlcInterest, $earlyRelease); $application->setEmergencyContactName($context->get('emergency_contact_name')); $application->setEmergencyContactRelationship($context->get('emergency_contact_relationship')); $application->setEmergencyContactPhone($context->get('emergency_contact_phone')); $application->setEmergencyContactEmail($context->get('emergency_contact_email')); $application->setEmergencyMedicalCondition($context->get('emergency_medical_condition')); $application->setMissingPersonName($context->get('missing_person_name')); $application->setMissingPersonRelationship($context->get('missing_person_relationship')); $application->setMissingPersonPhone($context->get('missing_person_phone')); $application->setMissingPersonEmail($context->get('missing_person_email')); try { $application->save(); } catch (Exception $e) { NQ::simple('hms', hms\NotificationView::ERROR, 'There was an error saving your re-application. Please try again or contact the Department of University Housing.'); $errorCmd->redirect(); } // Log the fact that the entry was saved HMS_Activity_Log::log_activity(UserStatus::getUsername(), ACTIVITY_LOTTERY_ENTRY, UserStatus::getUsername()); // Send email confirmation PHPWS_Core::initModClass('hms', 'HMS_Email.php'); $year = Term::toString($term) . ' - ' . Term::toString(Term::getNextTerm($term)); HMS_Email::send_lottery_application_confirmation($student, $year); // Show success message NQ::simple('hms', hms\NotificationView::SUCCESS, 'Your re-application was submitted successfully.'); // Redirect to the RLC Reapplication form is the student is interested in RLCs, otherwise, show the student menu if ($rlcInterest == 1) { $cmd = CommandFactory::getCommand('ShowRlcReapplication'); $cmd->setTerm($term); } else { $cmd = CommandFactory::getCommand('ShowStudentMenu'); } $cmd->redirect(); }