|
Stud.IP
jlu_4.3 Revision 64286
|


Public Member Functions | |
| getFolder () | |
| setFolder (ResourceFolder $folder) | |
| createFolder () | |
| createSimpleBooking (User $user, DateTime $begin, DateTime $end, $preparation_time=0, $description='', $internal_comment='', $booking_type=0) | |
| createBookingFromRequest (User $user, ResourceRequest $request, $preparation_time=0, $description='', $internal_comment='', $booking_type=0, $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=0, $force_booking=false) | |
| 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='') | |
| propertyExists ($name='') | |
| getPropertyObject ($name='') | |
| getProperty ($name='') | |
| getPropertyRelatedObject ($name='') | |
| setProperty ($name='', $state='', $user_id=null) | |
| isPropertyEditable ($name='', User $user) | |
| setPropertyByDefinitionId ( $property_definition_id=null, $state=null) | |
| setPropertyRelatedObject ($name='', $object=null) | |
| getIcon ($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 () | |
| getOpenResourceRequests (DateTime $begin, DateTime $end) | |
| getResourceBookings (DateTime $begin, DateTime $end) | |
| getResourceLocks (DateTime $begin, DateTime $end) | |
| hasFiles () | |
| checkHierarchy () | |
| getItemAvatarURL () | |
Public Member Functions inherited from Resource | |
| store () | |
| delete () | |
| cbValidate () | |
| __toString () | |
| getFolder () | |
| setFolder (ResourceFolder $folder) | |
| createFolder () | |
| createSimpleBooking (User $user, DateTime $begin, DateTime $end, $preparation_time=0, $description='', $internal_comment='', $booking_type=0) | |
| createBookingFromRequest (User $user, ResourceRequest $request, $preparation_time=0, $description='', $internal_comment='', $booking_type=0, $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=0, $force_booking=false) | |
| 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 ($name='') | |
| getProperty ($name='') | |
| getPropertyRelatedObject ($name='') | |
| setProperty ($name='', $state='', $user=null) | |
| setPropertiesByName ($properties=[], $user) | |
| setPropertiesById ($properties=[], $user=null) | |
| isPropertyEditable ($name='', User $user) | |
| setPropertyByDefinitionId ( $property_definition_id=null, $state=null) | |
| setPropertyRelatedObject ($name='', $object=null) | |
| deleteProperty ($name='', User $user) | |
| getPictureUrl () | |
| getDefaultPictureUrl () | |
| getIcon ($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, $permission='user', $time_range=[], $permanent_only=false) | |
| userMayCreateChild (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) | |
| getResourceLocks (DateTime $begin, DateTime $end) | |
| hasFiles () | |
| getDerivedClassInstance () | |
| checkHierarchy () | |
| getHierarchyPath ($separator='/', $prepend_root=true) | |
| getLink ($action='show', $link_parameters=[]) | |
| getURL ($action='show', $url_parameters=[]) | |
| getItemName ($long_format=true) | |
| getItemURL () | |
| getItemAvatarURL () | |
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) | |
| 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 () | |
| getItemName ($long_format=true) | |
| getItemURL () | |
| getItemAvatarURL () | |
Additional Inherited Members | |
Static Public Member Functions inherited from Resource | |
| 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 | find ($id) |
| static | exists ($id) |
| static | countBySql ($sql=1, $params=array()) |
| static | create ($data) |
| static | build ($data, $is_new=true) |
| static | buildExisting ($data) |
| static | import ($data) |
| static | findBySQL ($sql, $params=array()) |
| static | findOneBySQL ($where, $params=array()) |
| static | findThru ($foreign_key_value, $options) |
| static | findEachBySQL ($callable, $sql, $params=array()) |
| static | findMany ($pks=array(), $order='', $order_params=array()) |
| static | findEachMany ($callable, $pks=array(), $order='', $order_params=array()) |
| static | findAndMapBySQL ($callable, $where, $params=array()) |
| static | findAndMapMany ($callable, $pks=array(), $order='', $order_params=array()) |
| static | deleteBySQL ($where, $params=array()) |
| static | toObject ($id_or_object) |
| static | __callStatic ($name, $arguments) |
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) | |
| registerCallback ($types, $cb) | |
| unregisterCallback ($types, $cb) | |
| cbAutoIncrementColumn ($type) | |
| cbAutoKeyCreation () | |
| cbNotificationMapper ($cb_type) | |
| cbAfterInitialize ($cb_type) | |
| setSerializedValue ($field, $value) | |
| setI18nValue ($field, $value) | |
| cbI18N ($type) | |
Static Protected Member Functions inherited from Resource | |
| static | configure ($config=[]) |
| static | buildPathForAction ($action='show', $id=null) |
Static Protected Member Functions inherited from SimpleORMap | |
| static | configure ($config=array()) |
| static | config ($key) |
Protected Attributes inherited from SimpleORMap | |
| $content = array() | |
| $content_db = array() | |
| $is_new = true | |
| $is_deleted = false | |
| $db_table = '' | |
| $db_fields = null | |
| $pk = null | |
| $default_values = array() | |
| $serialized_fields = array() | |
| $alias_fields = array() | |
| $i18n_fields = array() | |
| $additional_fields = array() | |
| $relations = array() | |
| $has_many = array() | |
| $has_one = array() | |
| $belongs_to = array() | |
| $has_and_belongs_to_many = array() | |
| $registered_callbacks = array() | |
| $known_slots = array() | |
| $notification_map = array() | |
| $additional_data = array() | |
| $getter_setter_map = array() | |
Static Protected Attributes inherited from Resource | |
| static | $permission_cache |
Static Protected Attributes inherited from SimpleORMap | |
| static | $config = array() |
| static | $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id') |
The ResourceLabel class represents headings or subheadings whose only purpose is helping with organising the resource tree. ResourceLabel instances must not be booked, reserved or locked. Furthermore, they cannot be requested.
| 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. |
Reimplemented from Resource.
| 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 = 0, |
|||
$force_booking = false |
|||
| ) |
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 | $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. |
| 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. |
Reimplemented from Resource.
| createBookingFromRequest | ( | User | $user, |
| ResourceRequest | $request, | ||
$preparation_time = 0, |
|||
$description = '', |
|||
$internal_comment = '', |
|||
$booking_type = 0, |
|||
$prepend_preparation_time = false, |
|||
$notify_lecturers = false |
|||
| ) |
Creates bookings from a request.
| ResourceRequest | $request | The request from which a resource booking shall be built. |
| 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. |
| ResourceUnavailableException | if the resource cannot be assigned in at least one of the time ranges specified by the resource request. |
| ResourceRequestException | if the request could not be marked as resolved. |
Reimplemented from Resource.
| createFolder | ( | ) |
Reimplemented from Resource.
| 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. |
| AccessDeniedException | If the user does not have sufficient permissions to lock this resource. |
| ResourceUnavailableException | If a lock booking already exists in the specified time range. |
Reimplemented from 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. |
Reimplemented from Resource.
| createSimpleBooking | ( | User | $user, |
| DateTime | $begin, | ||
| DateTime | $end, | ||
$preparation_time = 0, |
|||
$description = '', |
|||
$internal_comment = '', |
|||
$booking_type = 0 |
|||
| ) |
This is a simplified version of the createBooking method.
Reimplemented from Resource.
| 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. |
Reimplemented from Resource.
| getFolder | ( | ) |
Reimplemented from Resource.
| getFullName | ( | ) |
Returns the full (localised) name of the resource.
Reimplemented from Resource.
| getIcon | ( | $role = 'info' | ) |
| getItemAvatarURL | ( | ) |
Returns the URL to the avatar image or icon of the object, if applicable.
Reimplemented from Resource.

| 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. |
Reimplemented from Resource.
| getProperty | ( | $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. |
Reimplemented from Resource.
| 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. |
Reimplemented from Resource.
| getPropertyObject | ( | $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. |
Reimplemented from Resource.
| getPropertyRelatedObject | ( | $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. |
Reimplemented from Resource.
| getResourceBookings | ( | DateTime | $begin, |
| DateTime | $end | ||
| ) |
Get all resource bookings for the resource in a given timeframe.
| DateTime | $begin | Begin of timeframe. |
| DateTime | $end | End of timeframe. |
Reimplemented from Resource.
| 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. |
Reimplemented from Resource.
| 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.
Reimplemented from Resource.
| 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. |
| $excluded_lock_ids | The IDs of bookings that shall be excluded from the determination of the "assigned" status. |
Reimplemented from Resource.
| 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. |
| $excluded_booking_ids | The IDs of available bookings that shall be excluded from the determination of the "available" status. |
Reimplemented from Resource.
| 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. |
Reimplemented from Resource.
| 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. |
| $excluded_lock_ids | The IDs of lock bookings that shall be excluded from the determination of the "locked" status. |
Reimplemented from Resource.
| isPropertyEditable | ( | $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. |
Reimplemented from Resource.
| 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. |
| $excluded_lock_ids | The IDs of reservation bookings that shall be excluded from the determination of the "reserved" status. |
Reimplemented from Resource.
| propertyExists | ( | $name = '' | ) |
Determines wheter this resource has a property with the specified name.
| string | $name | The name of the resource property. |
Reimplemented from Resource.
| setFolder | ( | ResourceFolder | $folder | ) |
Reimplemented from Resource.
| setProperty | ( | $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 | $userd | The user who wishes to set the property. |
Reimplemented from Resource.
| 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. |
Reimplemented from Resource.
| setPropertyRelatedObject | ( | $name = '', |
|
$object = null |
|||
| ) |
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. |
Reimplemented from Resource.