Ejemplo n.º 1
0
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
     $floor = new HMS_Floor($this->floorId);
     $tpl = array();
     $tpl['HALL_FLOOR'] = $floor->where_am_i();
     if (isset($floor->floor_plan_image_id) && $floor->floor_plan_image_id != 0) {
         $file = Cabinet::getFile($floor->floor_plan_image_id);
         //if the image loaded properly
         if ($file->id == $floor->floor_plan_image_id) {
             $tpl['FLOOR_PLAN_IMAGE'] = $file->parentLinked();
         }
     }
     if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) {
         $rlcId = $this->rlcAssignment->getRlc()->getId();
     } else {
         $rlcId = null;
     }
     $rooms = $floor->get_rooms();
     $tpl['room_list'] = array();
     foreach ($rooms as $room) {
         $row = array();
         $num_avail_beds = $room->count_avail_lottery_beds();
         // We list the room dispite whether it's actually available to choose or not,
         // so decide whether to "gray out" this row in the room list or not
         if ($room->gender_type != $this->student->getGender() && $room->gender_type != AUTO || $num_avail_beds == 0 || $room->reserved == 1 || $room->offline == 1 || $room->private == 1 || $room->overflow == 1 || $room->parlor == 1 || $room->getReservedRlcId() != $rlcId) {
             // Show a grayed out row and no link
             $row['ROOM_NUM'] = $room->room_number;
             $row['ROW_TEXT_COLOR'] = 'text-muted';
             $row['AVAIL_BEDS'] = 0;
             // show 0 available beds since this room is unavailable to the user
         } else {
             // Show the room number as a link
             $roomCmd = CommandFactory::getCommand('LotteryChooseRoom');
             $roomCmd->setRoomId($room->id);
             $row['ROOM_NUM'] = $roomCmd->getLink($room->room_number);
             $row['ROW_TEXT_COLOR'] = 'black';
             $row['AVAIL_BEDS'] = $num_avail_beds;
         }
         if ($room->isADA()) {
             $row['ADA'] = '<i class="fa fa-wheelchair" title="ADA Compliant"></i>';
         }
         if ($room->isHearingImpaired()) {
             $row['HEARING_IMPAIRED'] = '<i class="fa fa-bell-slash" title="Equiped for Hearing Impaired"></i>';
         }
         if ($room->bathEnSuite()) {
             $row['BATH_EN_SUITE'] = '<i class="fa fa-female" title="Bathroom en Suite">|</i><i class="fa fa-male" title="Bathroom en Suite"></i>';
         }
         $row['NUM_BEDS'] = $room->get_number_of_beds();
         $tpl['room_list'][] = $row;
     }
     Layout::addPageTitle("Lottery Choose Room");
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_room.tpl');
 }
Ejemplo n.º 2
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');
 }
Ejemplo n.º 3
0
 public function getFile($thumbnail = false)
 {
     if (!$this->image_id) {
         return null;
     }
     $file = Cabinet::getFile($this->image_id);
     if ($file->isImage(true)) {
         if ($this->image_link == 'default') {
             if ($thumbnail) {
                 return $file->getThumbnail();
             } else {
                 return $file->getTag();
             }
         }
         $file->allowImageLink(false);
         if ($this->image_link == 'none') {
             if ($thumbnail) {
                 return $file->getThumbnail();
             } else {
                 return $file->getTag();
             }
         }
         if ($this->image_link == 'parent') {
             return $file->parentLinked($thumbnail);
         } elseif ($this->image_link == 'readmore') {
             $url = $this->getViewLink(true);
         } else {
             $url = $this->image_link;
         }
         if ($thumbnail) {
             return sprintf('<a href="%s">%s</a>', $url, $file->getThumbnail());
         } else {
             return sprintf('<a href="%s">%s</a>', $url, $file->getTag());
         }
     } elseif ($thumbnail && ($file->isMedia() && $file->_source->isVideo())) {
         return sprintf('<a href="%s">%s</a>', $this->getViewLink(true), $file->getThumbnail());
     } else {
         return $file->getTag();
     }
 }