|
static | findRoomsByRequest (ResourceRequest $request, $excluded_room_ids=[]) |
|
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=[ResourceBooking::TYPE_NORMAL, ResourceBooking::TYPE_RESERVATION, ResourceBooking::TYPE_LOCK, ResourceBooking::TYPE_PLANNED,], $building_booking_types=[ResourceBooking::TYPE_NORMAL, ResourceBooking::TYPE_RESERVATION, ResourceBooking::TYPE_LOCK, ResourceBooking::TYPE_PLANNED,], $exclude_canceled_intervals=true) |
|
static | findRooms ( $room_name='', $location_id=null, $building_id=null, $properties=[], $time_ranges=[], $order_by=null, $only_requestable_rooms=true, $excluded_room_ids=[], $only_fully_available=true) |
|
static | findOverbookedRoomBookings (DateTime $begin, DateTime $end) |
|
static | getAllRoomPropertyDefinitions ( $only_searchable=false, $excluded_properties=[]) |
|
static | getHierarchyNames (Room $room, $all_items=false) |
|
static | groupRooms ($rooms=[]) |
|
static | getAllRoomClassNames () |
|
static | countRequestableRooms (array $time_ranges=[]) |
|
static | findRequestableRooms (array $time_ranges=[]) |
|
The RoomManager class contains methods that simplify the handling of rooms which are one type of resources.
◆ countRequestableRooms()
static countRequestableRooms |
( |
array |
$time_ranges = [] | ) |
|
|
static |
◆ 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 | $user | The user whose rooms shall be retrieved. |
string | $level | The 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_only | Whether to count only rooms with permanent permissions (true) or rooms with permanent and temporary permissions (false). Defaults to false. |
DateTime | int | null | $time | The timestamp for the check on temporary permissions. If this parameter is not set the current timestamp will be used. |
string | $sql_conditions | An optional SQL condition that will be placed in the WHERE block of the SQL query to filter the result set. |
array | $sql_condition_parameters | An optional associative array for the sql condition parameter containing variable parameters that shall be used in the SQL query. |
◆ createRoomBookingsByRequest()
- Parameters
-
bool | $notify_teachers | True, 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. |
◆ 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 | $begin | The begin of the time range. |
DateTime | $end | The end of the time range. |
- Returns
- SimpleORMapCollection A collection of overbooked room bookings as ResourceBooking objects.
◆ findRequestableRooms()
static findRequestableRooms |
( |
array |
$time_ranges = [] | ) |
|
|
static |
◆ findRooms()
static findRooms |
( |
|
$room_name = '' , |
|
|
|
$location_id = null , |
|
|
|
$building_id = null , |
|
|
|
$properties = [] , |
|
|
|
$time_ranges = [] , |
|
|
|
$order_by = null , |
|
|
|
$only_requestable_rooms = true , |
|
|
|
$excluded_room_ids = [] , |
|
|
|
$only_fully_available = 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 | $room_name | The name of the room. |
string | $location_id | The ID of the location where the room shall lie in. |
string | $building_id | |
| string[] | $properties An 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_ranges | Optional 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_by | An optional SQL snippet specifying the order of the results. Defaults to null (no sorting). |
bool | $only_requestable_rooms | Whether the search shall be limited to requestable rooms only (true) or not (false). |
array | $excluded_room_ids | |
bool | $only_fully_available | Whether only rooms shall be added to the result set that are fully available in the requested time ranges (true) or whether rooms shall be added that are only partially available in those time ranges (false). Defaults to true. |
- Returns
- array
◆ findRoomsByRequest()
static findRoomsByRequest |
( |
ResourceRequest |
$request, |
|
|
|
$excluded_room_ids = [] |
|
) |
| |
|
static |
◆ getAllRoomClassNames()
static getAllRoomClassNames |
( |
| ) |
|
|
static |
- Returns
- string[] A list containing class names of all classes that are derived from the Room class and the Room class itself.
◆ 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_searchable | Whether only searchable properties shall be returned (true) or all properties shall be returned (false). Defaults to false. |
| string[] | $excluded_properties An array containing the names of the properties that shall be excluded from the result set. |
- Returns
- ResourcePropertyDefinition[] An array of ResourcePropertyDefinition objects.
◆ getBookingIntervalsForRoom()
static getBookingIntervalsForRoom |
( |
Room |
$room, |
|
|
DateTime |
$begin, |
|
|
DateTime |
$end, |
|
|
|
$booking_types = [ ResourceBooking::TYPE_NORMAL , |
|
|
ResourceBooking::TYPE_RESERVATION |
, |
|
|
ResourceBooking::TYPE_LOCK |
, |
|
|
ResourceBooking::TYPE_PLANNED |
, |
|
|
] |
, |
|
|
|
$building_booking_types = [ ResourceBooking::TYPE_NORMAL , |
|
|
ResourceBooking::TYPE_RESERVATION |
, |
|
|
ResourceBooking::TYPE_LOCK |
, |
|
|
ResourceBooking::TYPE_PLANNED |
, |
|
|
] |
, |
|
|
|
$exclude_canceled_intervals = true |
|
) |
| |
|
static |
◆ getHierarchyNames()
static getHierarchyNames |
( |
Room |
$room, |
|
|
|
$all_items = false |
|
) |
| |
|
static |
Returns the names of all hierarchy elements from the location to the specified room.
- Parameters
-
Room | $room | The room to start with. |
bool | $all_items | Whether to include all resource item names while traversing the tree upwards (true) or to only include the names of the room, the building and the location (false). |
- Returns
- string[] An array with the names of the hierarchy elements, starting with the location name.
◆ getRequestableRoomsSqlData()
static getRequestableRoomsSqlData |
( |
array |
$time_ranges = [] | ) |
|
|
staticprotected |
This method creates the SQL data for the methods countRequestableRooms and findRequestableRooms.
- Parameters
-
array | time_ranges[][] The time ranges in which a requestable room must be available to be included in the result set. This is a two-dimensional array where the second dimension is an associative array with two indexes: "begin" and "end". These can either be timestamps or DateTime objects representing the begin and end of the time range, respectively. |
- Returns
- array An associative array with two indexes:
- sql: The SQL query as string.
- sql_params: An associative array with all parameters for the query.
◆ 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 | $user | The user whose rooms shall be retrieved. |
bool | $permanent_only | Whether to retrieve only rooms with permanent permissions (true) or rooms with permanent and temporary permissions (false). Defaults to false. |
string | $level | The minimum permission level the user must have on a room so that it will be included in the result set. |
string | $sql_conditions | An optional SQL condition that will be placed in the WHERE block of the SQL query to filter the result set. |
array | $sql_condition_parameters | An optional associative array for the sql condition parameter containing variable parameters that shall be used in the SQL query. |
DateTime | int | null | $time | The timestamp for the check on temporary permissions. If this parameter is not set the current timestamp will be used. |
- Returns
- Room[]
◆ getUserRoomsSqlData()
static getUserRoomsSqlData |
( |
User |
$user, |
|
|
|
$level = 'user' , |
|
|
|
$permanent_only = false , |
|
|
|
$time = null , |
|
|
|
$sql_conditions = '' , |
|
|
|
$sql_condition_parameters = [] , |
|
|
|
$sql_order_by = 'ORDER BY resources.sort_position DESC , |
|
|
resources.name ASC' |
|
|
) |
| |
|
staticprotected |
Helper method that creates the identical SQL query for the countUserRooms and findUserRooms methods.
◆ groupRooms()
static groupRooms |
( |
|
$rooms = [] | ) |
|
|
static |
Groups rooms by their location and building.
- Parameters
-
Room[] | $rooms An array of rooms that shall be grouped. |
- Returns
- Array[][][] A three dimensional array with the whole hierarchy for the specified rooms. The array structure is as follows: [ [ 'location' => Location object 'buildings' => [ 'building' => Building object 'rooms' => Array of room objects. ] ] ]
◆ 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 | $user | The user whose permissions shall be checkec. |
string | $level | The 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_only | Whether to count only rooms with permanent permissions (true) or rooms with permanent and temporary permissions (false). Defaults to false. |
string | $sql_conditions | An optional SQL condition that will be placed in the WHERE block of the SQL query to filter the result set. |
array | $sql_condition_parameters | An optional associative array for the sql condition parameter containing variable parameters that shall be used in the SQL query. |
DateTime | int | null | $time | The 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.
The documentation for this class was generated from the following file: