public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'assign_by_floor')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to assign students by floor.');
     }
     $username = $context->get('username');
     $banner_id = (int) $context->get('banner_id');
     $reason = $context->get('reason');
     $meal_plan = $context->get('meal_plan');
     $bed_id = $context->get('bed_id');
     $term = Term::getSelectedTerm();
     try {
         if ($banner_id) {
             $student = StudentFactory::getStudentByBannerID($banner_id, Term::getSelectedTerm());
         } elseif (!empty($username)) {
             $student = StudentFactory::getStudentByUsername($username, Term::getSelectedTerm());
         } else {
             $context->setContent(json_encode(array('status' => 'failure', 'message' => 'Did not receive Banner ID or user name.')));
             return;
         }
         try {
             HMS_Assignment::assignStudent($student, $term, null, $bed_id, $meal_plan, null, null, $reason);
         } catch (AssignmentException $e) {
             $context->setContent(json_encode(array('status' => 'failure', 'message' => $e->getMessage())));
             return;
         }
         $message = $student->first_name . ' ' . $student->last_name;
         $context->setContent(json_encode(array('status' => 'success', 'message' => $message, 'student' => $student)));
     } catch (\StudentNotFoundException $e) {
         $context->setContent(json_encode(array('status' => 'failure', 'message' => $e->getMessage())));
     }
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'search')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to lookup student names!');
     }
     $student = null;
     $error = new JsonError(403);
     $username = $context->get('username');
     $banner_id = (int) $context->get('banner_id');
     try {
         if ($banner_id) {
             $student = StudentFactory::getStudentByBannerID($banner_id, Term::getSelectedTerm());
         } elseif (!empty($username)) {
             $student = StudentFactory::getStudentByUsername($username, Term::getSelectedTerm());
         } else {
             $error->setMessage('Did not receive Banner ID or user name.');
             $context->setContent(json_encode($error));
         }
         $student->gender_string = HMS_Util::formatGender($student->gender);
         $context->setContent(json_encode($student));
     } catch (\StudentNotFoundException $e) {
         $error->setMessage($e->getMessage());
         $context->setContent(json_encode($error));
     }
 }
    public function execute(CommandContext $context)
    {
        $newrows = array();
        $pdo = PdoFactory::getPdoInstance();
        $floor_id = (int) $context->get('floorId');
        $query = <<<EOF
select\troom.id as room_id,
\troom.room_number,
\troom.gender_type,
\tbed.id as bed_id,
\tbed.bedroom_label,
\tbed.bed_letter,
\tassign.banner_id,
\tassign.meal_option,
        assign.asu_username
from  \thms_room as room
\tfull join
\t\thms_bed as bed on room.id=bed.room_id
\tfull join
\t\thms_assignment as assign on bed.id=assign.bed_id
where\troom.floor_id = :floor_id
order by room_number asc, bedroom_label, bed_letter;
EOF;
        $prep = $pdo->prepare($query);
        $prep->execute(array(':floor_id' => $floor_id));
        $rows = $prep->fetchAll(PDO::FETCH_ASSOC);
        if (empty($rows)) {
            $context->setContent(json_encode(array()));
            return;
        }
        $count = -1;
        $room_number_track = 0;
        foreach ($rows as $k => $v) {
            $gender = HMS_Util::formatGender($v['gender_type']);
            if ($v['banner_id']) {
                $student = StudentFactory::getStudentByBannerID($v['banner_id'], Term::getSelectedTerm());
                if ($student) {
                    $v['student'] = $student->first_name . ' ' . $student->last_name;
                } else {
                    $v['student'] = null;
                }
            } else {
                $v['student'] = null;
            }
            if ($v['room_number'] != $room_number_track) {
                $count++;
                $newrows[$count]['room_number'] = $v['room_number'];
                $newrows[$count]['gender'] = $gender;
                $newrows[$count]['beds'][] = $v;
                $room_number_track = $v['room_number'];
            } else {
                $newrows[$count]['beds'][] = $v;
            }
        }
        $context->setContent(json_encode($newrows));
    }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php');
     $rlc = new HMS_Learning_Community($context->get('id'));
     if ($rlc->extra_info != NULL) {
         $tpl = array();
         $tpl['INFO'] = $rlc->extra_info;
         $returnData = array();
         $returnData['content'] = PHPWS_Template::process($tpl, 'hms', 'student/rlcExtraInfoDialog.tpl');
         $returnData['title'] = 'Extra Info for ' . $rlc->community_name;
         $context->setContent(json_encode($returnData));
     } else {
         $context->setContent('');
     }
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'RoomDamageFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     $bedId = $context->get('bed_id');
     $bed = new HMS_Bed($bedId);
     $room = $bed->get_parent();
     // Get the damages for this student's room
     $damages = RoomDamageFactory::getDamagesByRoom($room);
     if ($damages == null) {
         $context->setContent(json_encode(array()));
         return;
     }
     $context->setContent(json_encode($damages));
 }
 public function execute(CommandContext $context)
 {
     $send_to = array();
     $send_to[] = '*****@*****.**';
     $send_to[] = '*****@*****.**';
     $send_to[] = '*****@*****.**';
     $send_to[] = '*****@*****.**';
     $from = FROM_ADDRESS;
     $subject = 'HMS Contact Form';
     $body = "Username: "******"\n";
     $body .= "Application date: " . $context->get('application_term') . "\n";
     $body .= "Student Type: " . $context->get('student_type') . "\n";
     $body .= "\n\nInput from student:\n\n";
     $body .= "Name: " . $context->get('name') . "\n";
     $body .= "Email: " . $context->get('email') . "\n";
     $body .= "Phone #: " . $context->get('phone') . "\n";
     $body .= "Type: " . $context->get('stype') . "\n";
     $body .= "Text field:\n";
     $body .= "" . $context->get('comments') . "\n\n";
     if (!HMS_Email::send_email($send_to, $from, $subject, $body)) {
         //Maybe we shouldn't say anything...
         //NQ::simple('hms', hms\NotificationView::ERROR, 'Error sending email!');
     }
     $view = new ContactFormThankYouView();
     $context->setContent($view->show());
 }
 /**
  * Shows the requested report's HTML output.
  * 
  * @param CommandContext $context
  * @throws InvalidArgumentExection
  */
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'reports')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do no have permission to run reports.');
     }
     $reportId = $context->get('reportId');
     if (!isset($reportId) || is_null($reportId)) {
         throw new InvalidArgumentExection('Missing report id.');
     }
     // Instantiate the report controller with the requested report id
     PHPWS_Core::initModClass('hms', 'ReportFactory.php');
     $report = ReportFactory::getReportById($reportId);
     Layout::addPageTitle($report->getFriendlyName());
     $detailCmd = CommandFactory::getCommand('ShowReportDetail');
     $detailCmd->setReportClass($report->getClass());
     $content = '<div> ' . $detailCmd->getLink('&laquo; back') . ' </div>';
     $content .= file_get_contents($report->getHtmlOutputFilename());
     if ($content === FALSE) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Could not open report file.');
         PHPWS_Error::log('Could not open report file ' . $report->getCsvOutputFilename(), 'hms');
         $reportCmd = CommandFactory::getCommand('ShowReportDetail');
         $reportCmd->setReportClass($report->getClass());
         $reportCmd->redirect();
     }
     $context->setContent($content);
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'view_activity_log')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to view the activity log.');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
     PHPWS_Core::initModClass('hms', 'ActivityLogView.php');
     $actee = $context->get('actee');
     $actor = $context->get('actor');
     $notes = $context->get('notes');
     $exact = $context->get('exact');
     $begin = $context->get('begin');
     $end = $context->get('end');
     if (!is_null($begin) && !is_null($end) && $end <= $begin) {
         unset($_REQUEST['begin_year'], $_REQUEST['begin_month'], $_REQUEST['begin_day'], $_REQUEST['end_year'], $_REQUEST['end_month'], $_REQUEST['end_day']);
         $begin = null;
         $end = null;
         NQ::simple('hms', hms\NotificationView::WARNING, 'Invalid date range. The search results will not be filtered by date.');
     }
     $activityMap = HMS_Activity_Log::getActivityMapping();
     $activities = array();
     foreach ($activityMap as $i => $t) {
         $act = $context->get("a{$i}");
         if (!is_null($act)) {
             $activities[] = $i;
         }
     }
     $activityLogView = new ActivityLogView($actee, $actor, $notes, $exact, $begin, $end, $activities);
     $context->setContent($activityLogView->show());
 }
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'room_structure')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to add a room.');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     PHPWS_Core::initModClass('hms', 'AddRoomView.php');
     $floor_id = $context->get('floor');
     $tpl = array();
     # Setup the title and color of the title bar
     $tpl['TITLE'] = 'Add Room';
     # Check to make sure we have a floor and hall.
     $floor = new HMS_Floor($floor_id);
     if (!$floor) {
         $tpl['ERROR_MSG'] = 'There was an error getting the floor object. Please contact ESS.';
         return PHPWS_Template::process($tpl, 'hms', 'admin/add_room.tpl');
     }
     $hall = $floor->get_parent();
     if (!$hall) {
         $tpl['ERROR_MSG'] = 'There was an error getting the hall object. Please contact ESS.';
         return PHPWS_Template::process($tpl, 'hms', 'admin/add_room.tpl');
     }
     # Check Permissions
     if (!Current_User::allow('hms', 'room_structure')) {
         HMS_Floor::show_edit_floor($floor_id, NULL, 'You do not have permission to add rooms.');
     }
     $view = new AddRoomView($floor);
     $context->setContent($view->show());
 }
 /**
  * (non-PHPdoc)
  * @see Command::execute()
  */
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     $term = $context->get('term');
     // Check if the student has already applied. If so, redirect to the student menu
     $app = HousingApplication::getApplicationByUser(UserStatus::getUsername(), $term);
     if (isset($result) && $result->getApplicationType == 'offcampus_waiting_list') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'You have already enrolled on the on-campus housing Open Waiting List for this term.');
         $menuCmd = CommandFactory::getCommand('ShowStudentMenu');
         $menuCmd->redirect();
     }
     // Make sure the student agreed to the terms, if not, send them back to the terms & agreement command
     $event = $context->get('event');
     $_SESSION['application_data'] = array();
     // If they haven't agreed, redirect to the agreement
     if (is_null($event) || !isset($event) || $event != 'signing_complete' && $event != 'viewing_complete') {
         $onAgree = CommandFactory::getCommand('ShowOffCampusWaitListApplication');
         $onAgree->setTerm($term);
         $agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
         $agreementCmd->setTerm($term);
         $agreementCmd->setAgreedCommand($onAgree);
         $agreementCmd->redirect();
     }
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
     PHPWS_Core::initModClass('hms', 'ReApplicationOffCampusFormView.php');
     $view = new ReApplicationOffCampusFormView($student, $term);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'RoommateProfileSearchForm.php');
     $term = $context->get('term');
     $view = new RoommateProfileSearchForm($term);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'room_view')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to view rooms.');
     }
     // Check for a  hall ID
     $roomId = $context->get('room');
     if (!isset($roomId)) {
         throw new InvalidArgumentException('Missing room ID.');
     }
     // Load the room
     $room = new HMS_Room($roomId);
     if ($room->term != Term::getSelectedTerm()) {
         $roomCmd = CommandFactory::getCommand('SelectRoom');
         $roomCmd->setTitle('Edit a Room');
         $roomCmd->setOnSelectCmd(CommandFactory::getCommand('EditRoomView'));
         $roomCmd->redirect();
     }
     // Load the floor/hall
     $floor = $room->get_parent();
     $hall = $floor->get_parent();
     // Load the room damages and damage types
     $damageTypes = DamageTypeFactory::getDamageTypeAssoc();
     $roomView = new RoomView($hall, $floor, $room, $damageTypes);
     $context->setContent($roomView->show());
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to edit floors.');
     }
     // Check for a hall ID
     $floorId = $context->get('floor');
     if (!isset($floorId)) {
         throw new InvalidArgumentException('Missing floor ID.');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
     PHPWS_Core::initModClass('hms', 'FloorView.php');
     $floor = new HMS_Floor($floorId);
     if ($floor->term != Term::getSelectedTerm()) {
         $floorCmd = CommandFactory::getCommand('SelectFloor');
         $floorCmd->setTitle('Edit a Floor');
         $floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
         $floorCmd->redirect();
     }
     $hall = $floor->get_parent();
     $floorView = new FloorView($hall, $floor);
     $context->setContent($floorView->show());
 }
 public function execute(CommandContext $context)
 {
     $id = $context->get('roommateId');
     if (is_null($id)) {
         throw new InvalidArgumentException('Must set roommateId');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
     $roommate = new HMS_Roommate($id);
     if ($roommate->id = 0) {
         throw new InvalidArgumentException('Invalid roommateId ' . $id);
     }
     $username = UserStatus::getUsername();
     if ($username != $roommate->requestor && $username != $roommate->requestee) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException("{$username} tried to break roommate pairing {$roommate->id}");
     }
     PHPWS_Core::initCoreClass('Captcha.php');
     // get other roommate
     $other = StudentFactory::getStudentByUsername($roommate->get_other_guy($username), $roommate->term);
     $form = new PHPWS_Form();
     $cmd = CommandFactory::getCommand('RoommateBreak');
     $cmd->setRoommateId($id);
     $cmd->initForm($form);
     $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     $form->addTplTag('NAME', $other->getFullName());
     $form->addSubmit('Confirm');
     $form->addCssClass('submit', 'btn btn-danger');
     $context->setContent(PHPWS_Template::process($form->getTemplate(), 'hms', 'student/roommate_break_confirm.tpl'));
 }
 public function execute(CommandContext $context)
 {
     $term = $context->get('term');
     if (!isset($term) || is_null($term) || empty($term)) {
         throw new InvalidArgumentException('Missing term.');
     }
     $cmd = CommandFactory::getCommand('ShowStudentMenu');
     $feature = ApplicationFeature::getInstanceByNameAndTerm('RlcApplication', $term);
     // Make sure the RLC application feature is enabled
     if (is_null($feature) || !$feature->isEnabled()) {
         NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, RLC applications are not avaialable for this term.");
         $cmd->redirect();
     }
     // Check feature's deadlines
     if ($feature->getStartDate() > time()) {
         NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, it is too soon to fill out an RLC application.");
         $cmd->redirect();
     } else {
         if ($feature->getEndDate() < time()) {
             NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, the RLC application deadline has already passed. Please contact University Housing if you are interested in applying for a RLC.");
             $cmd->redirect();
         }
     }
     // Get the Student object
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
     $view = new RlcApplicationPage1View($context, $student);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     // Check permissions
     if (!Current_User::allow('hms', 'checkin')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to checkin students.');
     }
     $term = Term::getSelectedTerm();
     $bannerId = $context->get('bannerId');
     $hallId = $context->get('hallId');
     $errorCmd = CommandFactory::getCommand('ShowCheckinStart');
     if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Missing Banner ID.');
         $errorCmd->redirect();
     }
     if (!isset($hallId)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
         $errorCmd->redirect();
     }
     // Check the Banner ID
     if (preg_match("/[\\d]{9}/", $bannerId) == false) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Imporperly formatted Banner ID.');
         $errorCmd->redirect();
     }
     // Try to lookup the student in Banner
     try {
         $student = StudentFactory::getStudentByBannerId($bannerId, $term);
     } catch (StudentNotFoundException $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
         $errorCmd->redirect();
     }
     // Make sure the student is assigned in the current term
     $assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $term);
     if (!isset($assignment) || is_null($assignment)) {
         NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' is not assigned for ' . Term::toString($term) . '. Please contact the University Housing Assignments Office at 828-262-6111.');
         $errorCmd->redirect();
     }
     // Make sure the student's assignment matches the hall the user selected
     $bed = $assignment->get_parent();
     $room = $bed->get_parent();
     $floor = $room->get_parent();
     $hall = $floor->get_parent();
     if ($hallId != $hall->getId()) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Wrong hall! ' . $student->getName() . ' is assigned to ' . $assignment->where_am_i());
         $errorCmd->redirect();
     }
     // Load any existing check-in
     $checkin = CheckinFactory::getLastCheckinByBannerId($bannerId, $term);
     // If there is a checkin for the same bed, and the difference between the current time and the checkin time is
     // greater than 48 hours, then show an error.
     if (!is_null($checkin)) {
         $checkoutDate = $checkin->getCheckoutDate();
         if ($checkin->getBedId() == $bed->getId() && !isset($checkoutDate) && time() - $checkin->getCheckinDate() > Checkin::CHECKIN_TIMEOUT) {
             NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' has already checked in to ' . $assignment->where_am_i());
             $errorCmd->redirect();
         }
     }
     $view = new CheckinFormView($student, $assignment, $hall, $floor, $room, $checkin);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     $id = $context->get('roommateId');
     if (is_null($id)) {
         throw new InvalidArgumentException('Must set roommateId');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
     $roommate = new HMS_Roommate($id);
     if ($roommate->id == 0) {
         throw new InvalidArgumentException('Invalid roommateId ' . $id);
     }
     $username = UserStatus::getUsername();
     if ($username != $roommate->requestee) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException("{$username} tried to display confirmation screen for pairing {$roommate->id}");
     }
     $tpl = array();
     $acceptCmd = CommandFactory::getCommand('ShowRoommateConfirmAccept');
     $acceptCmd->setRoommateId($roommate->id);
     $tpl['ACCEPT'] = $acceptCmd->getURI();
     $rejectCmd = CommandFactory::getCommand('RoommateReject');
     $rejectCmd->setRoommateId($roommate->id);
     $tpl['DECLINE'] = $rejectCmd->getURI();
     $cancelCmd = CommandFactory::getCommand('ShowStudentMenu');
     $tpl['CANCEL'] = $cancelCmd->getURI();
     $requestor = StudentFactory::getStudentByUsername($roommate->requestor, $roommate->term);
     $tpl['REQUESTOR_NAME'] = $requestor->getFullName();
     $context->setContent(PHPWS_Template::process($tpl, 'hms', 'student/roommate_accept_reject_screen.tpl'));
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'FreshmenMainMenuView.php');
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
     $view = new FreshmenMainMenuView($student);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'WithdrawnSearch.php');
     $term = Term::getSelectedTerm();
     $search = new WithdrawnSearch($term);
     $search->doSearch();
     $context->setContent($search->getHTMLView());
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'RoommateProfile.php');
     $term = $context->get('term');
     $tags = array();
     $tags['RESULTS'] = RoommateProfileSearchView::profile_search_pager($term);
     $context->setContent(PHPWS_Template::process($tags, 'hms', 'student/profile_search_results.tpl'));
 }
 public function execute(CommandContext $context)
 {
     $term = Term::getSelectedTerm();
     $pdo = PdoFactory::getPdoInstance();
     $prep = $pdo->prepare("select id, hall_name as title from hms_residence_hall where term=? and is_online=1 order by hall_name");
     $prep->execute(array($term));
     $halls = $prep->fetchAll(PDO::FETCH_ASSOC);
     $context->setContent(json_encode($halls));
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'LotteryDenyRoommateRequestView.php');
     $request = HMS_Lottery::get_lottery_roommate_invite_by_id($context->get('requestId'));
     $term = PHPWS_Settings::get('hms', 'lottery_term');
     $view = new LotteryDenyRoommateRequestView($request, $term);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'special_interest_approval')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to approval special interest groups.');
     }
     $view = new SpecialInterestGroupView($context->get('group'));
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     try {
         $view = new HousingApplicationView($context->get('appId'));
         $context->setContent($view->show());
     } catch (Exception $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, $e);
     }
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'learning_community_maintenance')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to edit RLCs.');
     }
     $view = new EditRlcView();
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'view_rlc_members')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to view RLC members.');
     }
     $view = new RlcAssignmentsView();
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     $options = array();
     $options['meal_plan'] = array(array('id' => BANNER_MEAL_LOW, 'value' => 'Low'), array('id' => BANNER_MEAL_STD, 'value' => 'Standard'), array('id' => BANNER_MEAL_HIGH, 'value' => 'High'), array('id' => BANNER_MEAL_SUPER, 'value' => 'Super'), array('id' => BANNER_MEAL_NONE, 'value' => 'None'), array('id' => BANNER_MEAL_5WEEK, 'value' => 'Summer (5 weeks)'));
     $options['assignment_type'] = array(array('id' => ASSIGN_ADMIN, 'value' => 'Administrative'), array('id' => ASSIGN_APPEALS, 'value' => 'Appeals'), array('id' => ASSIGN_LOTTERY, 'value' => 'Lottery'), array('id' => ASSIGN_FR, 'value' => 'Freshmen'), array('id' => ASSIGN_TRANSFER, 'value' => 'Transfer'), array('id' => ASSIGN_APH, 'value' => 'APH'), array('id' => ASSIGN_RLC_FRESHMEN, 'value' => 'RLC Freshmen'), array('id' => ASSIGN_RLC_TRANSFER, 'value' => 'RLC Transfer'), array('id' => ASSIGN_RLC_CONTINUING, 'value' => 'RLC Continuing'), array('id' => ASSIGN_HONORS_FRESHMEN, 'value' => 'Honors Freshmen'), array('id' => ASSIGN_HONORS_CONTINUING, 'value' => 'Honors Continuing'), array('id' => ASSIGN_LLC_FRESHMEN, 'value' => 'LLC Freshmen'), array('id' => ASSIGN_LLC_CONTINUING, 'value' => 'LLC Continuing'), array('id' => ASSIGN_INTL, 'value' => 'International'), array('id' => ASSIGN_RA, 'value' => 'RA'), array('id' => ASSIGN_RA_ROOMMATE, 'value' => 'RA Roommate'), array('id' => ASSIGN_MEDICAL_FRESHMEN, 'value' => 'Medical Freshmen'), array('id' => ASSIGN_MEDICAL_CONTINUING, 'value' => 'Medical Continuing'), array('id' => ASSIGN_SPECIAL_FRESHMEN, 'value' => 'Special Needs Freshmen'), array('id' => ASSIGN_SEPCIAL_CONTINUING, 'value' => 'Special Needs Continuing'), array('id' => ASSIGN_RHA, 'value' => 'RHA/NRHH'), array('id' => ASSIGN_SCHOLARS, 'value' => 'Diversity &amp; Plemmons Scholars'));
     $options['default_plan'] = BANNER_MEAL_STD;
     $options['default_assignment'] = ASSIGN_ADMIN;
     $context->setContent(json_encode($options));
 }
 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HMS_Room.php');
     PHPWS_Core::initModClass('hms', 'LotteryChooseRoomThanksView.php');
     $roomId = $context->get('roomId');
     $room = new HMS_Room($roomId);
     $view = new LotteryChooseRoomThanksView($room);
     $context->setContent($view->show());
 }
 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'edit_terms')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to edit terms.');
     }
     $view = new CreateTermView();
     $context->setContent($view->show());
 }
 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 add lottery entries.');
     }
     $view = new LotteryWaitingListView();
     $context->setContent($view->show());
 }