Stud.IP
6.0
|
Public Member Functions | |
store () | |
delete () | |
cbValidate () | |
__toString () | |
getFolder ($create_if_missing=true) | |
setFolder (ResourceFolder $folder) | |
createFolder () | |
getRequiredPropertyNames () | |
createSimpleBooking (User $user, DateTime $begin, DateTime $end, $preparation_time=0, $description='', $internal_comment='', $booking_type=ResourceBooking::TYPE_NORMAL) | |
createBookingFromRequest (User $user, ResourceRequest $request, $preparation_time=0, $description='', $internal_comment='', $booking_type=ResourceBooking::TYPE_NORMAL, $prepend_preparation_time=false, $notify_lecturers=false) | |
createBooking (User $user, $range_id=null, $time_ranges=[], $repetition_interval=null, $repetition_amount=0, $repetition_end_date=null, $preparation_time=0, $description='', $internal_comment='', $booking_type=ResourceBooking::TYPE_NORMAL, $force_booking=false, string $weekdays='') | |
createSimpleRequest (User $user, DateTime $begin, DateTime $end, $comment='', $preparation_time=0) | |
createRequest (User $user, $date_range_ids=null, $comment='', $properties=[], $preparation_time=0) | |
createLock (User $user, DateTime $begin, DateTime $end, $internal_comment='') | |
getGroupedProperties ($excluded_properties=[]) | |
propertyExists ($name='') | |
getPropertyObject (string $name) | |
getInfolabelProperties () | |
getProperty (string $name) | |
getPropertyRelatedObject (string $name) | |
setProperty (string $name, $state='', $user=null) | |
setPropertiesByName (array $properties, User $user) | |
setPropertiesById (array $properties, User $user=null) | |
isPropertyEditable (string $name, User $user) | |
setPropertyByDefinitionId ($property_definition_id=null, $state=null) | |
setPropertyRelatedObject (string $name, SimpleORMap $object) | |
deleteProperty (string $name, User $user) | |
getPictureUrl () | |
getDefaultPictureUrl () | |
getIcon ($role=Icon::ROLE_INFO) | |
getPropertyArray ($only_requestable_properties=false) | |
isAssigned (DateTime $begin, DateTime $end, $excluded_booking_ids=[]) | |
isReserved (DateTime $begin, DateTime $end, $excluded_reservation_ids=[]) | |
isLocked (DateTime $begin, DateTime $end, $excluded_lock_ids=[]) | |
isAvailable (DateTime $begin, DateTime $end, $excluded_booking_ids=[]) | |
isAvailableForRequest (ResourceRequest $request) | |
getFullName () | |
setUserPermission (User $user, $perm='autor') | |
deleteUserPermission (User $user) | |
deleteAllPermissions () | |
getUserPermission (User $user, $time_range=[], $permanent_only=false) | |
userHasPermission (?User $user, string $permission='user', array $time_range=[]) | |
userMayCreateChild (User $user) | |
userHasRequestRights (User $user) | |
userHasBookingRights (User $user, $begin=null, $end=null) | |
bookingPlanVisibleForUser (?User $user, $time_range=[]) | |
findParentByClassName ($class_name='Resource') | |
findChildrenByClassName ( $class_name='Resource', $depth=0, $convert_objects=true, $order_by_name=true) | |
addChild (Resource $resource) | |
getOpenResourceRequests (DateTime $begin, DateTime $end) | |
getResourceBookings (DateTime $begin, DateTime $end, array $booking_types=[0]) | |
getResourceLocks (DateTime $begin, DateTime $end) | |
hasFiles () | |
getDerivedClassInstance () | |
checkHierarchy () | |
getActionLink ($action='show', $link_parameters=[]) | |
getActionURL ($action='show', $url_parameters=[]) | |
getItemName ($long_format=true) | |
getItemURL () | |
getItemAvatarURL () | |
getLink () | |
Public Member Functions inherited from SimpleORMap | |
__construct ($id=null) | |
__clone () | |
getRelationOptions ($relation) | |
getTableMetadata () | |
hasAutoIncrementColumn () | |
setId ($id) | |
getId () | |
getNewId () | |
toArray ($only_these_fields=null) | |
toRawArray ($only_these_fields=null) | |
toArrayRecursive ($only_these_fields=null) | |
getValue ($field) | |
getRelationValue ($relation, $field) | |
getDefaultValue ($field) | |
setValue ($field, $value) | |
__get ($field) | |
__set ($field, $value) | |
__isset ($field) | |
offsetExists ($offset) | |
offsetGet ($offset) | |
offsetSet ($offset, $value) | |
offsetUnset ($offset) | |
getIterator () | |
count () | |
isField ($field) | |
isRelation ($field) | |
isAdditionalField ($field) | |
isAliasField ($field) | |
isI18nField ($field) | |
setData ($data, $reset=false) | |
isNew () | |
isDeleted () | |
setNew ($is_new) | |
getWhereQuery () | |
restore () | |
store () | |
triggerChdate () | |
delete () | |
isDirty () | |
isFieldDirty ($field) | |
revertValue ($field) | |
getPristineValue ($field) | |
initRelation ($relation) | |
resetRelation ($relation) | |
cleanup () | |
Static Public Member Functions | |
static | findChildren ($resource_id) |
static | getTranslatedClassName ($item_count=1) |
static | getRootResources () |
static | getRequiredProperties () |
static | getLinkForAction ( $action='show', $id=null, $link_parameters=[]) |
static | getURLForAction ( $action='show', $id=null, $url_parameters=[]) |
Static Public Member Functions inherited from SimpleORMap | |
static | tableScheme ($db_table) |
static | expireTableScheme () |
static | exists ($id) |
static | countBySql ($sql='1', $params=[]) |
static | create ($data) |
static | build ($data, $is_new=true) |
static | buildExisting ($data) |
static | import ($data) |
static | findBySQL ($sql, $params=[]) |
static | findOneBySQL ($where, $params=[]) |
static | findThru ($foreign_key_value, $options) |
static | findEachBySQL ($callable, $sql, $params=[]) |
static | findMany ($pks=[], $order='', $order_params=[]) |
static | findEachMany ($callable, $pks=[], $order='', $order_params=[]) |
static | findAndMapBySQL ($callable, $where, $params=[]) |
static | findAndMapMany ($callable, $pks=[], $order='', $order_params=[]) |
static | deleteBySQL ($where, $params=[]) |
static | toObject ($id_or_object) |
static | __callStatic (string $name, array $arguments) |
Static Protected Member Functions | |
static | configure ($config=[]) |
static | buildPathForAction ($action='show', $id=null) |
Static Protected Member Functions inherited from SimpleORMap | |
static | db_table () |
static | db_fields () |
static | pk () |
static | default_values () |
static | serialized_fields () |
static | alias_fields () |
static | i18n_fields () |
static | additional_fields () |
static | has_many () |
static | has_one () |
static | belongs_to () |
static | has_and_belongs_to_many () |
static | registered_callbacks () |
static | known_slots () |
static | notification_map () |
static | getter_setter_map () |
static | configure ($config=[]) |
static | config ($key) |
static | registerCallback ($types, $cb) |
static | unregisterCallback ($types, $cb) |
Static Protected Attributes | |
static | $permission_cache |
Static Protected Attributes inherited from SimpleORMap | |
static | $config = [] |
static | $reserved_slots = ['value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id'] |
static | $performs_batch_operation = false |
Additional Inherited Members | |
Data Fields inherited from SimpleORMap | |
const | ID_SEPARATOR = '_' |
Static Public Attributes inherited from SimpleORMap | |
static | $schemes = null |
Protected Member Functions inherited from SimpleORMap | |
_getId ($field) | |
_setId ($field, $value) | |
_getAdditionalValueFromRelation ($field) | |
_setAdditionalValueFromRelation ($field, $value) | |
_getAdditionalValue ($field) | |
_setAdditionalValue ($field, $value) | |
parseRelationOptions ($type, $name, $options) | |
storeRelations ($only_these=null) | |
deleteRelations () | |
initializeContent () | |
applyCallbacks ($type) | |
cbNotificationMapper ($cb_type) | |
cbAfterInitialize ($cb_type) | |
setSerializedValue ($field, $value) | |
setI18nValue ($field, $value) | |
Protected Attributes inherited from SimpleORMap | |
$content = [] | |
$content_db = [] | |
$is_new = true | |
$is_deleted = false | |
$relations = [] | |
$additional_data = [] | |
string | $i18n_class = I18NString::class |
__toString | ( | ) |
Implements StudipItem.
addChild | ( | Resource | $resource | ) |
Adds a resource as child resource to this resource.
Resource | $resource | The child resource. |
bookingPlanVisibleForUser | ( | ?User | $user, |
$time_range = [] |
|||
) |
Determines if the booking plan of the resource is visible for a specified user.
?User | $user The user whose permission to view the booking plan shall be determined. May be null. |
DateTime[] | $time_range An optional time range for the permission check. |
|
staticprotected |
Returns the part of the URL for getLink and getURL which will be placed inside the calls to URLHelper::getLink and URLHelper::getURL in these methods.
string | $action | The action for the resource. |
string | $id | The ID of the resource. |
InvalidArgumentException | If $resource_id is empty. |
cbValidate | ( | ) |
checkHierarchy | ( | ) |
Checks if the place in the resource hierarchy (resource tree) is correct for this resource. This method has no function in this class but can be filled with logic in one of the classes derived from Resource.
NoResourceClassException | if the class name of this resource is not a derived class of the Resource class. |
|
staticprotected |
createBooking | ( | User | $user, |
$range_id = null , |
|||
$time_ranges = [] , |
|||
$repetition_interval = null , |
|||
$repetition_amount = 0 , |
|||
$repetition_end_date = null , |
|||
$preparation_time = 0 , |
|||
$description = '' , |
|||
$internal_comment = '' , |
|||
$booking_type = ResourceBooking::TYPE_NORMAL , |
|||
$force_booking = false , |
|||
string | $weekdays = '' |
||
) |
A factory method for creating a ResourceBooking object for this resource.
User | $user | The user who wishes to create a resource booking. |
string | $range_id | The ID of the user (or the Stud.IP object) which owns the ResourceBooking. |
array[][] | $time_ranges The time ranges for the booking. At least one time range has to be specified using unix timestamps or DateTime objects. This array has the following structure: [ [ 'begin' => The begin timestamp or DateTime object. 'end' => The end timestamp or DateTime object. ] ] | |
DateInterval | null | $repetition_interval | The repetition interval for the new booking. This must be a DateInterval object if repetitions shall be stored. Otherwise this parameter must be set to null. |
int | $repeat_amount | The amount of repetitions. This parameter is only regarded if $repetition_interval contains a DateInterval object. In case repetitions are specified by their end date set this parameter to 0. |
DateTime | string | null | $repetition_end_date | The end date of the repetition. This can either be an unix timestamp or a DateTime object and will only be regarded if $repetition_interval contains a DateInterval object. In case repetitions are specified by their amount set this parameter to null. |
int | $repetition_amount | (obsolete, has no effect) |
int | $preparation_time | The preparation time which is needed before the real start time. This will be substracted from the begin timestamp and stored in an extra column of the resource_bookings table. |
string | $description | An optional description for the booking. This fields was previously known as "user_free_name". |
string | $internal_comment | An optional comment for the booking which is intended to be used internally in the room and resource administration staff. |
int | $booking_type | The booking type. 0 = normal booking 1 = reservation 2 = lock booking |
bool | $force_booking | If this parameter is set to true, overlapping bookings are removed before storing this booking. |
string | $weekdays | The weekdays (1 - 7) on which the booking shall take place. This is only used when a booking with repetitions shall only take place on some weekdays. |
InvalidArgumentException | If no time ranges are specified or if there is an error regarding the time ranges. |
ResourceBookingRangeException | If $range_id is not set. |
ResourceBookingOverlapException | If the booking overlaps with another booking or a resource lock. |
ResourcePermissionException | If the specified user does not have sufficient permissions to create a resource booking. |
ResourceBookingException | If the repetition interval is invalid or if the resource booking cannot be stored. |
createBookingFromRequest | ( | User | $user, |
ResourceRequest | $request, | ||
$preparation_time = 0 , |
|||
$description = '' , |
|||
$internal_comment = '' , |
|||
$booking_type = ResourceBooking::TYPE_NORMAL , |
|||
$prepend_preparation_time = false , |
|||
$notify_lecturers = false |
|||
) |
Creates bookings from a request.
User | $user | |
ResourceRequest | $request | The request from which a resource booking shall be built. |
int | $preparation_time | |
string | $description | |
string | $internal_comment | |
int | $booking_type | |
bool | $prepend_preparation_time | . If this is set to true, the preparation time will end before the start of the requested time. If $prepend_preparation_time is set to false (the default) the preparation time starts with the start of the requested time. |
bool | $notify_lecturers |
ResourceRequestException | if the request could not be marked as resolved. |
ResourceUnavailableException | if the resource cannot be assigned in at least one of the time ranges specified by the resource request. |
createFolder | ( | ) |
createLock | ( | User | $user, |
DateTime | $begin, | ||
DateTime | $end, | ||
$internal_comment = '' |
|||
) |
Creates a lock booking for this resource.
User | $user | The user who wishes to create a lock booking. |
DateTime | $begin | The begin of the lock time range. |
DateTime | $end | The end of the lock time range. |
string | $internal_comment | An optional comment for the lock booking which is intended to be used internally in the room and resource administration staff. |
ResourceUnavailableException | If a lock booking already exists in the specified time range. |
AccessDeniedException | If the user does not have sufficient permissions to lock this resource. |
createRequest | ( | User | $user, |
$date_range_ids = null , |
|||
$comment = '' , |
|||
$properties = [] , |
|||
$preparation_time = 0 |
|||
) |
This method creates a resource request for this resource.
User | $user | The user who wishes to create a request. |
string | array | $date_range_ids | One or more IDs of Stud.IP objects which can provide at least one time range. Objects which fulfill this requirement are course dates (CourseDate objects), cycle dates (SeminarCycleDate objects) and courses (Course objects). If only one ID is provided it can be passed as string. If multiple IDs are provided they have to be passed as array. |
string | $comment | A comment for the resource request. |
mixed[] | $properties The wishable properties for the resource request. The format of the array is as follows: [ 'property name' => 'property state' ] | |
int | $preparation_time | The requested preparation time before the begin of the requested time range. This parameter must be specified in seconds. Only positive values are accepted. |
InvalidArgumentException | If $date_range_id is not set. or no object which can provide at least one time range can be found with the specified ID. |
ResourceNoTimeRangeException | If no time range can be found by looking at the object, specified by its ID in $date_range_id. |
ResourceUnavailableException | If the resource is not available in the selected time range. |
ResourceRequestException | If the resource request cannot be stored. |
createSimpleBooking | ( | User | $user, |
DateTime | $begin, | ||
DateTime | $end, | ||
$preparation_time = 0 , |
|||
$description = '' , |
|||
$internal_comment = '' , |
|||
$booking_type = ResourceBooking::TYPE_NORMAL |
|||
) |
This is a simplified version of the createBooking method.
User | $user | |
DateTime | $begin | |
DateTime | $end | |
int | $preparation_time | |
string | $description | |
string | $internal_comment | |
int | $booking_type |
createSimpleRequest | ( | User | $user, |
DateTime | $begin, | ||
DateTime | $end, | ||
$comment = '' , |
|||
$preparation_time = 0 |
|||
) |
This method creates a simple request for this resource. A simple request is not bound to a date, metadate or course object and its time ranges. Instead the time range is specified directly. Note that simple resource requests do not support recurrence.
User | $user | The user who wishes to create a simple request. |
DateTime | $begin | The begin timestamp of the request. |
DateTime | $end | The end timestamp of the request. |
string | $comment | A comment for the resource request. |
int | $preparation_time | The requested preparation time before the begin of the requested time range. This parameter must be specified in seconds. Only positive values are accepted. |
AccessDeniedException | If the user is not permitted to request this resource. |
InvalidArgumentException | If the the timestamps provided by $begin and $end are invalid or if $begin is greater than or equal to $end which results in an invalid time range. |
ResourceUnavailableException | If the resource is not available in the selected time range. |
ResourceRequestException | If the resource request cannot be stored. |
delete | ( | ) |
deleteAllPermissions | ( | ) |
Deletes all permissions of all users for this resource.
deleteProperty | ( | string | $name, |
User | $user | ||
) |
Deletes a property for a resource.
string | $name | The name of the property to be deleted. |
User | $user | The user who wishes to delete the property. |
deleteUserPermission | ( | User | $user | ) |
Deletes the permission a specified user has on this resource.
User | $user | The user whose permission shall be deleted. |
|
static |
Returns the children of a resource. The children are converted to an instance of the derived class, if they are not instances of the default Resource class.
findChildrenByClassName | ( | $class_name = 'Resource' , |
|
$depth = 0 , |
|||
$convert_objects = true , |
|||
$order_by_name = true |
|||
) |
This method searches the hierarchy below this resource to find resources matching the specified class name. Via the optional parameter $depth the search can be limited to a specific amount of layers.
string | $class_name | The name of the resource class where resources shall be found to. |
int | $depth | The (optional) maximum depth below this resource which shall be searched. |
bool | $convert_objects | True, if objects shall be converted to $class_name (default), false otherwise. |
bool | $order_by_name | Order the children by name. Defaults to true. |
findParentByClassName | ( | $class_name = 'Resource' | ) |
Retrieves a parent resource object that matches the specified class name. The search stops when either a parent resource with the class name is found or when the root resource object is reached.
string | $class_name | The class name of the parent. |
getActionLink | ( | $action = 'show' , |
|
$link_parameters = [] |
|||
) |
Returns the link for an action for this resource. This is the non-static variant of Resource::getLinkForAction.
string | $action | The action which shall be executed. For default Resources the actions 'show', 'add', 'edit' and 'delete' are defined. |
array | $link_parameters | Optional parameters for the link. |
getActionURL | ( | $action = 'show' , |
|
$url_parameters = [] |
|||
) |
Returns the URL for an action for this resource. This is the non-static variant of Resource::getURLForAction.
string | $action | The action which shall be executed. For default Resources the actions 'show', 'add', 'edit' and 'delete' are defined. |
array | $url_parameters | Optional parameters for the URL. |
getDefaultPictureUrl | ( | ) |
Returns the default picture for the resource class.
Classes derived from Resource should re-implement this method if they want to get a different default picture than the resource icon. The call to getPictureUrl will call the getDefaultPictureUrl method from the derived class.
getDerivedClassInstance | ( | ) |
Converts a Resource object to an object of a specialised resource class.
getFolder | ( | $create_if_missing = true | ) |
Retrieves the folder for this resource.
bool | $create_if_missing | Whether to create a folder (true) or not (false) in case no folder exists for this resource. Defaults to true. |
getFullName | ( | ) |
Returns the full (localised) name of the resource.
getGroupedProperties | ( | $excluded_properties = [] | ) |
Retrieves the properties grouped by their property groups and in the order specified in that group.
string[] | excluded_properties An array with the names of the properties that shall be excluded from the result set. |
getIcon | ( | $role = Icon::ROLE_INFO | ) |
getInfolabelProperties | ( | ) |
Returns all info-label properties
getItemAvatarURL | ( | ) |
Returns the URL to the avatar image or icon of the object, if applicable.
Implements StudipItem.
getItemName | ( | $long_format = true | ) |
Returns a human-readable name of the object.
bool | $long_format | If set to true, a long format that has the object type as a prefix (course, room etc.) is returned. Otherwise only the name is returned. |
Implements StudipItem.
getItemURL | ( | ) |
Returns an URL that points to a page describing or displaying the object.
Implements StudipItem.
getLink | ( | ) |
Creates a StudipLink object that links to a page with information about the StudipItem object.
Implements StudipItem.
|
static |
Returns the appropriate link for the resource action that shall be executed on a resource.
string | $action | The action which shall be executed. For default Resources the actions 'show', 'add', 'edit' and 'delete' are defined. |
string | $id | The ID of the resource on which the specified action shall be executed. |
array | $link_parameters | Optional parameters for the link. |
InvalidArgumentException | If $resource_id is empty. |
getOpenResourceRequests | ( | DateTime | $begin, |
DateTime | $end | ||
) |
Get all resource requests for the resource in a given timeframe.
DateTime | $begin | Begin of timeframe. |
DateTime | $end | End of timeframe. |
getPictureUrl | ( | ) |
Returns the path for the resource's image. If the resource has no image the path for a general resource icon will be returned.
Classes derived from the Resource class should only re-implement this method if they have an alternative storage method for resource pictures than the Stud.IP file system.
getProperty | ( | string | $name | ) |
Returns the state of the property specified by $name. If the property has not been set for this resource, but is defined for this resource's category, a new ResourceProperty object will be created, stored and its state will be returned.
string | $name | The name of the resource property. |
getPropertyArray | ( | $only_requestable_properties = false | ) |
Returns all properties in a two-dimensional array with the following property data inside of the second dimension: [ 'name' => (the property's name) 'display_name' => (the display name of the property) 'type' => (the property's type) 'state' => (the property's state) 'requestable' => (if the property is requestable or not (true or false)) ]
bool | $only_requestable_properties | If only requestable properties shall be returned set this to true. If all properties shall be returned, set this to false. |
getPropertyObject | ( | string | $name | ) |
Retrieves a ResourceProperty object for a property of this resource which has the specified name. If the property has not been set for this resource, but is defined for this resource's category, a new ResourceProperty object will be created, stored and returned.
string | $name | The name of the resource property. |
InvalidResourceCategoryException | If this resource category doesn't match the category of the resource object. |
getPropertyRelatedObject | ( | string | $name | ) |
Retrieves an object by the state of a property of this resource, specified by the property's name. This method is useful for properties of type user, institute or fileref. Those properties store IDs of User, Institute or FileRef objects. Therefore the IDs can be resolved directly to get the corresponding User, Institute or FileRef object directly.
string | $name | The name of the resource property. |
|
static |
A method for overloaded classes so that they can define properties that are required for that resource class.
getRequiredPropertyNames | ( | ) |
Returns a list of property names that are required for the resource class.
getResourceBookings | ( | DateTime | $begin, |
DateTime | $end, | ||
array | $booking_types = [0] |
||
) |
Get all resource bookings for the resource in a given timeframe.
DateTime | $begin | Begin of timeframe. |
DateTime | $end | End of timeframe. |
array | $booking_types |
getResourceLocks | ( | DateTime | $begin, |
DateTime | $end | ||
) |
Get all resource locks for the resource in a given timeframe.
DateTime | $begin | Begin of timeframe. |
DateTime | $end | End of timeframe. |
|
static |
|
static |
Returns a translation of the resource class name. The translated name can be singular or plural, depending on the value of the parameter $item_count.
int | $item_count | The amount of items the translation shall be made for. This is only used to determine, if a singular or a plural form shall be returned. |
|
static |
Returns the appropriate URL for the resource action that shall be executed on a resource.
string | $action | The action which shall be executed. For default Resources the actions 'show', 'add', 'edit' and 'delete' are defined. |
string | $id | The ID of the resource on which the specified action shall be executed. |
array | $url_parameters | Optional parameters for the URL. |
InvalidArgumentException | If $resource_id is empty. |
Retrieves the permission level a specified user has on this resource.
Setting the optional $time_range parameter will also enable checks for temporary global permissions.
User | $user | The user whose permission shall be retrieved. |
array | $time_range | (DateTime) This is an optional parameter that can be used to pass two DateTime objects to this method. The first object will be treated as the begin timestamp and the second one as the end timestamp. |
bool | $permanent_only | Whether to retrieve only permanent permissions (true) or permanent and temporary permissions (false). Defaults to false. |
hasFiles | ( | ) |
Determines if files are attached to this resource. If a folder exists for this resource its files are counted. Depending on whether the folder has files in it or not this method returns true or false.
isAssigned | ( | DateTime | $begin, |
DateTime | $end, | ||
$excluded_booking_ids = [] |
|||
) |
Shortcut method for ResourceBooking::countByResourceAndTimeRanges. Determines whether normal resource bookings exist in the specified time range.
DateTime | $begin | Time range start timestamp. |
DateTime | $end | Time range end timestamp. |
array | $excluded_booking_ids | The IDs of bookings that shall be excluded from the determination of the "assigned" status. |
isAvailable | ( | DateTime | $begin, |
DateTime | $end, | ||
$excluded_booking_ids = [] |
|||
) |
Determines, if the resource is available (not assigned or locked) in a specified time range.
DateTime | $begin | Time range start timestamp. |
DateTime | $end | Time range end timestamp. |
array | $excluded_booking_ids | The IDs of available bookings that shall be excluded from the determination of the "available" status. |
isAvailableForRequest | ( | ResourceRequest | $request | ) |
Determines, if the resource is available (not assigned or locked) in the time ranges specified by a resource request.
ResourceRequest | $request | A resource request object. |
isLocked | ( | DateTime | $begin, |
DateTime | $end, | ||
$excluded_lock_ids = [] |
|||
) |
Shortcut method for ResourceBooking::countByResourceAndTimeRanges. Determines whether resource locks exist in the specified time range.
DateTime | $begin | Time range start timestamp. |
DateTime | $end | Time range end timestamp. |
array | $excluded_lock_ids | The IDs of lock bookings that shall be excluded from the determination of the "locked" status. |
isPropertyEditable | ( | string | $name, |
User | $user | ||
) |
Determines if the specified user has sufficient permissions to edit the property specified by its name.
string | $name | The name of the resource property. |
user | $user | The user whose edit permissions shall be checked. |
isReserved | ( | DateTime | $begin, |
DateTime | $end, | ||
$excluded_reservation_ids = [] |
|||
) |
Shortcut method for ResourceBooking::countByResourceAndTimeRanges. Determines whether resource reservations exist in the specified time range.
DateTime | $begin | Time range start timestamp. |
DateTime | $end | Time range end timestamp. |
array | $excluded_reservation_ids | The IDs of reservation bookings that shall be excluded from the determination of the "reserved" status. |
propertyExists | ( | $name = '' | ) |
Determines wheter this resource has a property with the specified name.
string | $name | The name of the resource property. |
setFolder | ( | ResourceFolder | $folder | ) |
setPropertiesById | ( | array | $properties, |
User | $user = null |
||
) |
Sets the properties (specified by their IDs) to the specified values.
array | $properties | The properties array in the format "key-value". The array keys must contain the property-ID while the items of the array contain the values. Example: ['1' => 'foo']: Sets the value 'foo' for the property with the ID '1'. |
User | null | $user | The user who wishes to set the properties. If this is left empty, the current user will be used. |
setPropertiesByName | ( | array | $properties, |
User | $user | ||
) |
Sets the properties (specified by their names) to the specified values.
array | $properties | The properties array in the format "key-value". The array keys must contain the property name while the items of the array contain the values. Example: ['bar' => 'foo']: Sets the value 'foo' for the property with the name 'bar'. |
User | null | $user | The user who wishes to set the properties. If this is left empty, the current user will be used. |
setProperty | ( | string | $name, |
$state = '' , |
|||
$user = null |
|||
) |
Sets a specified property of this resource to the specified state. If the property has not been set for this resource, but is defined for this resource's category, a new ResourceProperty object will be created, stored and its state will be returned.
string | $name | The name of the resource property. |
mixed | $state | The state of the resource property. |
User | null | $user | The user who wishes to set the property. |
setPropertyByDefinitionId | ( | $property_definition_id = null , |
|
$state = null |
|||
) |
Sets the state of a property by its definition_id rather than its name.
string | $property_definition_id | The definition-ID of the property. |
string | $state | The state of the property. |
ResourcePropertyStateException | If the provided state is invalid for the specified resource property. |
setPropertyRelatedObject | ( | string | $name, |
SimpleORMap | $object | ||
) |
Sets the property state by specifying an SimpleORMap object. This method is meant for resource properties of type user, institute or fileref.
string | $name | The name of the resource property. |
SimpleORMap | $object | The object for the resource property. |
setUserPermission | ( | User | $user, |
$perm = 'autor' |
|||
) |
Sets the permission for one user for this resource.
User | $user | The user whose permission shall be set. |
string | $perm | The permission level for the specified user. The levels 'user', 'autor', 'tutor' and 'admin' are allowed. |
store | ( | ) |
The SORM store method is overloaded to assure that the right level attribute is stored.
userHasBookingRights | ( | User | $user, |
$begin = null , |
|||
$end = null |
|||
) |
Determines whether the user may book the resource or not. An optional time range can be set to check the user's temporary permissions on another date than the current date.
User | $user | The user whose booking permissions shall be checked. |
int | string | DateTime | $begin | The begin timestamp of the optional time range. |
int | string | DateTime | $end | The end timestamp of the optional time range. |
userHasPermission | ( | ?User | $user, |
string | $permission = 'user' , |
||
array | $time_range = [] |
||
) |
Determines if a user has the specified permission.
?User | $user The user whose permissions shall be checked on this resource object. May be null. | |
string | $permission | The permission level. |
$time_range |
userHasRequestRights | ( | User | $user | ) |
Checks if the specified user has sufficient permissions to make resource requests, according to the setting RESOURCES_MIN_REQUEST_PERMISSION. This permission check is only relevant for creating requests that are not bound to a course.
User | $user | The user whose request permissions shall be checked. |
userMayCreateChild | ( | User | $user | ) |
Determines whether the user may create a child resource on this resource.
User | $user | The user whose permission to create a child resource shall be checked. |
|
staticprotected |
This is a cache for permissions that users have on resources. It is meant to reduce the database requests in cases where the same permission is queried a lot of times.