Stud.IP  jlu_4.3 Revision 64286
RoomManager Class Reference
Collaboration diagram for RoomManager:
Collaboration graph

Static Public Member Functions

static findRoomsByRequest (ResourceRequest $request)
 
static userHasRooms (User $user, $level='user', $permanent_only=false, $time=null, $sql_conditions='', $sql_condition_parameters=[])
 
static countUserRooms (User $user, $level='user', $permanent_only=false, $time=null, $sql_conditions='', $sql_condition_parameters=[])
 
static getUserRooms (User $user, $level='user', $permanent_only=false, $time=null, $sql_conditions='', $sql_condition_parameters=[])
 
static createRoomBookingsByRequest (Room $room, RoomRequest $room_request, User $user, $notify_teachers=true)
 
static getBookingIntervalsForRoom (Room $room, DateTime $begin, DateTime $end, $booking_types=[0, 1, 2], $building_booking_types=[0, 1, 2], $exclude_canceled_intervals=true)
 
static findRooms ( $room_name='', $location_id=null, $building_id=null, $properties=[], $time_ranges=[], $order_by=null, $only_requestable_rooms=true)
 
static findOverbookedRoomBookings (DateTime $begin, DateTime $end)
 
static getAllRoomPropertyDefinitions ( $only_searchable=false, $excluded_properties=[])
 

Static Protected Member Functions

static getUserRoomsSqlData (User $user, $level='user', $permanent_only=false, $time=null, $sql_conditions='', $sql_condition_parameters=[])
 

Detailed Description

The RoomManager class contains methods that simplify the handling of rooms which are one type of resources.

Member Function Documentation

◆ countUserRooms()

static countUserRooms ( User  $user,
  $level = 'user',
  $permanent_only = false,
  $time = null,
  $sql_conditions = '',
  $sql_condition_parameters = [] 
)
static

Counts all rooms for which the specified user has permanent or temporary permissions. Root users and global resource admins get the amount of rooms in the Stud.IP system as result.

Parameters
User$userThe user whose rooms shall be retrieved.
string$levelThe minimum permission level the user must have on a room so that it will be included in the result set. Defaults to the "user" permission level.
bool$permanent_onlyWhether to count only rooms with permanent permissions (true) or rooms with permanent and temporary permissions (false). Defaults to false.
DateTime | int | null$timeThe timestamp for the check on temporary permissions. If this parameter is not set the current timestamp will be used.
string$sql_conditionsAn optional SQL condition that will be placed in the WHERE block of the SQL query to filter the result set.
array$sql_condition_parametersAn optional associative array for the sql condition parameter containing variable parameters that shall be used in the SQL query.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createRoomBookingsByRequest()

static createRoomBookingsByRequest ( Room  $room,
RoomRequest  $room_request,
User  $user,
  $notify_teachers = true 
)
static
Parameters
bool$notify_teachersTrue, if the teachers of the course where the room request belongs to shall be notified, false otherwise. This parameter is only useful for room requests made for courses and their dates.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findOverbookedRoomBookings()

static findOverbookedRoomBookings ( DateTime  $begin,
DateTime  $end 
)
static

Searches for room bookings where the room is overbooked in the specified time range. A room is overbooked if a resource booking exists for that room which is associated with a course and the amount of course participants is higher than the amount of seats in the room.

Parameters
DateTime$beginThe begin of the time range.
DateTime$endThe end of the time range.
Returns
SimpleORMapCollection A collection of overbooked room bookings as ResourceBooking objects.
Here is the caller graph for this function:

◆ findRooms()

static findRooms (   $room_name = '',
  $location_id = null,
  $building_id = null,
  $properties = [],
  $time_ranges = [],
  $order_by = null,
  $only_requestable_rooms = true 
)
static

Finds rooms by name, time range and which (at your option) meet the requirements specified by other properties. If a property isn't specified it won't be searched for.

Parameters
string$nameThe name of the room.
string$location_idThe ID of the location where the room shall lie in.
string[]$propertiesAn array of properties and their desired states. This array has the following structure: $properties['property_name'] = 'property_state'; The array keys specify the property names, the entries of the array specify the desired state. Only the seats property may be a single value or an array with two entries. In the first case the room must have at least $seats seats. In the latter case the room must have between $seats[0] and $seats[1] seats. There are special pseudo properties that are handled by this array:
  • room_category_id: The id of a resource category that has 'Room' as class name.
