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

Public Member Functions

 cbValidate ()
 
 __toString ()
 
 createRequest (User $user, $date_range_id=null, $comment='', $properties=[], $preparation_time=0)
 
 addChild (Resource $resource)
 
 getFullName ()
 
 getDefaultPictureUrl ()
 
 getIcon ($role='info')
 
 checkHierarchy ()
 
 bookingPlanVisibleForUser (User $user, $time_range=[])
 
 getLink ($action='show', $link_parameters=[])
 
 getURL ($action='show', $url_parameters=[])
 
 findBuilding ()
 
- 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 ()
 

Static Public Member Functions

static getTranslatedClassName ($item_count=1)
 
static countAll ()
 
static findAll ()
 
static findByNameOrBuilding ($room, $building)
 
static getRequiredProperties ()
 
static findByBuilding ($building_id=null)
 
static findByRoomRequestAndProperties (RoomRequest $request, User $user, $offset=0, $limit=0, $searchable_rooms=[], $properties=[])
 
static findOtherRoomParts (Room $room)
 
static getAllRoomTypes ()
 
static getLinkForAction ( $action='show', $id=null, $link_parameters=[])
 
static getURLForAction ( $action='show', $id=null, $url_parameters=[])
 
- 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)
 

Static Protected Member Functions

static configure ($config=[])
 
static buildPathForAction ($action='show', $id=null)
 
static configure ($config=[])
 
static buildPathForAction ($action='show', $id=null)
 
- Static Protected Member Functions inherited from SimpleORMap
static configure ($config=array())
 
static config ($key)
 

Static Protected Attributes

static $required_properties
 
- 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')
 

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)
 
 registerCallback ($types, $cb)
 
 unregisterCallback ($types, $cb)
 
 cbAutoIncrementColumn ($type)
 
 cbAutoKeyCreation ()
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 
 cbI18N ($type)
 
- 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()
 

Detailed Description

The Room class is a derived class of the Resource class. It containts specialisations for room resources.

Member Function Documentation

◆ __toString()

__toString ( )

Reimplemented from Resource.

Here is the call graph for this function:

◆ addChild()

addChild ( Resource  $resource)

Adds a child resource to this room. The child resource must not be a resource of the class Room, Building or Location.

Parameters
Resource$resourceThe resource which shall be added as child.
Exceptions
InvalidResourceExceptionIf the specified resource belongs to the resource classes Room, Building or Location.
Returns
True, if the resource could be added as child, false otherwise.

Reimplemented from Resource.

◆ bookingPlanVisibleForUser()

bookingPlanVisibleForUser ( User  $user,
  $time_range = [] 
)
See also
Resource::bookingPlanVisibleForUser

Reimplemented from Resource.

◆ buildPathForAction()

static buildPathForAction (   $action = 'show',
  $id = null 
)
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.

Parameters
string$actionThe action for the room.
string$idThe ID of the room.
Exceptions
InvalidArgumentExceptionIf $room_id is empty.
Returns
string The URL path for the specified action.

Reimplemented from Resource.

◆ cbValidate()

cbValidate ( )

Reimplemented from Resource.

Here is the call graph for this function:

◆ checkHierarchy()

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.

Exceptions
NoResourceClassExceptionif the class name of this resource is not a derived class of the Resource class.
Returns
bool True, if this resource is correctly placed, false otherwise.

Reimplemented from Resource.

Here is the call graph for this function:

◆ configure()

static configure (   $config = [])
staticprotected

set configuration data from subclass

Parameters
array$configconfiguration data
Returns
void

Reimplemented from Resource.

◆ countAll()

static countAll ( )
static
Here is the call graph for this function:

◆ createRequest()

createRequest ( User  $user,
  $date_range_id = null,
  $comment = '',
  $properties = [],
  $preparation_time = 0 
)

This method calls Resource::createRequest and transforms the resulting ResourceRequest object into a RoomRequest object.

See also
Resource::createRequest for paramter descriptions and thrown exceptions.
Returns
RoomRequest A room request object.

Reimplemented from Resource.

Here is the call graph for this function:

◆ findAll()

static findAll ( )
static
Here is the caller graph for this function:

◆ findBuilding()

findBuilding ( )

Retrieves the building where this room resides in by looking up the parent resources of this Room.

Returns
Building|null A Building object if it can be found, null otherwise.
Here is the call graph for this function:

◆ findByBuilding()

static findByBuilding (   $building_id = null)
static

Finds rooms by a building specified by its ID.

Parameters
string$building_idThe ID of the building.
Returns
Room[] An array with rooms or an empty array.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findByNameOrBuilding()

static findByNameOrBuilding (   $room,
  $building 
)
static
Here is the caller graph for this function:

◆ findByRoomRequestAndProperties()

static findByRoomRequestAndProperties ( RoomRequest  $request,
User  $user,
  $offset = 0,
  $limit = 0,
  $searchable_rooms = [],
  $properties = [] 
)
static

Returns rooms that match the criteria of the room request.

Parameters
RoomRequest$requestA RoomRequest object.
User$userThe user who wishes to search for rooms matching the room request.
int$offsetAn offset for the result set.
int$limitA limit for the result set.
Room[]$searchable_roomsAn (optional) array of rooms which will limit the search to the rooms in the array.
Array$propertiesAn array providing request properties and their values in case the request doesn't have (the desired) properties set.
Returns
Room[] An array of room resources.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findOtherRoomParts()

static findOtherRoomParts ( Room  $room)
static

Determins if the specified room is a room part and then returns all other room parts.

Parameters
Room$roomThe room part whose other room parts shall be found.
Returns
Room[] An array of room objects or an empty array if no other room parts can be found.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllRoomTypes()

static getAllRoomTypes ( )
static

Retrieves all existing room types from the database. Only room types which have at least one room object with that type in the database are considered here.

Returns
string[] An array consisting of all room types which exist in the database.
Here is the call graph for this function:

◆ getDefaultPictureUrl()

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.

Returns
string The URL to the picture.

Reimplemented from Resource.

Here is the call graph for this function:

◆ getFullName()

getFullName ( )

Returns the full name of this room.

Returns
string The full name of this room.

Reimplemented from Resource.

Here is the caller graph for this function:

◆ getIcon()

getIcon (   $role = 'info')

Returns the Icon for the resource class.

Classes derived from Resource should re-implement this method if they want to get a different icon than the resource icon.

Returns
Icon The icon for the resource.

Reimplemented from Resource.

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

◆ getLink()

getLink (   $action = 'show',
  $link_parameters = [] 
)

Returns the link for an action for this room. This is the non-static variant of Room::getLinkForAction.

Parameters
string$actionThe action which shall be executed. For rooms the actions 'show', 'booking_plan', 'add', 'edit' and 'delete' are defined.
array$link_parametersOptional parameters for the link.

Reimplemented from Resource.

Here is the call graph for this function:

◆ getLinkForAction()

static getLinkForAction (   $action = 'show',
  $id = null,
  $link_parameters = [] 
)
static

Returns the appropriate link for the room action that shall be executed on a room.

Parameters
string$actionThe action which shall be executed. For rooms the actions 'show', 'booking_plan', 'add', 'edit' and 'delete' are defined.
string$idThe ID of the room on which the specified action shall be executed.
array$link_parametersOptional parameters for the link.
Exceptions
InvalidArgumentExceptionIf $room_id is empty.
Returns
string The Link for the room action.

Reimplemented from Resource.

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

◆ getRequiredProperties()

static getRequiredProperties ( )
static

A method for overloaded classes so that they can define properties that are required for that resource class.

Returns
string[] An array with the names of the required properties. Example: The properties with the names "foo", "bar" and "baz" are required properties. The array would have the following content: [ 'foo', 'bar', 'baz' ]

Reimplemented from Resource.

◆ getTranslatedClassName()

static getTranslatedClassName (   $item_count = 1)
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.

Parameters
int$item_countThe 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.
Returns
string The translated form of the class name, either in singular or plural.

Reimplemented from Resource.

◆ getURL()

getURL (   $action = 'show',
  $url_parameters = [] 
)

Returns the URL for an action for this room. This is the non-static variant of Room::getURLForAction.

Parameters
string$actionThe action which shall be executed. For rooms the actions 'show', 'booking_plan', 'add', 'edit' and 'delete' are defined.
array$url_parametersOptional parameters for the URL.

Reimplemented from Resource.

Here is the call graph for this function:

◆ getURLForAction()

static getURLForAction (   $action = 'show',
  $id = null,
  $url_parameters = [] 
)
static

Returns the appropriate URL for the room action that shall be executed on a room.

Parameters
string$actionThe action which shall be executed. For rooms the actions 'show', 'booking_plan', 'add', 'edit' and 'delete' are defined.
string$idThe ID of the room on which the specified action shall be executed.
array$url_parametersOptional parameters for the URL.
Exceptions
InvalidArgumentExceptionIf $room_id is empty.
Returns
string The URL for the room action.

Reimplemented from Resource.

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

Field Documentation

◆ $required_properties

$required_properties
staticprotected
Initial value:
= [
'room_type',
'seats',
'booking_plan_is_public'
]

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