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

Public Member Functions

 store ()
 
 cbLogNewRequest ()
 
 validate ()
 
 getDerivedClassInstance ()
 
 setRangeFields ($range_type='', $range_ids=[])
 
 closeRequest ($notify_lecturers=false, $bookings=[])
 
 getOverlappingRequests ()
 
 countOverlappingRequests ()
 
 getOverlappingBookings ()
 
 countOverlappingBookings ()
 
 getRepetitionInterval ()
 
 getStartDate ()
 
 getEndDate ()
 
 getStartSemester ()
 
 getEndSemester ()
 
 getRepetitionEndDate ()
 
 getGroupedTimeIntervals ( $with_preparation_time=false)
 
 getTimeIntervals ( $with_preparation_time=false, $with_range=false)
 
 getTimeIntervalStrings ()
 
 getTimeIntervalsInTimeRange (DateTime $begin, DateTime $end)
 
 getType ()
 
 getStatus ()
 
 getStatusText ()
 
 getDateString ()
 
 getTypeString ($short=false)
 
 getAffectedDates ()
 
 getAvailableProperties ($excluded_property_names=[])
 
 getPropertyData ($excluded_property_names=[])
 
 propertyExists ($name)
 
 getProperty ($name)
 
 getPropertyObject ($name)
 
 setProperty ($name='', $state='')
 
 updateProperties ( $property_list=[], $accept_null_values=false)
 
 deletePropertyIfExists ($name='')
 
 getRangeName ()
 
 isSimpleRequest ()
 
 getRangeId ()
 
 getRangeType ()
 
 getRangeObject ()
 
 sendNewRequestMail ()
 
 sendCloseRequestMailToRequester ($bookings=[])
 
 sendCloseRequestMailToLecturers ($bookings=[])
 
 sendRequestDeniedMail ()
 
 isReadOnlyForUser (User $user)
 
 getAllEventData ()
 
 getEventDataForTimeRange (DateTime $begin, DateTime $end)
 
 getFilteredEventData ( $user_id=null, $range_id=null, $range_type=null, $begin=null, $end=null)
 
 getPriority ()
 
- 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 ()
 
- Public Member Functions inherited from EventSource
 getAllEventData ()
 
 getEventDataForTimeRange (\DateTime $begin, \DateTime $end)
 
 getFilteredEventData ( $user_id=null, $range_id=null, $range_type=null, $begin=null, $end=null)
 

Static Public Member Functions

static findAll ()
 
static findOpen ()
 
static findByResourceAndTimeRanges (Resource $resource, $time_ranges=[], $closed_status=null, $excluded_request_ids=[], $additional_conditions='', $additional_parameters=[])
 
static countByResourceAndTimeRanges (Resource $resource, $time_ranges=[], $closed_status=null, $excluded_request_ids=[], $additional_conditions='', $additional_parameters=[])
 
static findByCourse ($course_id=null)
 
static findByDate ($date_id=null)
 
static findByMetadate ($metadate_id=null)
 
static existsByCourse ( $course_id=null, $request_is_open=false)
 
static existsByDate ( $date_id=null, $request_is_open=false)
 
static existsByMetadate ( $metadate_id=null, $request_is_open=false)
 
static exportUserdata (StoredUserData $user_data)
 
- 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)
 
- Static Public Member Functions inherited from PrivacyObject
static exportUserData (StoredUserData $storage)
 

Protected Member Functions

 convertToEventData ($time_intervals=[], User $user)
 
- 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

static configure ($config=[])
 
static buildResourceAndTimeRangesSqlQuery (Resource $resource, $time_ranges=[], $closed_status=null, $excluded_request_ids=[], $additional_conditions='', $additional_parameters=[])
 
- Static Protected Member Functions inherited from SimpleORMap
static configure ($config=array())
 
static config ($key)
 

Additional Inherited Members

- Data Fields inherited from SimpleORMap
const ID_SEPARATOR = '_'
 
- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 
- 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 SimpleORMap
static $config = array()
 
static $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id')
 

Member Function Documentation

◆ buildResourceAndTimeRangesSqlQuery()

static buildResourceAndTimeRangesSqlQuery ( Resource  $resource,
  $time_ranges = [],
  $closed_status = null,
  $excluded_request_ids = [],
  $additional_conditions = '',
  $additional_parameters = [] 
)
staticprotected

Internal method that generated the SQL query used in findByResourceAndTimeRanges and countByResourceAndTimeRanges.