Array$time_rangesOptional time ranges where the rooms have to be available. The format of the array is the following: [ [ 'begin' => (begin timestamp or DateTime object), 'end' => (end timestamp or DateTime object) ] ]
string$order_byAn optional SQL snippet specifying the order of the results. Defaults to null (no sorting).
bool$only_requestable_roomsWhether the search shall be limited to requestable rooms only (true) or not (false).
Returns
Room[] An array containing Room objects for all rooms which are available in the given time range and which have the (optionally) set properties).
Here is the caller graph for this function:

◆ findRoomsByRequest()

static findRoomsByRequest ( ResourceRequest  $request)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllRoomPropertyDefinitions()

static getAllRoomPropertyDefinitions (   $only_searchable = false,
  $excluded_properties = [] 
)
static

Retrieves all properties that are bound to room resource categories or room resources directly.

Parameters
bool$only_searchableWhether only searchable properties shall be returned (true) or all properties shall be returned (false). Defaults to false.
string[]$excluded_propertiesAn array containing the names of the properties that shall be excluded from the result set.
Returns
ResourcePropertyDefinition[] An array of ResourcePropertyDefinition objects.
Here is the caller graph for this function:

◆ getBookingIntervalsForRoom()

static getBookingIntervalsForRoom ( Room  $room,
DateTime  $begin,
DateTime  $end,
  $booking_types = [0, 1, 2],
  $building_booking_types = [0, 1, 2],
  $exclude_canceled_intervals = true 
)
static
Here is the caller graph for this function:

◆ getUserRooms()

static getUserRooms ( User  $user,
  $level = 'user',
  $permanent_only = false,
  $time = null,
  $sql_conditions = '',
  $sql_condition_parameters = [] 
)
static

Retrieves all rooms for which the specified user has permanent or temporary permissions. Root users and global resource admins get a list of all rooms stored in the Stud.IP system.

Parameters
User$userThe user whose rooms shall be retrieved.
bool$permanent_onlyWhether to retrieve only rooms with permanent permissions (true) or rooms with permanent and temporary permissions (false). Defaults to false.
string$levelThe minimum permission level the user must have on a room so that it will be included in the result set.
string$sql_conditionsAn optional SQL condition that will be placed in the WHERE block of the SQL query to filter the result set.
array$sql_condition_parametersAn optional associative array for the sql condition parameter containing variable parameters that shall be used in the SQL query.
DateTime | int | null$timeThe timestamp for the check on temporary permissions. If this parameter is not set the current timestamp will be used.
Returns
Room[]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUserRoomsSqlData()

static getUserRoomsSqlData ( User  $user,
  $level = 'user',
  $permanent_only = false,
  $time = null,
  $sql_conditions = '',
  $sql_condition_parameters = [] 
)
staticprotected

Helper method that creates the identical SQL query for the countUserRooms and findUserRooms methods.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ userHasRooms()

static userHasRooms ( User  $user,
  $level = 'user',
  $permanent_only = false,
  $time = null,
  $sql_conditions = '',
  $sql_condition_parameters = [] 
)
static

Checks whether the specified user has at least one permanent or temporary permission on at least one room. Root users and global resource admins always have permanent permissions.

Parameters
User$userThe user whose permissions shall be checkec.
string$levelThe minimum permission level the user must have on a room so that it will be accepted for the check. Defaults to the "user" permission level.
bool$permanent_onlyWhether to count only rooms with permanent permissions (true) or rooms with permanent and temporary permissions (false). Defaults to false.
string$sql_conditionsAn optional SQL condition that will be placed in the WHERE block of the SQL query to filter the result set.
array$sql_condition_parametersAn optional associative array for the sql condition parameter containing variable parameters that shall be used in the SQL query.
DateTime | int | null$timeThe timestamp for the check on temporary permissions. If this parameter is not set the current timestamp will be used.
Returns
bool True, when the user has permissions for at least one room, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: