Exemplo n.º 1
0
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
     $hall = new HMS_Residence_Hall($this->hallId);
     $tpl = array();
     $tpl['HALL'] = $hall->hall_name;
     if (isset($hall->exterior_image_id)) {
         $tpl['EXTERIOR_IMAGE'] = Cabinet::getTag($hall->exterior_image_id);
     }
     if (isset($hall->room_plan_image_id) && $hall->room_plan_image_id != 0) {
         $file = Cabinet::getFile($hall->room_plan_image_id);
         $tpl['ROOM_PLAN_IMAGE'] = $file->parentLinked();
     }
     if (isset($hall->map_image_id)) {
         $tpl['MAP_IMAGE'] = Cabinet::getTag($hall->map_image_id);
     }
     if (isset($hall->other_image_id) && $hall->other_image_id != 0 && $hall->other_image_id != '0') {
         $file = Cabinet::getFile($hall->other_image_id);
         $tpl['OTHER_IMAGE'] = $file->parentLinked();
     }
     if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) {
         $rlcId = $this->rlcAssignment->getRlc()->getId();
     } else {
         $rlcId = null;
     }
     $floors = $hall->get_floors();
     foreach ($floors as $floor) {
         $row = array();
         if ($floor->count_avail_lottery_rooms($this->student->getGender(), $rlcId) <= 0) {
             $row['FLOOR'] = HMS_Util::ordinal($floor->floor_number);
             $row['ROW_TEXT_COLOR'] = 'class="text-muted"';
             $tpl['floor_list'][] = $row;
             continue;
         }
         $floorCmd = CommandFactory::getCommand('LotteryChooseFloor');
         $floorCmd->setFloorId($floor->id);
         $row['FLOOR'] = $floorCmd->getLink(HMS_Util::ordinal($floor->floor_number) . ' floor');
         $row['ROW_TEXT_COLOR'] = 'grey';
         $tpl['floor_list'][] = $row;
     }
     Layout::addPageTitle("Choose Floor");
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_floor.tpl');
 }
 protected function render()
 {
     parent::render();
     $this->tpl['TERM'] = Term::toString($this->report->getTerm());
     $halls = $this->report->getHalls();
     // Need to create our own Template object
     $myTpl = new PHPWS_Template('hms');
     $myTpl->setFile('admin/reports/AssignmentTypeByFloor.tpl');
     // Set the existing tags
     $myTpl->setData($this->tpl);
     $hallTags = array();
     foreach ($halls as $hall) {
         $hallCounts = $this->report->getCountsForHall($hall);
         // Hall totals summary
         foreach ($hallCounts as $hallCount) {
             $myTpl->setCurrentBlock('hall_totals');
             $myTpl->setData(array('HALL_TOTAL_TYPE' => constant($hallCount['reason']), 'HALL_TOTAL_COUNT' => $hallCount['count']));
             $myTpl->parseCurrentBlock();
         }
         $floors = $hall->get_floors();
         foreach ($floors as $floor) {
             $counts = $this->report->getCountsForFloor($floor);
             foreach ($counts as $countRow) {
                 $myTpl->setCurrentBlock('floor_counts');
                 $myTpl->setData(array('TYPE' => constant($countRow['reason']), 'COUNT' => $countRow['count']));
                 $myTpl->parseCurrentBlock();
             }
             // Floor tags
             $myTpl->setCurrentBlock('floors');
             $myTpl->setData(array('FLOOR_NUMBER' => HMS_Util::ordinal($floor->getFloorNumber())));
             $myTpl->parseCurrentBlock();
         }
         // Set hall tags
         $hallTags['HALL_NAME'] = $hall->getHallName();
         $hallTags['HALL_OCCUPANCY'] = $hall->get_number_of_assignees();
         $hallTags['HALL_CAPACITY'] = $hall->countNominalBeds();
         $myTpl->setCurrentBlock('hall_repeat');
         $myTpl->setData($hallTags);
         $myTpl->parseCurrentBlock();
     }
     //return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/AssignmentTypeByFloor.tpl');
     return $myTpl->get();
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
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');
 }