public function show()
 {
     $tpl = array();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $form = new PHPWS_Form('roommate_group');
     $submitCmd = CommandFactory::getCommand('CreateRoommateGroup');
     $submitCmd->initForm($form);
     if (isset($this->roommate1)) {
         $form->addText('roommate1', $this->roommate1);
     } else {
         $form->addText('roommate1');
     }
     $form->addCssClass('roommate1', 'form-control');
     $form->setExtra('roommate1', 'autofocus');
     if (isset($this->roommate1)) {
         $form->addText('roommate2', $this->roommate2);
     } else {
         $form->addText('roommate2');
     }
     $form->addCssClass('roommate2', 'form-control');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Create Roommate Group");
     return PHPWS_Template::process($tpl, 'hms', 'admin/createRoommateGroup.tpl');
 }
Example #2
0
 public function show()
 {
     $tpl = array();
     if ($this->halls == NULL) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'There are no halls available for the selected term.');
         $cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
         $cmd->redirect();
     }
     $tpl['TITLE'] = $this->title;
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     javascript('jquery');
     javascript('modules/hms/select_floor');
     # Setup the form
     $form = new PHPWS_Form();
     $this->onSelectCmd->initForm($form);
     $form->setMethod('get');
     $form->addDropBox('residence_hall', $this->halls);
     $form->setLabel('residence_hall', 'Residence hall');
     $form->setMatch('residence_hall', 0);
     $form->setClass('residence_hall', 'form-control');
     $form->addDropBox('floor', array(0 => ''));
     $form->setLabel('floor', 'Floor');
     $form->setClass('floor', 'form-control');
     $form->addSubmit('submit_button', 'Select');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Select Floor");
     return PHPWS_Template::process($tpl, 'hms', 'admin/select_floor.tpl');
 }
 public function show()
 {
     PHPWS_Core::initCoreClass('Form.php');
     javascript('jquery');
     javascript('modules/hms/assign_student');
     $unassignCmd = CommandFactory::getCommand('UnassignStudent');
     $form = new PHPWS_Form();
     $unassignCmd->initForm($form);
     $form->addText('username');
     if (!is_null($this->student)) {
         $form->setValue('username', $this->student->getUsername());
     }
     $form->addCssClass('username', 'form-control');
     $form->setExtra('username', 'autofocus');
     // Addition of "Unassignment Type"
     $form->addDropBox('unassignment_type', array('-1' => 'Choose a reason...', UNASSIGN_ADMIN => 'Administrative', UNASSIGN_REASSIGN => 'Re-assign', UNASSIGN_CANCEL => 'Contract Cancellation', UNASSIGN_PRE_SPRING => 'Pre-spring room change', UNASSIGN_RELEASE => 'Contract Release'));
     //$form->setMatch('unassignment_type', UNASSIGN_ADMIN);
     $form->setLabel('unassignment_type', 'Unassignment Type: ');
     $form->addCssClass('unassignment_type', 'form-control');
     $form->addText('refund');
     $form->setLabel('refund', 'Refund Percentage');
     $form->setSize('refund', 4);
     $form->setMaxSize('refund', 3);
     $form->addCssClass('refund', 'form-control');
     $form->addTextarea('note');
     $form->setLabel('note', 'Note: ');
     $form->addCssClass('note', 'form-control');
     $tpl = $form->getTemplate();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     Layout::addPageTitle("Unassign Student");
     return PHPWS_Template::process($tpl, 'hms', 'admin/unassignStudent.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $tpl['NAME'] = $this->student->getFullName();
     $tpl['LOCATION'] = $this->assignment->where_am_i();
     $submitCmd = CommandFactory::getCommand('AssignStudent');
     $submitCmd->setUsername($this->student->getUsername());
     $submitCmd->setRoom($this->room);
     $submitCmd->setBed($this->bed);
     $submitCmd->setMealPlan($this->mealPlan);
     $submitCmd->setMoveConfirmed("true");
     $submitCmd->setAssignmentType($this->assignmentType);
     $submitCmd->setNotes($this->notes);
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $form->addSubmit('submit', 'Confirm Move');
     $form->setClass('submit', 'btn btn-danger');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     if (!empty($_SERVER['HTTP_REFERER'])) {
         $tpl['BACK'] = $_SERVER['HTTP_REFERER'];
     } else {
         $tpl['BACK'] = 'index.php?module=hms&action=ShowAssignStudent';
     }
     Layout::addPageTitle("Assignment Move Confirmation");
     return PHPWS_Template::process($tpl, 'hms', 'admin/assign_student_move_confirm.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['PAGER'] = $this->roommatePager->show();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $createCmd = CommandFactory::getCommand('CreateRoommateGroupView');
     $tpl['CREATE_REQUEST_URI'] = $createCmd->getURI();
     Layout::addPageTitle("Edit Roommate Group");
     return PHPWS_Template::process($tpl, 'hms', 'admin/show_confirmed_roommates.tpl');
 }
Example #6
0
 public function show()
 {
     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.');
     }
     $printable = Term::getPrintableSelectedTerm();
     $tpl = array();
     $tpl['TITLE'] = dgettext('hms', 'Term settings for ') . $printable;
     $newTermCmd = CommandFactory::getCommand('ShowCreateTerm');
     $tpl['NEW_TERM_URI'] = $newTermCmd->getURI();
     // Is this the Current Term?
     if (Term::isCurrentTermSelected()) {
         $tpl['CURRENT_TERM_TEXT'] = dgettext('hms', 'This term is the <strong>active term</strong>.  To make another term active, please select it from the list at the top-left.');
     } else {
         $tpl['CURRENT_TERM_TEXT'] = dgettext('hms', 'This term is <strong>not</strong> the active term.');
         if (Current_User::allow('hms', 'activate_term')) {
             $cmd = CommandFactory::getCommand('SetCurrentTerm');
             $cmd->setTerm(Term::getSelectedTerm());
             $tpl['SET_TERM_URI'] = $cmd->getURI();
             $tpl['SET_TERM_TEXT'] = "Make <strong>{$printable}</strong> the Current Term";
         }
     }
     // What's with the Banner Queue?
     $term = new Term(Term::getSelectedTerm());
     if ($term->getBannerQueue()) {
         $tpl['QUEUE_ENABLED'] = '';
         $count = $term->getQueueCount();
         $tpl['BANNER_QUEUE_COUNT'] = $count;
         if ($count > 0) {
             $cmd = CommandFactory::getCommand('ProcessBannerQueue');
             $cmd->setTerm(Term::getSelectedTerm());
             $tpl['BANNER_QUEUE_PROCESS_URI'] = $cmd->getURI();
         } else {
             $cmd = CommandFactory::getCommand('DisableBannerQueue');
             $cmd->setTerm(Term::getSelectedTerm());
             $tpl['BANNER_QUEUE_LINK'] = $cmd->getLink('Disable');
         }
     } else {
         $tpl['QUEUE_DISABLED'] = '';
         $cmd = CommandFactory::getCommand('EnableBannerQueue');
         $cmd->setTerm(Term::getSelectedTerm());
         $tpl['BANNER_QUEUE_LINK'] = $cmd->getLink('Enable');
     }
     // Terms and Conditions
     PHPWS_Core::initModClass('hms', 'TermsConditionsAdminView.php');
     $tcav = new TermsConditionsAdminView($this->term);
     $tpl['TERMS_CONDITIONS_CONTENT'] = $tcav->show();
     // Features and Deadlines
     PHPWS_Core::initModClass('hms', 'ApplicationFeatureListView.php');
     $aflv = new ApplicationFeatureListView(Term::getSelectedTerm());
     $tpl['FEATURES_DEADLINES_CONTENT'] = $aflv->show();
     Layout::addPageTitle("Term Settings");
     return PHPWS_Template::process($tpl, 'hms', 'admin/TermEditView.tpl');
 }
Example #7
0
 public function show()
 {
     $tpl = array();
     $tpl['TITLE'] = $this->title;
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     if ($this->halls == NULL) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'There are no halls available for the selected term.');
         $cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
         $cmd->redirect();
     }
     PHPWS_Core::initCoreClass('Form.php');
     $form = new PHPWS_Form();
     $this->onSelectCmd->initForm($form);
     $form->setMethod('get');
     $form->addDropBox('hallId', $this->halls);
     $form->addCssClass('hallId', 'form-control');
     $form->addSubmit('submit', _('Select Hall'));
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Select Hall");
     return PHPWS_Template::process($tpl, 'hms', 'admin/select_residence_hall.tpl');
 }
 public function show()
 {
     $tpl = array();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $tpl['HALL_NAMES'] = implode(', ', $this->hallNames);
     $needsActionList = new RoomChangeListView($this->needsApproval, $this->term);
     $tpl['NEEDS_ACTION'] = $needsActionList->show();
     $tpl['NEEDS_ACTION_COUNT'] = count($this->needsApproval);
     $approvedList = new RoomChangeListView($this->approved, $this->term);
     $tpl['APPROVED'] = $approvedList->show();
     $tpl['APPROVED_COUNT'] = count($this->approved);
     $pendingList = new RoomChangeListView($this->allPending, $this->term);
     $tpl['PENDING'] = $pendingList->show();
     $tpl['PENDING_COUNT'] = count($this->allPending);
     $completedList = new RoomChangeListView($this->completed, $this->term);
     $tpl['COMPLETED'] = $completedList->show();
     $tpl['COMPLETED_COUNT'] = count($this->completed);
     $inactiveList = new RoomChangeListView($this->inactive, $this->term);
     $tpl['INACTIVE'] = $inactiveList->show();
     $tpl['INACTIVE_COUNT'] = count($this->inactive);
     return PHPWS_Template::process($tpl, 'hms', 'admin/RoomChangeApprovalView.tpl');
 }
 public function show()
 {
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/floor_assignment.tpl');
     $this->floor->loadRooms();
     javascript('jquery_ui');
     javascript('modules/hms/floor_assignment');
     $this->floor->loadHall();
     $hall = $this->floor->_hall;
     $tpl->setCurrentBlocK('title');
     $tpl->setData(array('TITLE' => HMS_Util::ordinal($this->floor->getFloorNumber()) . ' Floor - ' . $hall->getHallName() . ' - ' . Term::getPrintableSelectedTerm()));
     foreach ($this->floor->_rooms as $room) {
         $room->loadBeds();
         foreach ($room->_beds as $bed) {
             $tpl->setCurrentBlock('bed-list');
             $tpl->setData(array('BED_ID' => $bed->id));
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('room-list');
         $tpl->setData(array('ROOM' => $room->room_number));
         $tpl->parseCurrentBlock();
     }
     return $tpl->get();
 }
Example #10
0
 public function show()
 {
     if (!UserStatus::isAdmin()) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You are not allowed to view residence halls');
     }
     javascript('jquery_ui');
     $tpl = array();
     # Setup the title and color of the title bar
     $tpl['TITLE'] = $this->hall->getHallName();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     if (!$this->hall->isOnline()) {
         $tpl['OFFLINE'] = '';
     }
     $submitCmd = CommandFactory::getCommand('EditResidenceHall');
     $submitCmd->setHallId($this->hall->getId());
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     // This is unused, as far as I can tell, so comment it out for now.
     //$form->addHidden('beds_per_room', $this->hall->count_beds_per_room()); // add a hidden field for beds per room
     $form->addText('hall_name', $this->hall->hall_name);
     $form->addCssClass('hall_name', 'form-control');
     $tpl['NUMBER_OF_FLOORS'] = $this->hall->get_number_of_floors();
     $tpl['NUMBER_OF_ROOMS'] = $this->hall->get_number_of_rooms();
     $tpl['NUMBER_OF_BEDS'] = $this->hall->get_number_of_beds();
     $tpl['NUMBER_OF_BEDS_ONLINE'] = $this->hall->get_number_of_online_nonoverflow_beds();
     $tpl['NUMBER_OF_ASSIGNEES'] = $this->hall->get_number_of_assignees();
     $form->addDropBox('gender_type', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, COED => COED_DESC));
     $form->setMatch('gender_type', $this->hall->gender_type);
     $form->addCssClass('gender_type', 'form-control');
     $form->addCheckBox('air_conditioned', 1);
     $form->setMatch('air_conditioned', $this->hall->air_conditioned);
     $form->addCheckBox('is_online', 1);
     $form->setMatch('is_online', $this->hall->is_online);
     $form->addCheckBox('meal_plan_required', 1);
     $form->setMatch('meal_plan_required', $this->hall->meal_plan_required);
     $form->addCheckBox('assignment_notifications', 1);
     $form->setMatch('assignment_notifications', $this->hall->assignment_notifications);
     // Package Desks
     //PHPWS_Core::initModClass('hms', 'PackageDeskFactory.php');
     //$packageDesks = PackageDeskFactory::getPackageDesksAssoc();
     //$form->addDropBox('package_desk', $packageDesks);
     //$form->setMatch('package_desk', $this->hall->getPackageDeskId());
     // Images
     PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
     if (isset($this->hall->exterior_image_id)) {
         $manager = Cabinet::fileManager('exterior_image_id', $this->hall->exterior_image_id);
     } else {
         $manager = Cabinet::fileManager('exterior_image_id');
     }
     $manager->maxImageWidth(300);
     $manager->MaxImageHeight(300);
     $manager->imageOnly(false, false);
     $form->addTplTag('EXTERIOR_IMG', $manager->get());
     if (isset($this->hall->other_image_id)) {
         $manager = Cabinet::fileManager('other_image_id', $this->hall->other_image_id);
     } else {
         $manager = Cabinet::fileManager('other_image_id');
     }
     $manager->maxImageWidth(300);
     $manager->MaxImageHeight(300);
     $manager->imageOnly(false, false);
     $form->addTplTag('OTHER_IMG', $manager->get());
     if (isset($this->hall->map_image_id)) {
         $manager = Cabinet::fileManager('map_image_id', $this->hall->map_image_id);
     } else {
         $manager = Cabinet::fileManager('map_image_id');
     }
     $manager->maxImageWidth(300);
     $manager->MaxImageHeight(300);
     $manager->imageOnly(false, false);
     $form->addTplTag('MAP_IMG', $manager->get());
     if (isset($this->hall->room_plan_image_id)) {
         $manager = Cabinet::fileManager('room_plan_image_id', $this->hall->room_plan_image_id);
     } else {
         $manager = Cabinet::fileManager('room_plan_image_id');
     }
     $manager->maxImageWidth(300);
     $manager->MaxImageHeight(300);
     $manager->imageOnly(false, false);
     $form->addTplTag('ROOM_PLAN_IMG', $manager->get());
     # if the user has permission to view the form but not edit it then
     # disable it
     if (Current_User::allow('hms', 'hall_view') && !Current_User::allow('hms', 'hall_attributes') && !Current_User::allow('hms', 'hall_structure')) {
         $form_vars = (array) $form;
         $elements = $form_vars["PHPWS_Form_elements"];
         //NB: this is a weird results of casting the object to an array
         foreach ($elements as $element => $value) {
             $form->setDisabled($element);
         }
     }
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     $tpl['FLOOR_PAGER'] = HMS_Floor::get_pager_by_hall($this->hall->getId());
     javascript('modules/hms/role_editor');
     $tpl['ROLE_EDITOR'] = PHPWS_Template::process(array('CLASS_NAME' => "'HMS_Residence_Hall'", 'ID' => $this->hall->id), 'hms', 'admin/role_editor.tpl');
     Layout::addPageTitle("Edit Residence Hall");
     return PHPWS_Template::process($tpl, 'hms', 'admin/edit_residence_hall.tpl');
 }
