/**
  * Constructor.
  *
  * @param                   ilDate seed date
  * @param                   int    type of schedule (TYPE_DAY,TYPE_WEEK or TYPE_MONTH)
  * @param                   int    user_id
  * @param ilRoomSharingRoom $room
  */
 public function __construct(ilDate $seed, $a_type, $a_user_id = 0, ilRoomSharingRoom $room)
 {
     global $ilUser, $ilDB;
     $this->room_obj = $room;
     $this->db = $ilDB;
     $this->type = $a_type;
     $this->initPeriod($seed);
     if (!$a_user_id || $a_user_id == $ilUser->getId()) {
         $this->user = $ilUser;
     } else {
         $this->user = new ilObjUser($a_user_id);
     }
     $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
     $this->weekstart = $this->user_settings->getWeekStart();
     $this->timezone = $this->user->getTimeZone();
     $this->ilRoomSharingDatabase = new ilRoomsharingDatabase($room->getPoolId());
 }
 private function getMaxRoomAllocationInfo()
 {
     $room = new ilRoomSharingRoom($this->pool_id, $this->room_id);
     $max_alloc = $this->lng->txt("rep_robj_xrs_at_most") . ": " . ($room->getMaxAlloc() - self::NUM_PERSON_RESPONSIBLE);
     return $max_alloc;
 }
 public function getRoomName()
 {
     include_once "Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/classes/rooms/detail/class.ilRoomSharingRoom.php";
     $room = new ilRoomSharingRoom($this->pool_id, $this->room_id);
     return $room->getName();
 }
 /**
  * Method that checks if the min allocation of a room is not reached.
  */
 private function isRoomUnderbooked()
 {
     $room = new ilRoomSharingRoom($this->pool_id, $this->room_id);
     $min_alloc = $room->getMinAlloc();
     $filtered_participants = array_filter($this->participants, array($this, "filterValidParticipants"));
     $underbooked = count($filtered_participants) + 1 < $min_alloc;
     return $underbooked;
 }
 /**
  * @covers ilRoomSharingRoom::setBookedTimes
  */
 public function testSetBookedTimes()
 {
     $bookedTimes = array(array(1), array(2), array(3));
     self::$room->setBookedTimes($bookedTimes);
     $this->assertEquals($bookedTimes, self::$room->getBookedTimes());
 }