See also
findByResourceAndTimeRanges
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbLogNewRequest()

cbLogNewRequest ( )

A callback method that creates a Stud.IP log entry when a new request has been made.

Here is the call graph for this function:

◆ closeRequest()

closeRequest (   $notify_lecturers = false,
  $bookings = [] 
)

Closes the requests and sends out notification mails. If the request is closed and a resource has been booked, it can be passed as parameter to be included in the notification mails.

Parameters
bool$notify_lecturersWhether to notify lecturers of a course (true) or not (false). Defaults to false. Note that this parameter is only useful in case the request is bound to a course, either directly or via a course date or a course cycle date.
ResourceBooking$bookingsThe resource bookings that have been created from this request.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure()

static configure (   $config = [])
staticprotected

set configuration data from subclass

Parameters
array$configconfiguration data
Returns
void

Reimplemented from SimpleORMap.

Reimplemented in RoomRequest.

◆ convertToEventData()

convertToEventData (   $time_intervals = [],
User  $user 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ countByResourceAndTimeRanges()

static countByResourceAndTimeRanges ( Resource  $resource,
  $time_ranges = [],
  $closed_status = null,
  $excluded_request_ids = [],
  $additional_conditions = '',
  $additional_parameters = [] 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ countOverlappingBookings()

countOverlappingBookings ( )

Counts the resource bookings whose time ranges overlap with those of this resource request.

Returns
int The amount of overlapping resource bookings.
Here is the call graph for this function:

◆ countOverlappingRequests()

countOverlappingRequests ( )

Counts the resource requests whose time ranges overlap with those of this resource request.

Returns
int The amount of overlapping resource requests.
Here is the call graph for this function:

◆ deletePropertyIfExists()

deletePropertyIfExists (   $name = '')
Here is the call graph for this function:

◆ existsByCourse()

static existsByCourse (   $course_id = null,
  $request_is_open = false 
)
static
Here is the caller graph for this function:

◆ existsByDate()

static existsByDate (   $date_id = null,
  $request_is_open = false 
)
static
Here is the caller graph for this function:

◆ existsByMetadate()

static existsByMetadate (   $metadate_id = null,
  $request_is_open = false 
)
static
Here is the caller graph for this function:

◆ exportUserdata()

static exportUserdata ( StoredUserData  $user_data)
static
Here is the call graph for this function:

◆ findAll()

static findAll ( )
static

Retrieves all resource requests from the database.

Returns
ResourceRequest[] An array of ResourceRequests objects or an empty array, if no resource requests are stored in the database.

◆ findByCourse()

static findByCourse (   $course_id = null)
static

◆ findByDate()

static findByDate (   $date_id = null)
static
Here is the caller graph for this function:

◆ findByMetadate()

static findByMetadate (   $metadate_id = null)
static

◆ findByResourceAndTimeRanges()

static findByResourceAndTimeRanges ( Resource  $resource,
  $time_ranges = [],
  $closed_status = null,
  $excluded_request_ids = [],
  $additional_conditions = '',
  $additional_parameters = [] 
)
static

Retrieves all resource requests for the given resource and time range. By default, all requests are returned. To get only open or closed requests set the $closed_status parameter.

Parameters
Resource$resourceThe resource whose requests shall be retrieved.
Array$time_rangesAn array with time ranges as DateTime objects. The array has the following structure: [ [ 'begin' => begin timestamp, 'end' => end timestamp ], ... ]
$closed_statusAn optional status for the closed column in the database. By default this is set to null which means that resource requests are not filtered by the status column field. A value of 0 means only open requests are retrived. A value of 1 means only closed requests are retrieved.
Array$excluded_request_idsAn array of strings representing resource request IDs. IDs specified in this array are excluded from the search.
Returns
SimpleORMapCollection A SimpleORMapCollection of ResourceRequest objects. If no requests can be found the collection is empty.
Exceptions
InvalidArgumentException,ifthe time ranges are either not in an array matching the format description from above or if one of the following conditions is met in one of the time ranges:
  • begin > end
  • begin == end
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findOpen()

static findOpen ( )
static

Retrieves all open resource requests from the database.

Returns
ResourceRequest[] An array of ResourceRequests objects or an empty array, if no open resource requests are stored in the database.

◆ getAffectedDates()

getAffectedDates ( )

Returns an array of date objects which are affected by this ResourceRequest.

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

◆ getAllEventData()

getAllEventData ( )

Returns all event data this event source can provide.

Returns
EventData[] An array of Studip\Calendar\EventData objects.

Implements EventSource.

Here is the call graph for this function:

◆ getAvailableProperties()

getAvailableProperties (   $excluded_property_names = [])

Returns all resource property definitions for all properties which can be applied for this ResourceRequest by looking at the Resource category. If no resource category ID is set for the request an empty array is returned.

Here is the call graph for this function:

◆ getDateString()

getDateString ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDerivedClassInstance()

getDerivedClassInstance ( )
Here is the call graph for this function:

◆ getEndDate()

getEndDate ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEndSemester()

getEndSemester ( )
Here is the call graph for this function:

◆ getEventDataForTimeRange()

getEventDataForTimeRange ( DateTime  $begin,
DateTime  $end 
)
Here is the call graph for this function:

◆ getFilteredEventData()

getFilteredEventData (   $user_id = null,
  $range_id = null,
  $range_type = null,
  $begin = null,
  $end = null 
)

Allows a filtered output of event data based on a specified user, a specified range-ID and range type (must be supported by the Context class) or a specified time range. If no filters are applied the result should be the same as if the getAllEventData method from this interface is called.

Parameters
string$user_idThe user for whom the event data shall be retrieved. Depending on the implementation, this parameter might be necessary to check permissions for event objects.
string$range_idAn optional range-ID that may be necessary for an implementation to check for permissions.
string$range_typeAn optional range type that may be necessary for an implementation to check for permissions.
DateTime | int | string$beginThe begin date as DateTime object or unix timestamp.
DateTime | int | string$endThe end date as DateTime object or unix timestamp.
Returns
EventData[] An array of Studip\Calendar\EventData objects.

Implements EventSource.

Here is the call graph for this function:

◆ getGroupedTimeIntervals()

getGroupedTimeIntervals (   $with_preparation_time = false)

Retrieves the time intervals by looking at metadate objects and other time interval sources and returns them grouped by metadate.

Returns
mixed[][][] A three-dimensional array with the following structure:
  • The first dimension has the metadate-id as index. For single dates an empty string is used as index.
  • The second dimension contains two elements:
    • 'metadate' => The metadate object. This is only set, if the request is for a metadate.
    • 'intervals' => The time intervals.
  • The third dimension contains a time interval in the following format: [ 'begin' => The begin timestamp 'end' => The end timestamp 'range' => The name of the range class that provides the range_id. This is usually the name of the SORM class. 'range_id' => The ID of the single date or ResourceRequestAppointment. ]
Here is the call graph for this function:

◆ getOverlappingBookings()

getOverlappingBookings ( )

Returns the resource bookings whose time ranges overlap with those of this resource request.

Returns
ResourceBooking[] An array of ResourceBooking objects.
Here is the call graph for this function:

◆ getOverlappingRequests()

getOverlappingRequests ( )

Returns the resource requests whose time ranges overlap with those of this resource request.

Returns
ResourceRequest[] An array of ResourceRequest objects.
Here is the call graph for this function:

◆ getPriority()

getPriority ( )
Here is the call graph for this function:

◆ getProperty()

getProperty (   $name)

Returns the state of the property specified by $name.

Here is the call graph for this function:

◆ getPropertyData()

getPropertyData (   $excluded_property_names = [])

Returns a "compressed" array of resource request properties.

Returns
Array An associative array where the keys represent the property names and the values represent the property states. Note that the value can be an array in case of range properties.
Here is the caller graph for this function:

◆ getPropertyObject()

getPropertyObject (   $name)
Exceptions
InvalidResourceCategoryExceptionIf this resource category doesn't match the category of the resource request object.
ResourcePropertyExceptionIf the name of the resource request property is not defined for this resource category.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRangeId()

getRangeId ( )

◆ getRangeName()

getRangeName ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRangeObject()

getRangeObject ( )
Here is the caller graph for this function:

◆ getRangeType()

getRangeType ( )
Here is the caller graph for this function:

◆ getRepetitionEndDate()

getRepetitionEndDate ( )
Here is the call graph for this function:

◆ getRepetitionInterval()

getRepetitionInterval ( )

Returns the repetion interval if regular appointments are used for this request.

Returns
DateInterval|null In case regular appointments are used for this request a DateInterval is returned. Otherwise null is returned.
Here is the caller graph for this function:

◆ getStartDate()

getStartDate ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStartSemester()

getStartSemester ( )
Here is the call graph for this function:

◆ getStatus()

getStatus ( )

Returns a string representation of the status of the ResourceRequest.

◆ getStatusText()

getStatusText ( )

Returns a textual representation of the status of the ResourceRequest.

Here is the call graph for this function:

◆ getTimeIntervals()

getTimeIntervals (   $with_preparation_time = false,
  $with_range = false 
)

Retrieves the time intervals for this request.

Parameters
bool$with_preparation_timeWhether the preparation time of the request shall be prepended to the begin timestamp (true) or whether it should not be included at all (false). Defaults to false.
bool$with_rangeWhether to include data of the Stud.IP range and its corresponding ID to the request (true) or not (false). Defaults to false.
Returns
string[][] A two-dimensional array of unix timestamps. The first dimension contains one entry for each date, the second dimension contains the start and end timestamp for the date. The second dimension uses the array keys 'begin' and 'end' for start and end date. If the @with_range parameter is set to true, the second array dimension also contains the key 'range' for specifying the range type and 'range_id' for specifying the ID of the range object. The range can be "CourseDate", "ResourceRequestAppointment" or "User". The last two can only be present for simple requests that are not bound to a course. The range "CourseDate" can only occur on course-bound requests.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTimeIntervalsInTimeRange()

getTimeIntervalsInTimeRange ( DateTime  $begin,
DateTime  $end 
)

Filters the time intervals for this request by a specified time range.

See also
ResourceRequest::getTimeIntervals for the return format.
Here is the call graph for this function:

◆ getTimeIntervalStrings()

getTimeIntervalStrings ( )

Returns a string representation of the time intervals for this request.

Here is the call graph for this function:

◆ getType()

getType ( )

Returns a string representation of the ResourceRequest's type.

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

◆ getTypeString()

getTypeString (   $short = false)

Returns a human-readable string describing the type of the request.

Parameters
bool$shortIf this parameter is set to true, only the type of the request is returned without any information about the appointments. Otherwise, appointment information like the date or the repetition are appended. Defaults to false.
Here is the call graph for this function:

◆ isReadOnlyForUser()

isReadOnlyForUser ( User  $user)

◆ isSimpleRequest()

isSimpleRequest ( )

◆ propertyExists()

propertyExists (   $name)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCloseRequestMailToLecturers()

sendCloseRequestMailToLecturers (   $bookings = [])

This method sends mails to the lecurers of the course (if any) where this request has been assigned to. The sent mail informs them about the closing of the request.

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

◆ sendCloseRequestMailToRequester()

sendCloseRequestMailToRequester (   $bookings = [])

This method sends a mail to inform the requester that the request has been closed.

Here is the caller graph for this function:

◆ sendNewRequestMail()

sendNewRequestMail ( )

This method sends a notification mail to all room administrators that informs them of this new request.

Here is the caller graph for this function:

◆ sendRequestDeniedMail()

sendRequestDeniedMail ( )

This method sends a mail to inform the requester about the denial of the request.

Here is the caller graph for this function:

◆ setProperty()

setProperty (   $name = '',
  $state = '' 
)
Returns
True, if the property state could be set, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRangeFields()

setRangeFields (   $range_type = '',
  $range_ids = [] 
)

Sets the range fields (termin_id, metadate_id, course_id) or the ResourceRequestAppointment objects related to this request according to the range type and its range-IDs specified as parameters for this method. The ResourceRequest object is not stored after setting the fields / related objects.

Parameters
string$range_typeThe range type for this request. One of the following: 'date', 'cycle', 'course' or 'date-multiple'.
Array$range_idsAn array of range-IDs to be set for the specified range type. This is mostly an array of size one since the fields termin_id, metadate_id and course_id only accept one ID. The range type 'date-multiple' accepts multiple IDs.
Returns
void No return value.

◆ store()

store ( )

store entry in database

Exceptions
UnexpectedValueExceptionif there are forbidden NULL values
Returns
number|boolean

Reimplemented from SimpleORMap.

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

◆ updateProperties()

updateProperties (   $property_list = [],
  $accept_null_values = false 
)

Sets or unsets the properties for this resource request.

Parameters
Array$property_listThe properties which shall be set or unset. The array has the following structure: [ property_name => property_value ]
bool$accept_null_valuesTrue, if a value of null shall be used when setting the property. If $accept_null_values is set to false all properties with a value equal to null will be deleted.
Returns
null
Here is the call graph for this function:

◆ validate()

validate ( )

This validation method is called before storing an object.


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