Example #11
0
 public function show()
 {
     $tpl = array();
     $tpl['HALL_NAME'] = $this->hall->getLink();
     $tpl['FLOOR_NUMBER_LINK'] = $this->floor->getLink('Floor');
     $tpl['FLOOR_NUMBER'] = $this->floor->where_am_i();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $cmd = CommandFactory::getCommand('AddRoom');
     $cmd->floor = $this->floor->id;
     $form = new PHPWS_Form();
     $cmd->initForm($form);
     $form->addText('room_number');
     $form->addCssClass('room_number', 'form-control');
     $form->addHidden('hall_id', $this->hall->id);
     $form->addHidden('floor_id', $this->floor->id);
     if ($this->floor->gender_type == COED) {
         $form->addDropBox('gender_type', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC));
         $form->addCssClass('gender_type', 'form-control');
         $form->setMatch('gender_type', HMS_Util::formatGender($this->floor->gender_type));
     } else {
         $form->addDropBox('gender_type', array($this->floor->gender_type => HMS_Util::formatGender($this->floor->gender_type)));
         $form->setReadOnly('gender_type', true);
     }
     // Always show the option to set the default gender
     $defGenders = array(FEMALE => FEMALE_DESC, MALE => MALE_DESC);
     if ($this->floor->gender_type == MALE) {
         unset($defGenders[FEMALE]);
     }
     if ($this->floor->gender_type == FEMALE) {
         unset($defGenders[MALE]);
     }
     $form->addDropBox('default_gender', $defGenders);
     $form->addCssClass('default_gender', 'form-control');
     if ($this->floor->gender_type != COED) {
         $form->setMatch('default_gender', $this->floor->gender_type);
     }
     // Add a dropbox to for rlc
     $form->addDropBox('rlc_reserved', array("0" => "None") + RlcFactory::getRlcList(Term::getSelectedTerm()));
     $form->setLabel('rlc_reserved', 'Reserved for RLC');
     $form->addCssClass('rlc_reserved', 'form-control');
     $form->addCheck('offline', 1);
     $form->setLabel('offline', 'Offline');
     $form->addCheck('reserved', 1);
     $form->setLabel('reserved', 'Reserved');
     $form->addCheck('ra', 1);
     $form->setLabel('ra', 'Reserved for RA');
     $form->addCheck('private', 1);
     $form->setLabel('private', 'Private');
     $form->addCheck('overflow', 1);
     $form->setLabel('overflow', 'Overflow');
     $form->addCheck('parlor', 1);
     $form->setLabel('parlor', 'Parlor');
     $form->addCheck('ada', 1);
     $form->setLabel('ada', 'ADA');
     $form->addCheck('hearing_impaired', 1);
     $form->setLabel('hearing_impaired', 'Hearing Impaired');
     $form->addCheck('bath_en_suite', 1);
     $form->setLabel('bath_en_suite', 'Bath en Suite');
     $form->addSubmit('submit', 'Submit');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/addRoom.tpl');
 }
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'assignment_notify')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to send assignment notifications.');
     }
     PHPWS_Core::initModClass('hms', 'Term.php');
     PHPWS_Core::initModClass('hms', 'HMS_Email.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     // Check if any move-in times are set for the selected term
     $moveinTimes = HMS_Movein_Time::get_movein_times_array(Term::getSelectedTerm());
     // If the array of move-in times ONLY has the zero-th element ['None'] then it's no good
     // Or, of course, if the array is null or emtpy it is no good
     if (count($moveinTimes) <= 1 || is_null($moveinTimes) || empty($moveinTimes)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'There are no move-in times set for ' . Term::getPrintableSelectedTerm());
         $context->goBack();
     }
     // Keep track of floors missing move-in times
     $missingMovein = array();
     $term = Term::getSelectedTerm();
     $db = new PHPWS_DB('hms_assignment');
     $db->addWhere('email_sent', 0);
     $db->addWhere('term', $term);
     $result = $db->getObjects("HMS_Assignment");
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     foreach ($result as $assignment) {
         //get the students real name from their asu_username
         $student = StudentFactory::getStudentByUsername($assignment->getUsername(), $term);
         //get the location of their assignment
         PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
         $bed = new HMS_Bed($assignment->getBedId());
         $room = $bed->get_parent();
         $location = $bed->where_am_i() . ' - Bedroom ' . $bed->bedroom_label;
         // Lookup the floor and hall to make sure the
         // assignment notifications flag is true for this hall
         $floor = $room->get_parent();
         $hall = $floor->get_parent();
         if ($hall->assignment_notifications == 0) {
             continue;
         }
         // Get the student type for determining move-in time
         $type = $student->getType();
         // Check for an accepted and confirmed RLC assignment
         $rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($student->getUsername(), $term);
         // If there is an assignment, make sure the student "confirmed" the rlc invite
         if (!is_null($rlcAssignment)) {
             if ($rlcAssignment->getStateName() != 'confirmed' && $rlcAssignment->getStateName() != 'selfselect-assigned') {
                 $rlcAssignment = null;
             }
         }
         // Make sure this is re-initialized
         $moveinTimeId = null;
         $rlcSetMoveinTime = false;
         // Determine the move-in time
         if (!is_null($rlcAssignment)) {
             // If there is a 'confirmed' RLC assignment, use the RLC's move-in times
             $rlc = $rlcAssignment->getRlc();
             if ($type == TYPE_CONTINUING) {
                 $moveinTimeId = $rlc->getContinuingMoveinTime();
             } else {
                 if ($type == TYPE_TRANSFER) {
                     $moveinTimeId = $rlc->getTransferMoveinTime();
                 } else {
                     if ($type == TYPE_FRESHMEN) {
                         $moveinTimeId = $rlc->getFreshmenMoveinTime();
                     }
                 }
             }
         }
         // If there's a non-null move-in time ID at this point, then we know the RLC must have set it
         if (!is_null($moveinTimeId)) {
             $rlcSetMoveinTime = true;
         }
         // If the RLC didn't set a movein time, set it according to the floor
         // TODO: Find continuing students by checking the student's application term
         // against the term we're wending assignment notices for
         if (is_null($moveinTimeId)) {
             if ($type == TYPE_CONTINUING) {
                 $moveinTimeId = $assignment->get_rt_movein_time_id();
             } else {
                 if ($type == TYPE_TRANSFER) {
                     $moveinTimeId = $assignment->get_t_movein_time_id();
                 } else {
                     $moveinTimeId = $assignment->get_f_movein_time_id();
                 }
             }
         }
         // Check for missing move-in times
         if ($moveinTimeId == NULL) {
             //test($assignment, 1); // Will only happen if there's no move-in time set for the floor,student type
             // Lets only keep a set of the floors
             if (!in_array($floor, $missingMovein)) {
                 $missingMovein[] = $floor;
             }
             // Missing move-in time, so skip to the next assignment
             continue;
         }
         // TODO: Grab all the move-in times and index them in an array by ID so we don't have to query the DB every single time
         $movein_time_obj = new HMS_Movein_Time($moveinTimeId);
         $movein_time = $movein_time_obj->get_formatted_begin_end();
         // Add a bit of text if the move-in time was for an RLC
         if ($rlcSetMoveinTime) {
             $movein_time .= ' (for the ' . $rlc->get_community_name() . ' Residential Learning Community)';
         }
         //get the list of roommates
         $roommates = array();
         $beds = $room->get_beds();
         foreach ($beds as $bed) {
             $roommate = $bed->get_assignee();
             if ($roommate == false || is_null($roommate) || $roommate->getUsername() == $student->getUsername()) {
                 continue;
             }
             $roommates[] = $roommate->getFullName() . ' (' . $roommate->getUsername() . '@appstate.edu) - Bedroom ' . $bed->bedroom_label;
         }
         // Send the email
         HMS_Email::sendAssignmentNotice($student->getUsername(), $student->getName(), $term, $location, $roommates, $movein_time);
         // Mark the student as having received an email
         $db->reset();
         $db->addWhere('asu_username', $assignment->getUsername());
         $db->addWhere('term', $term);
         $db->addValue('email_sent', 1);
         $rslt = $db->update();
         if (PHPWS_Error::logIfError($rslt)) {
             throw new DatabaseException($result->toString());
         }
     }
     // Check for floors with missing move-in times.
     if (empty($missingMovein) || is_null($missingMovein)) {
         // Ther are none, so show a success message
         NQ::simple('hms', hms\NotificationView::SUCCESS, "Assignment notifications sent.");
     } else {
         // Show a warning for each floor that was missing a move-in time
         foreach ($missingMovein as $floor) {
             $hall = $floor->get_parent();
             $text = $floor->getLink($hall->getHallName() . " floor ") . " move-in times not set.";
             NQ::simple('hms', hms\NotificationView::WARNING, $text);
         }
     }
     $context->goBack();
 }
