Stud.IP
5.4
|
Public Member Functions | |
createGlobalLock (User $user, DateTime $begin, DateTime $end, $ignore_bookings=false) | |
Static Public Member Functions | |
static | createCategory ( $name=null, $description=null, $class_name='Resource', $is_system_category=false, $iconnr='1', $properties=[]) |
static | createLocationCategory ( $name=null, $description=null, $additional_properties=[]) |
static | createBuildingCategory ( $name=null, $description=null, $additional_properties=[]) |
static | createRoomCategory ( $name=null, $description=null, $additional_properties=[]) |
static | copyResource (Resource $resource, $copy_hierarchy=true, $new_parent_id=null) |
static | moveResource (Resource $target, Resource $destination) |
static | countUserResources (User $user, $level='user', $time=null, $class_names=[]) |
static | getUserResources (User $user, $level='user', $time=null, $class_names=[], $convert_objects=true) |
static | validateCoordinates (string $coordinate_string) |
static | getPositionArray (ResourceProperty $property) |
static | getPositionString (ResourceProperty $property, $with_altitude=false) |
static | getMapUrlForResourcePosition (ResourceProperty $property) |
static | getGlobalResourcePermission (User $user=null) |
static | userHasResourcePermissions (User $user=null, $level='admin', $time=null) |
static | getLowerPermissionLevels ($level='user') |
static | getHigherPermissionLevels ($level='user') |
static | comparePermissionLevels ( $level='user', $other_level='user') |
static | userHasGlobalPermission (User $user=null, $requested_permission='user') |
static | countResourcesWithPermissions (User $user, $requested_permission='user', $exclude_temporary_permissions=false) |
static | userHasSpecialPermissions (User $user, $requested_permission='user') |
static | getTimeRangesFromRangeId ($range_id=null) |
static | getUserInactivityInterval (User $user, DateTime $time) |
static | getBookingPlanObjects (Resource $resource, $time_ranges=[], $allowed_booking_types=[], $included_requests=null) |
static | getAllResourceClassNames ($excluded_classes=[]) |
static | getHierarchyNames (Resource $resource) |
static | getHierarchy (Resource $resource) |
Static Protected Member Functions | |
static | getUserResourcesSqlData (User $user, $level='user', $time=null, $class_names=[]) |
The ResourceManager class contains methods that simplify the use of Resources.
|
static |
Compares two resource permission levels and returns an integer telling if the first level is less than (-1), equal (0) or greater than (1) the second level.
string | $level | The first permission level. |
string | $other_level | The second permission level. |
InvalidArgumentException | if $level or $other_level are either not set or if they contain invalid permission level strings. |
Creates a copy of a resource and stores the copy in the database.
Resource | $resource | The resource which shall be copied. |
bool | $copy_hierarchy | True, if the resource's children shall also be copied (default). False otherwise. |
string | $new_parent_id | If this is set the original parent_id will be overwritten with the ID in $new_parent_id. |
ResourceException | If the copy cannot be stored. |
|
static |
Counts the resources where the specified user has explicit permissions set, optionally limiting the result to permanent permissions.
User | $user | The user whose resource permissions shall be checked. |
string | $requested_permission | The required minimum permission level for the user. |
|
static |
Counts all resources for which the specified user has permanent or temporary permissions.
User | $user | The user whose resources shall be retrieved. |
string | $level | The minimum permission level the user must have on a resource so that it will be included in the result set. |
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[] | $class_names A list of resource classes that will be used to filter the result set so that only resources being a member of one of the specified resource classes will be retrieved. |
|
static |
Simplifies the creation of a building resource category.
string | $name | The name of the new resource category. |
string | $description | The description of the new resource category. |
string[] | $additional_properties A two-dimensional array with the names and requestable, protected and system flags. See ResourceManager::createCategory for a description of the format of the second array dimension. |
ResourceCategoryException | In case if no name is set or a resource property doesn't exist, if the category's name is ambigous or if the new category cannot be stored, a ResourceCategoryException is thrown. |
|
static |
Simplifies the creation of a resource category.
string | $name | The name of the new resource category. |
string | $description | The description of the new resource category. |
string | $class_name | The class (derived from Resource) which shall be used for resources created with the new category. |
bool | $is_system_category | True, if the category shall be a system category, false otherwise. |
string | $iconnr | The number of the icon for the resource category. |
mixed[] | $properties A two-dimensional array with the names and requestable, protected and system flags. The second dimension of the array must have the following structure: [ property name (string), requestable flag (boolean), protected flag (boolean), system-flag (boolean) ]. |
ResourceCategoryException | In case if no name is set or a resource property doesn't exist, if the category's name is ambigous or if the new category cannot be stored, a ResourceCategoryException is thrown. |
This method allows locking the resource management globally. The user who creates the lock must have admin permissions and the time interval must not lie in another global resource lock interval.
User | $user | The user who wishes to lock the room and resource management globally. |
DateTime | $begin | The begin timestamp of the lock. |
DateTime | $end | The end timestamp of the lock. |
InvalidArgumentException | If $begin lies after $end or if $begin is equal to $end. |
ResourcePermissionException | If the specified user does not have sufficient permissions to lock the resource management globally. |
GlobalResourceLockException | If the resource lock could not be stored. |
|
static |
Simplifies the creation of a location resource category.
string | $name | The name of the new resource category. |
string | $description | The description of the new resource category. |
string[] | $additional_properties A two-dimensional array with the names and requestable, protected and system flags. See ResourceManager::createCategory for a description of the format of the second array dimension. |
ResourceCategoryException | In case if no name is set or a resource property doesn't exist, if the category's name is ambigous or if the new category cannot be stored, a ResourceCategoryException is thrown. |
|
static |
Simplifies the creation of a room resource category.
string | $name | The name of the new resource category. |
string | $description | The description of the new resource category. |
string[] | $additional_properties A two-dimensional array with the names and requestable, protected and system flags. See ResourceManager::createCategory for a description of the format of the second array dimension. |
ResourceCategoryException | In case if no name is set or a resource property doesn't exist, if the category's name is ambigous or if the new category cannot be stored, a ResourceCategoryException is thrown. |
|
static |
|
static |
Retrieves booking plan objects like resource bookings and requests.
string | null | $included_request_types | If this parameter is a string, it can have the values 'all' for retrieving all requests or the ID of a user so that only requests of that user are retrieved. |
|
static |
Returns the resource management global permissions for a user, determined by the assigned roles and by the user's global permissions. This method does the mapping from the old resource management permissions to the new resource management permissions.
|
static |
|
static |
Returns the names of all hierarchy elements from the root to the specified resource.
Resource | $room | The resource to start with. |
|
static |
Returns all permission levels higher than the specified level.
|
static |
Returns all permission levels lower than the specified level.
|
static |
|
static |
|
static |
|
static |
Get time ranges by looking at the object specified by its ID. This method works with CourseDate, SeminarCycleDate and Course objects.
string | $range_id | The ID of a Stud.IP object. |
|
static |
Determines the last booking of the user and calculates the timespan from the last booking until now.
|
static |
Retrieves all resources for which the specified user has permanent or temporary permissions.
User | $user | The user whose resources shall be retrieved. |
string | $level | The minimum permission level the user must have on a resource so that it will be included in the result set. |
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[] | $class_names A list of resource classes that will be used to filter the result set so that only resources being a member of one of the specified resource classes will be retrieved. | |
bool | $convert_objects | If the resource objects in the result set shall be converted to objects of the derived resource classes set this to true, otherwise false. Defaults to true. |
|
staticprotected |
Helper method that creates the identical SQL query for the countUserResources and findUserResources methods.
Moves a resource below another resource and does checks to prevent resource hierarchies with misplaced resource objects. This is just a convenience method which calls the addChild method of the destination resource.
Resource | $target | The resource which shall be moved. |
Resource | $destination | The resource where $target shall be a new child. |
InvalidArgumentException | If $target cannot be placed below $destination. |
|
static |
Checks if the specified user has the specified permission level for the resource management system.
User | null | $user | The user whose global resource permissions shall be checked. |
string | $requested_permission | The required permission level for the user. |
|
static |
Determines if the specified user has the specified permission level set for at least one resource.
User | $user | The users whose resource permissions shall be retrieved. |
string | $level | The permission level the user should have on at least one resource. |
string | int | DateTime | null | $time | The timestamp for the temporary permission level check. If this is not set the current timestamp will be used. |
|
static |
Checks if the specified user has the specified permission level on at least one specific resource.
User | $user | The user whose resource permissions shall be checked. |
string | $requested_permission | The required permission level for the user. |
|
static |
Check if the coordinate are in appropriate CRSWGS_84 format.
string | $coordinate_string |