Example #13
0
 public function show()
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You are not allowed to edit or view floors.');
     }
     javascript('jquery_ui');
     $floor_num = $this->floor->getFloorNumber();
     // Setup the title and color of the title bar
     $tpl = array();
     $tpl['FLOOR_NUMBER'] = HMS_Util::ordinal($floor_num);
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $submitCmd = CommandFactory::getCommand('EditFloor');
     $submitCmd->setFloorId($this->floor->getId());
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $tpl['HALL_NAME'] = $this->hall->getLink();
     $tpl['NUMBER_OF_ROOMS'] = $this->floor->get_number_of_rooms();
     $tpl['NUMBER_OF_BEDS'] = $this->floor->get_number_of_beds();
     $tpl['NOMINAL_BEDS'] = $this->floor->countNominalBeds();
     $tpl['NUMBER_OF_ASSIGNEES'] = $this->floor->get_number_of_assignees();
     if (!$this->floor->isOnline()) {
         $tpl['OFFLINE_ATTRIB'] = 'Offline';
     }
     $form->addDropBox('gender_type', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, COED => COED_DESC));
     $form->setMatch('gender_type', $this->floor->gender_type);
     $form->addCssClass('gender_type', 'form-control');
     $form->addCheck('is_online', 1);
     $form->setMatch('is_online', $this->floor->is_online);
     $movein_times = HMS_Movein_Time::get_movein_times_array();
     $form->addDropBox('f_movein_time', $movein_times);
     $form->addCssClass('f_movein_time', 'form-control');
     if (!isset($this->floor->f_movein_time_id)) {
         $form->setMatch('f_movein_time', 0);
     } else {
         $form->setMatch('f_movein_time', $this->floor->f_movein_time_id);
     }
     $form->addDropBox('t_movein_time', $movein_times);
     $form->addCssClass('t_movein_time', 'form-control');
     if (!isset($this->floor->t_movein_time_id)) {
         $form->setMatch('t_movein_time', 0);
     } else {
         $form->setMatch('t_movein_time', $this->floor->t_movein_time_id);
     }
     $form->addDropBox('rt_movein_time', $movein_times);
     $form->addCssClass('rt_movein_time', 'form-control');
     if (!isset($this->floor->rt_movein_time_id)) {
         $form->setMatch('rt_movein_time', 0);
     } else {
         $form->setMatch('rt_movein_time', $this->floor->rt_movein_time_id);
     }
     // Get a list of the RLCs indexed by id
     PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php');
     $learning_communities = RlcFactory::getRlcList($this->floor->getTerm());
     $learning_communities[0] = 'None';
     $form->addDropBox('floor_rlc_id', $learning_communities);
     $form->addCssClass('floor_rlc_id', 'form-control');
     if (isset($this->floor->rlc_id)) {
         $tpl['RLC_NAME'] = $learning_communities[$this->floor->rlc_id];
         $form->setMatch('floor_rlc_id', $this->floor->rlc_id);
     } else {
         $form->setMatch('floor_rlc_id', 0);
     }
     PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
     if (isset($this->floor->floor_plan_image_id)) {
         $manager = Cabinet::fileManager('floor_plan_image_id', $this->floor->floor_plan_image_id);
     } else {
         $manager = Cabinet::fileManager('floor_plan_image_id');
     }
     $manager->maxImageWidth(300);
     $manager->maxImageHeight(300);
     $manager->imageOnly(false, false);
     $form->addTplTag('FILE_MANAGER', $manager->get());
     $form->addHidden('type', 'floor');
     $form->addHidden('op', 'edit_floor');
     $tpl['STATIC_ROOM_PAGER'] = HMS_Room::room_pager_by_floor($this->floor->id);
     $tpl['DYNAMIC_ROOM_PAGER'] = HMS_Room::room_pager_by_floor($this->floor->id, true);
     // if the user has permission to view the form but not edit it then
     // disable it
     if (Current_User::allow('hms', 'floor_view') && !Current_User::allow('hms', 'floor_attributes') && !Current_User::allow('hms', 'floor_structure')) {
         $form_vars = get_object_vars($form);
         $elements = $form_vars['_elements'];
         foreach ($elements as $element => $value) {
             $form->setDisabled($element);
         }
     }
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     if (Current_User::allow('hms', 'edit_role_members')) {
         javascript('modules/hms/role_editor');
         $tpl['ROLE_EDITOR'] = PHPWS_Template::process(array('CLASS_NAME' => "'HMS_Floor'", 'ID' => $this->floor->id), 'hms', 'admin/role_editor.tpl');
     }
     Layout::addPageTitle("Edit Floor");
     return PHPWS_Template::process($tpl, 'hms', 'admin/edit_floor.tpl');
 }
Example #14
0
 public function show()
 {
     $tpl = new PHPWS_Template('hms');
     if (!$tpl->setFile('admin/reports/hall_overview.tpl')) {
         return 'Template error.';
     }
     $rlcs = HMS_Learning_Community::getRlcList();
     $rlcs_abbr = HMS_Learning_Community::getRLCListAbbr();
     $tpl->setData(array('HALL' => $this->hall->hall_name, 'TERM' => Term::getPrintableSelectedTerm()));
     if ($this->nakedDisplay) {
         $menuCmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
         $tpl->setData(array('MAINTENANCE' => $menuCmd->getLink('Main Menu')));
     }
     $class = 'toggle1';
     $this->hall->loadFloors();
     foreach ($this->hall->_floors as $floor) {
         $floor->loadRooms();
         if (!isset($floor->_rooms)) {
             continue;
         }
         if ($floor->rlc_id != NULL) {
             $floor_rlc = $rlcs[$floor->rlc_id];
         } else {
             $floor_rlc = '';
         }
         foreach ($floor->_rooms as $room) {
             $extra_attribs = '';
             if ($room->isOffline()) {
                 $extra_attribs .= 'Offline ';
             }
             if ($room->isReserved()) {
                 $extra_attribs .= 'Reserved ';
             }
             if ($room->isRa()) {
                 $extra_attribs .= 'RA ';
             }
             if ($room->isPrivate()) {
                 $extra_attribs .= 'Private ';
             }
             if ($room->isOverflow()) {
                 $extra_attribs .= 'Overflow ';
             }
             if ($room->isParlor()) {
                 $extra_attribs .= 'Parlor ';
             }
             if ($room->isADA()) {
                 $extra_attribs .= 'ADA';
             }
             if ($room->isHearingImpaired()) {
                 $extra_attribs .= 'Hearing Impaired';
             }
             if ($room->bathEnSuite()) {
                 $extra_attribs .= 'Bath en Suite';
             }
             $room->loadBeds();
             if (empty($room->_beds)) {
                 $tpl->setCurrentBlock('room_repeat');
                 $tpl->setData(array('EXTRA_ATTRIBS' => $extra_attribs, 'ROOM_NUMBER' => $room->getLink('Room')));
                 $tpl->parseCurrentBlock();
                 continue;
             }
             foreach ($room->_beds as $bed) {
                 $bed->loadAssignment();
                 $tpl->setCurrentBlock('bed_repeat');
                 $bed_link = $bed->getLink();
                 if (isset($bed->_curr_assignment)) {
                     $username = $bed->_curr_assignment->asu_username;
                     try {
                         $student = StudentFactory::getStudentByUsername($username, $this->hall->term);
                     } catch (StudentNotFoundException $e) {
                         $student = null;
                         NQ::simple('hms', hms\NotificationView::WARNING, "Could not find data for: {$username}");
                     }
                     $assign_rlc = HMS_RLC_Assignment::checkForAssignment($username, $this->hall->term);
                     //false or index
                     if ($assign_rlc != FALSE) {
                         $rlc_abbr = $rlcs_abbr[$assign_rlc['rlc_id']];
                         //get the abbr for the rlc
                     } else {
                         $rlc_abbr = '';
                     }
                     // Alternating background colors
                     if ($class == 'toggle1') {
                         $class = 'toggle2';
                     } else {
                         $class = 'toggle1';
                     }
                     if (is_null($student)) {
                         $tpl->setData(array('BED_LABEL' => $bed->bedroom_label, 'BED' => $bed_link, 'NAME' => 'UNKNOWN', 'USERNAME' => $username, 'BANNER_ID' => '', 'TOGGLE' => $class, 'RLC_ABBR' => $rlc_abbr));
                     } else {
                         $tpl->setData(array('BED_LABEL' => $bed->bedroom_label, 'BED' => $bed_link, 'NAME' => $student->getProfileLink(), 'USERNAME' => $student->getUsername(), 'BANNER_ID' => $student->getBannerId(), 'TOGGLE' => $class, 'RLC_ABBR' => $rlc_abbr));
                     }
                 } else {
                     $tpl->setData(array('BED_LABEL' => $bed->bedroom_label, 'BED' => $bed_link, 'NAME' => $bed->get_assigned_to_link(), 'VACANT' => ''));
                 }
                 $tpl->parseCurrentBlock();
             }
             $tpl->setCurrentBlock('room_repeat');
             $tpl->setData(array('EXTRA_ATTRIBS' => $extra_attribs, 'ROOM_NUMBER' => $room->getLink('Room')));
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('floor_repeat');
         $tpl->setData(array('FLOOR_NUMBER' => $floor->getLink('Floor'), 'FLOOR_RLC' => $floor_rlc));
         $tpl->parseCurrentBlock();
     }
     if ($this->nakedDisplay) {
         Layout::nakedDisplay($tpl->get(), 'Building overview for ' . $this->hall->hall_name, TRUE);
     }
     Layout::addPageTitle("Hall Overview");
     return $tpl->get();
 }
Example #15
0
 /**
  * @see View::show()
  */
 public function show()
 {
     $jsParams = array('LINK_SELECT' => '#addDamageLink');
     javascript('addRoomDamage', $jsParams, 'mod/hms/');
     // Drop down enhancements for room damage dialog
     javascript('chosen', null, 'mod/hms/');
     /*** Header Info ***/
     $tpl = array();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $tpl['HALL_NAME'] = $this->hall->getLink();
     $tpl['FLOOR_NUMBER'] = $this->floor->getLink('Floor');
     /*** Page Title ***/
     $tpl['ROOM'] = $this->room->getRoomNumber();
     /*** Room Attributes Labels ***/
     if ($this->room->isOffline()) {
         $tpl['OFFLINE_ATTRIB'] = 'Offline';
     }
     if ($this->room->isReserved()) {
         $tpl['RESERVED_ATTRIB'] = 'Reserved';
     }
     if ($this->room->isRa()) {
         $tpl['RA_ATTRIB'] = 'RA';
     }
     if ($this->room->isPrivate()) {
         $tpl['PRIVATE_ATTRIB'] = 'Private';
     }
     if ($this->room->isOverflow()) {
         $tpl['OVERFLOW_ATTRIB'] = 'Overflow';
     }
     if ($this->room->isParlor()) {
         $tpl['PARLOR_ATTRIB'] = 'Parlor';
     }
     if ($this->room->isADA()) {
         $tpl['ADA_ATTRIB'] = 'ADA';
     }
     if ($this->room->isHearingImpaired()) {
         $tpl['HEARING_ATTRIB'] = 'Hearing Impaired';
     }
     if ($this->room->bathEnSuite()) {
         $tpl['BATHENSUITE_ATTRIB'] = 'Bath en Suite';
     }
     $number_of_assignees = $this->room->get_number_of_assignees();
     $tpl['NUMBER_OF_BEDS'] = $this->room->get_number_of_beds();
     $tpl['NUMBER_OF_ASSIGNEES'] = $number_of_assignees;
     $form = new PHPWS_Form();
     $submitCmd = CommandFactory::getCommand('EditRoom');
     $submitCmd->setRoomId($this->room->id);
     $submitCmd->initForm($form);
     $form->addText('room_number', $this->room->getRoomNumber());
     $form->setLabel('room_number', 'Room Number');
     $form->addCssClass('room_number', 'form-control');
     /*** Room Gender ***/
     if ($number_of_assignees == 0) {
         // Room is empty, show the drop down so the user can change the gender
         $roomGenders = array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, AUTO => AUTO_DESC);
         // Check if the user is allowed to set rooms to co-ed, if so add Co-ed to the drop down
         if (Current_User::allow('hms', 'coed_rooms')) {
             $roomGenders[COED] = COED_DESC;
         }
         $form->addDropBox('gender_type', $roomGenders);
         $form->setMatch('gender_type', $this->room->gender_type);
         $form->addCssClass('gender_type', 'form-control');
     } else {
         // Room is not empty so just show the gender (no drop down)
         $tpl['GENDER_MESSAGE'] = HMS_Util::formatGender($this->room->getGender());
         // Add a hidden variable for 'gender_type' so it will be defined upon submission
         $form->addHidden('gender_type', $this->room->gender_type);
         // Show the reason the gender could not be changed.
         if ($number_of_assignees != 0) {
             $tpl['GENDER_REASON'] = 'Remove occupants to change room gender.';
         }
     }
     //Always show the option to set the default gender
     $form->addDropBox('default_gender', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, AUTO => AUTO_DESC));
     $form->setLabel('default_gender', 'Default Gender');
     $form->setMatch('default_gender', $this->room->default_gender);
     $form->addCssClass('default_gender', 'form-control');
     $form->addDropBox('rlc_reserved', array("0" => "Choose RLC") + RlcFactory::getRlcList($this->room->getTerm()));
     $form->setLabel('rlc_reserved', 'Reserved for RLC');
     $form->setMatch('rlc_reserved', $this->room->getReservedRlcId());
     $form->addCssClass('rlc_reserved', 'form-control');
     $form->addCheck('offline', 1);
     $form->setLabel('offline', 'Offline');
     $form->setMatch('offline', $this->room->isOffline());
     $form->addCheck('reserved', 1);
     $form->setLabel('reserved', 'Reserved');
     $form->setMatch('reserved', $this->room->isReserved());
     $form->addCheck('ra', 1);
     $form->setLabel('ra', 'Reserved for RA');
     $form->setMatch('ra', $this->room->isRa());
     $form->addCheck('private', 1);
     $form->setLabel('private', 'Private');
     $form->setMatch('private', $this->room->isPrivate());
     $form->addCheck('overflow', 1);
     $form->setLabel('overflow', 'Overflow');
     $form->setMatch('overflow', $this->room->isOverflow());
     $form->addCheck('parlor', 1);
     $form->setLabel('parlor', 'Parlor');
     $form->setMatch('parlor', $this->room->isParlor());
     $form->addCheck('ada', 1);
     $form->setLabel('ada', 'ADA');
     $form->setMatch('ada', $this->room->isAda());
     $form->addCheck('hearing_impaired', 1);
     $form->setLabel('hearing_impaired', 'Hearing Impaired');
     $form->setMatch('hearing_impaired', $this->room->isHearingImpaired());
     $form->addCheck('bath_en_suite', 1);
     $form->setLabel('bath_en_suite', 'Bath en Suite');
     $form->setMatch('bath_en_suite', $this->room->bathEnSuite());
     $form->addSubmit('submit', 'Submit');
     // Assignment pagers
     $tpl['BED_PAGER'] = HMS_Bed::bed_pager_by_room($this->room->id);
     // if the user has permission to view the form but not edit it then
     // disable it
     if (Current_User::allow('hms', 'room_view') && !Current_User::allow('hms', 'room_attributes') && !Current_User::allow('hms', 'room_structure')) {
         $form_vars = get_object_vars($form);
         $elements = $form_vars['_elements'];
         foreach ($elements as $element => $value) {
             $form->setDisabled($element);
         }
     }
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     $reasonsList = HMS_Room::listReserveReasons();
     $tpl['ATHLETICS_OPTIONS'] = $reasonsList['Athletics'];
     $tpl['SPECIAL_NEEDS_OPTIONS'] = $reasonsList['SpecialNeeds'];
     $tpl['SCHOLARS_OPTIONS'] = $reasonsList['ScholarsOrganizations'];
     $tpl['MISC_OPTIONS'] = $reasonsList['Miscellaneous'];
     if ($this->room->getReservedReason() == "") {
         $tpl['CURRENT_REASON'] = 'none';
     } else {
         $tpl['CURRENT_REASON'] = $this->room->getReservedReason();
     }
     $tpl['RESERVED_NOTES'] = $this->room->getReservedNotes();
     Layout::addPageTitle("Edit Room");
     $tpl['ROOM_DAMAGE_LIST'] = $this->roomDamagePager();
     if (Current_User::allow('hms', 'add_room_dmg')) {
         $dmgCmd = CommandFactory::getCommand('ShowAddRoomDamage');
         $dmgCmd->setRoom($this->room);
         $tpl['ADD_DAMAGE_URI'] = $dmgCmd->getURI();
     }
     return PHPWS_Template::process($tpl, 'hms', 'admin/edit_room.tpl');
 }
Example #16
0
 public function show()
 {
     javascript('jquery');
     javascript('jquery_ui');
     javascriptMod('hms', 'StudentProfile');
     $tpl = array();
     $tpl['USERNAME'] = $this->student->getUsername();
     if (Current_User::allow('hms', 'login_as_student')) {
         $loginAsStudent = CommandFactory::getCommand('LoginAsStudent');
         $loginAsStudent->setUsername($this->student->getUsername());
         $tpl['LOGIN_AS_STUDENT_URI'] = $loginAsStudent->getURI();
     }
     $tpl['BANNER_ID'] = $this->student->getBannerId();
     $tpl['NAME'] = $this->student->getFullName();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $tpl['GENDER'] = $this->student->getPrintableGender();
     $tpl['DOB'] = $this->student->getDOB();
     if (strtotime($this->student->getDOB()) < strtotime("-25 years")) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'Student is 25 years old or older!');
     }
     $tpl['CLASS'] = $this->student->getPrintableClass();
     $tpl['TYPE'] = $this->student->getPrintableType();
     $tpl['STUDENT_LEVEL'] = $this->student->getPrintableLevel();
     $tpl['ADMISSION_DECISION'] = $this->student->getAdmissionDecisionCode();
     $tpl['INTERNATIONAL'] = $this->student->isInternational() ? 'Yes' : 'No';
     $tpl['HONORS'] = $this->student->isHonors() ? 'Yes' : 'No';
     $tpl['TEACHING_FELLOW'] = $this->student->isTeachingFellow() ? 'Yes' : 'No';
     $tpl['WATAUGA'] = $this->student->isWataugaMember() ? 'Yes' : 'No';
     if ($this->student->pinDisabled()) {
         NQ::simple('hms', hms\NotificationView::WARNING, "This student's PIN is disabled.");
     }
     try {
         $tpl['APPLICATION_TERM'] = Term::toString($this->student->getApplicationTerm());
     } catch (InvalidTermException $e) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'Application term is bad or missing.');
         $tpl['APPLICATION_TERM'] = 'WARNING: Application Term is bad or missing: "' . $this->student->getApplicationTerm() . '"';
     }
     /*****************
      * Phone Numbers *
      *****************/
     $phoneNumberList = $this->student->getPhoneNumberList();
     if (isset($phoneNumberList) && !is_null($phoneNumberList)) {
         foreach ($this->student->getPhoneNumberList() as $phone_number) {
             $tpl['phone_number'][] = array('NUMBER' => $phone_number);
         }
     }
     /*************
      * Addresses *
      *************/
     foreach ($this->student->getAddressList() as $address) {
         //If it's not a PS or PR address, skip it
         if ($address->atyp_code != 'PR' && $address->atyp_code != 'PS') {
             continue;
         }
         switch ($address->atyp_code) {
             case 'PS':
                 $addr_type = 'Student Address';
                 break;
             case 'PR':
                 $addr_type = 'Permanent Residence Address';
                 break;
             default:
                 $addr_type = 'Unknown-type address';
         }
         $addr_array = array();
         $addr_array['ADDR_TYPE'] = $addr_type;
         $addr_array['ADDRESS_L1'] = $address->line1;
         if (isset($address->line2)) {
             $addr_array['ADDRESS_L2'] = $address->line2;
         }
         if (isset($address->line3)) {
             $addr_array['ADDRESS_L3'] = $address->line3;
         }
         $addr_array['CITY'] = $address->city;
         $addr_array['STATE'] = $address->state;
         $addr_array['ZIP'] = $address->zip;
         $tpl['addresses'][] = $addr_array;
     }
     /**************
      * Assignment *
      **************/
     if (!is_null($this->assignment)) {
         $reassignCmd = CommandFactory::getCommand('ShowAssignStudent');
         $reassignCmd->setUsername($this->student->getUsername());
         $unassignCmd = CommandFactory::getCommand('ShowUnassignStudent');
         $unassignCmd->setUsername($this->student->getUsername());
         $tpl['ASSIGNMENT'] = $this->assignment->where_am_i(true) . ' ' . $reassignCmd->getLink('Reassign') . ' ' . $unassignCmd->getLink('Unassign');
     } else {
         $assignCmd = CommandFactory::getCommand('ShowAssignStudent');
         $assignCmd->setUsername($this->student->getUsername());
         $tpl['NOT_ASSIGNED'] = $assignCmd->getURI();
     }
     /*************
      * Roommates
      *************/
     if (isset($this->roommates) && !empty($this->roommates)) {
         // Remember, student can only have one confirmed or pending request
         // but multiple assigned roommates
         if (isset($this->roommates['PENDING'])) {
             $tpl['pending'][]['ROOMMATE'] = $this->roommates['PENDING'];
         } else {
             if (isset($this->roommates['CONFIRMED'])) {
                 $tpl['confirmed'][]['ROOMMATE'] = $this->roommates['CONFIRMED'];
             } else {
                 if (isset($this->roommates['NO_BED_AVAILABLE'])) {
                     $tpl['error_status'][]['ROOMMATE'] = $this->roommates['NO_BED_AVAILABLE'];
                 } else {
                     if (isset($this->roommates['MISMATCHED_ROOMS'])) {
                         $tpl['error_status'][]['ROOMMATE'] = $this->roommates['MISMATCHED_ROOMS'];
                     }
                 }
             }
         }
         if (isset($this->roommates['ASSIGNED'])) {
             foreach ($this->roommates['ASSIGNED'] as $roommate) {
                 $tpl['assigned'][]['ROOMMATE'] = $roommate;
             }
         }
     }
     /**************
      * RLC Status *
      *************/
     $rlc_names = RlcFactory::getRlcList(Term::getSelectedTerm());
     $rlc_assignment = HMS_RLC_Assignment::getAssignmentByUsername($this->student->getUsername(), Term::getSelectedTerm());
     $rlc_application = HMS_RLC_Application::getApplicationByUsername($this->student->getUsername(), Term::getSelectedTerm());
     if (!is_null($rlc_assignment)) {
         $tpl['RLC_STATUS'] = "This student is assigned to: " . $rlc_names[$rlc_assignment->rlc_id];
     } else {
         if (!is_null($rlc_application)) {
             $rlcViewCmd = CommandFactory::getCommand('ShowRlcApplicationReView');
             $rlcViewCmd->setAppId($rlc_application->getId());
             $tpl['RLC_STATUS'] = "This student has a " . $rlcViewCmd->getLink('pending RLC application') . ".";
         } else {
             $tpl['RLC_STATUS'] = "This student is not in a Learning Community and has no pending application.";
         }
     }
     /*************************
      * Re-application status *
      *************************/
     $reapplication = HousingApplicationFactory::getAppByStudent($this->student, Term::getSelectedTerm());
     # If this is a re-application, then check the special interest group status
     # TODO: incorporate all this into the LotteryApplication class
     if ($reapplication !== FALSE && $reapplication instanceof LotteryApplication) {
         if (isset($reapplication->special_interest) && !is_null($reapplication->special_interest) && !empty($reapplication->special_interest)) {
             # Student has been approved for a special group
             # TODO: format the name according to the specific group (sororities, etc)
             $tpl['SPECIAL_INTEREST'] = $reapplication->special_interest . '(confirmed)';
         } else {
             # Check if the student selected a group on the application, but hasn't been approved
             if (!is_null($reapplication->sorority_pref)) {
                 $tpl['SPECIAL_INTEREST'] = $reapplication->sorority_pref . ' (pending)';
                 //}else if($reapplication->tf_pref == 1){
                 //$tpl['SPECIAL_INTEREST'] = 'Teaching Fellow (pending)';
             } else {
                 if ($reapplication->wg_pref == 1) {
                     $tpl['SPECIAL_INTEREST'] = 'Watauga Global (pending)';
                 } else {
                     if ($reapplication->honors_pref == 1) {
                         $tpl['SPECIAL_INTEREST'] = 'Honors (pending)';
                     } else {
                         if ($reapplication->rlc_interest == 1) {
                             $tpl['SPECIAL_INTEREST'] = 'RLC (pending)';
                         } else {
                             # Student didn't select anything
                             $tpl['SPECIAL_INTEREST'] = 'No';
                         }
                     }
                 }
             }
         }
     } else {
         # Not a re-application, so can't have a special group
         $tpl['SPECIAL_INTEREST'] = 'No';
     }
     /******************
      * Housing Waiver *
      *************/
     $tpl['HOUSING_WAIVER'] = $this->student->housingApplicationWaived() ? 'Yes' : 'No';
     if ($this->student->housingApplicationWaived()) {
         NQ::simple('hms', hms\NotificationView::WARNING, "This student's housing application has been waived for this term.");
     }
     /****************
      * Applications *
      *************/
     $appList = new ProfileHousingAppList($this->applications);
     $tpl['APPLICATIONS'] = $appList->show();
     /*********
      * Assignment History *
      *********/
     $historyArray = StudentAssignmentHistory::getAssignments($this->student->getBannerId());
     $historyView = new StudentAssignmentHistoryView($historyArray);
     $tpl['HISTORY'] = $historyView->show();
     /**********
      * Checkins
      */
     $checkins = CheckinFactory::getCheckinsForStudent($this->student);
     $checkinHistory = new CheckinHistoryView($checkins);
     $tpl['CHECKINS'] = $checkinHistory->show();
     /*********
      * Notes *
      *********/
     $addNoteCmd = CommandFactory::getCommand('AddNote');
     $addNoteCmd->setUsername($this->student->getUsername());
     $form = new PHPWS_Form('add_note_dialog');
     $addNoteCmd->initForm($form);
     $form->addTextarea('note');
     $form->addSubmit('Add Note');
     /********
      * Logs *
      ********/
     $everything_but_notes = HMS_Activity_Log::get_activity_list();
     unset($everything_but_notes[array_search(ACTIVITY_ADD_NOTE, $everything_but_notes)]);
     if (Current_User::allow('hms', 'view_activity_log') && Current_User::allow('hms', 'view_student_log')) {
         PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
         $activityLogPager = new ActivityLogPager($this->student->getUsername(), null, null, true, null, null, $everything_but_notes, true, 10);
         $activityNotePager = new ActivityLogPager($this->student->getUsername(), null, null, true, null, null, array(0 => ACTIVITY_ADD_NOTE), true, 10);
         $tpl['LOG_PAGER'] = $activityLogPager->show();
         $tpl['NOTE_PAGER'] = $activityNotePager->show();
         $logsCmd = CommandFactory::getCommand('ShowActivityLog');
         $logsCmd->setActeeUsername($this->student->getUsername());
         $tpl['LOG_PAGER'] .= $logsCmd->getLink('View more');
         $notesCmd = CommandFactory::getCommand('ShowActivityLog');
         $notesCmd->setActeeUsername($this->student->getUsername());
         $notesCmd->setActivity(array(0 => ACTIVITY_ADD_NOTE));
         $tpl['NOTE_PAGER'] .= $notesCmd->getLink('View more');
     }
     $tpl = array_merge($tpl, $form->getTemplate());
     // TODO logs
     // TODO tabs
     Layout::addPageTitle("Student Profile");
     return PHPWS_Template::process($tpl, 'hms', 'admin/StudentProfile.tpl');
 }
Example #17
0
 /**
  * (non-PHPdoc)
  * @see View::show()
  */
 public function show()
 {
     PHPWS_Core::initCoreClass('Form.php');
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'assignment_maintenance')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to unassign students.');
     }
     javascript('jquery');
     javascript('modules/hms/assign_student');
     $tpl = array();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $form = new PHPWS_Form();
     $assignCmd = CommandFactory::getCommand('AssignStudent');
     $assignCmd->initForm($form);
     $form->addHidden('term', Term::getSelectedTerm());
     $form->addText('username');
     $form->setLabel('username', 'ASU Username: '******'username', $this->student->getUsername());
     }
     $form->addCssClass('username', 'form-control');
     $form->setExtra('username', 'autofocus');
     // Check to see if a bed_id was passed in, this means
     // the user clicked an 'unassigned' link. We need to pre-populate
     // the drop downs.
     unset($pre_populate);
     if (isset($this->bed)) {
         $pre_populate = true;
         $room = $this->bed->get_parent();
         $floor = $room->get_parent();
         $hall = $floor->get_parent();
     } else {
         $pre_populate = false;
     }
     $hallList = HMS_Residence_Hall::getHallsWithVacanciesArray(Term::getSelectedTerm());
     $form->addDropBox('residence_hall', $hallList);
     if ($pre_populate) {
         $form->setMatch('residence_hall', $hall->id);
     } else {
         $form->setMatch('residence_hall', 0);
     }
     $form->setLabel('residence_hall', 'Residence hall: ');
     $form->addCssClass('residence_hall', 'form-control');
     if ($pre_populate) {
         $form->addDropBox('floor', $hall->get_floors_array());
         $form->setMatch('floor', $floor->id);
     } else {
         $form->addDropBox('floor', array(0 => ''));
     }
     $form->setLabel('floor', 'Floor: ');
     $form->addCssClass('floor', 'form-control');
     if ($pre_populate) {
         $form->addDropBox('room', $floor->get_rooms_array());
         $form->setMatch('room', $room->id);
     } else {
         $form->addDropBox('room', array(0 => ''));
     }
     $form->setLabel('room', 'Room: ');
     $form->addCssClass('room', 'form-control');
     if ($pre_populate) {
         $form->addDropBox('bed', $room->get_beds_array());
         $form->setMatch('bed', $this->bed->id);
         $show_bed_drop = true;
     } else {
         $form->addDropBox('bed', array(0 => ''));
         $show_bed_drop = false;
     }
     $form->setLabel('bed', 'Bed: ');
     $form->addCssClass('bed', 'form-control');
     if ($show_bed_drop) {
         $tpl['BED_STYLE'] = '';
         $tpl['LINK_STYLE'] = 'display: none';
     } else {
         $tpl['BED_STYLE'] = 'display: none';
         $tpl['LINK_STYLE'] = '';
     }
     $form->addDropBox('meal_plan', array(BANNER_MEAL_LOW => 'Low', BANNER_MEAL_STD => 'Standard', BANNER_MEAL_HIGH => 'High', BANNER_MEAL_SUPER => 'Super', BANNER_MEAL_NONE => 'None', BANNER_MEAL_5WEEK => 'Summer (5 weeks)'));
     $form->setLabel('meal_plan', 'Meal plan: ');
     $form->addCssClass('meal_plan', 'form-control');
     // If the username was passed in, and that student has a meal plan
     // pre-select the student's chosen meal plan
     if (isset($this->application)) {
         $form->setMatch('meal_plan', $this->application->getMealPlan());
     } else {
         // Otherwise, select 'standard' meal plan
         $form->setMatch('meal_plan', BANNER_MEAL_STD);
     }
     // "Assignment Type", see defines.php for declarations
     $form->addDropBox('assignment_type', array(-1 => 'Choose assignment type...', ASSIGN_ADMIN => 'Administrative', ASSIGN_APPEALS => 'Appeals', ASSIGN_LOTTERY => 'Lottery', ASSIGN_FR => 'Freshmen', ASSIGN_TRANSFER => 'Transfer', ASSIGN_APH => 'APH', ASSIGN_RLC_FRESHMEN => 'RLC Freshmen', ASSIGN_RLC_TRANSFER => 'RLC Transfer', ASSIGN_RLC_CONTINUING => 'RLC Continuing', ASSIGN_HONORS_FRESHMEN => 'Honors Freshmen', ASSIGN_HONORS_CONTINUING => 'Honors Continuing', ASSIGN_LLC_FRESHMEN => 'LLC Freshmen', ASSIGN_LLC_CONTINUING => 'LLC Continuing', ASSIGN_INTL => 'International', ASSIGN_RA => 'RA', ASSIGN_RA_ROOMMATE => 'RA Roommate', ASSIGN_MEDICAL_FRESHMEN => 'Medical Freshmen', ASSIGN_MEDICAL_CONTINUING => 'Medical Continuing', ASSIGN_SPECIAL_FRESHMEN => 'Special Needs Freshmen', ASSIGN_SEPCIAL_CONTINUING => 'Special Needs Continuing', ASSIGN_RHA => 'RHA/NRHH', ASSIGN_SCHOLARS => 'Diversity &amp; Plemmons Scholars'));
     $form->setMatch('assignment_type', -1);
     $form->setLabel('assignment_type', 'Assignment Type: ');
     $form->addCssClass('assignment_type', 'form-control');
     if ($pre_populate) {
         $form->addHidden('use_bed', 'true');
     } else {
         $form->addHidden('use_bed', 'false');
     }
     $form->addTextarea('note');
     $form->setLabel('note', 'Note: ');
     $form->addCssClass('note', 'form-control');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Assign Student");
     return PHPWS_Template::process($tpl, 'hms', 'admin/assignStudent.tpl');
 }