Stud.IP  5.4
Room Class Reference
Inheritance diagram for Room:
Resource SimpleORMap StudipItem

Public Member Functions

 cbValidate ()
 
 cbDeleteClipboardItems ()
 
 getRequiredPropertyNames ()
 
 __toString ()
 
 createRequest (User $user, $date_range_id=null, $comment='', $properties=[], $preparation_time=0)
 
 addChild (Resource $resource)
 
 getFullName ()
 
 getDefaultPictureUrl ()
 
 getIcon ($role=Icon::ROLE_INFO)
 
 checkHierarchy ()
 
 bookingPlanVisibleForUser (?User $user, $time_range=[])
 
 getActionLink ($action='show', $link_parameters=[])
 
 getActionURL ($action='show', $url_parameters=[])
 
 findBuilding ()
 
- Public Member Functions inherited from Resource
 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)
 
 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 getTranslatedClassName ($item_count=1)
 
static countAll ()
 
static findAll ()
 
static findByNameOrBuilding ($room, $building)
 
static getRequiredProperties ()
 
static findByBuilding (string $building_id)
 
static findByRoomRequestAndProperties (RoomRequest $request, User $user, $offset=0, $limit=0, $searchable_rooms=[], $properties=[])
 
static findOtherRoomParts (Room $room)
 
static publicBookingPlansExists ()
 
static findByPublicBookingPlans ()
 
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 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 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 ($name, $arguments)
 

Static Protected Member Functions

static configure ($config=[])
 
static getPublicBookingPlansSql ()
 
static buildPathForAction ($action='show', $id=null)
 
- Static Protected Member Functions inherited from Resource
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 $required_properties
 
- Static Protected Attributes inherited from Resource
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 = []
 

Member Function Documentation

◆ __toString()

__toString ( )
See also
StudipItem::__toString

Implements StudipItem.

◆ 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.
Returns
bool True, if the resource could be added as child, false otherwise.
Exceptions
InvalidResourceExceptionIf the specified resource belongs to the resource classes Room, Building or Location.

◆ bookingPlanVisibleForUser()

bookingPlanVisibleForUser ( ?User  $user,
  $time_range = [] 
)

◆ 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.
Returns
string The URL path for the specified action.
Exceptions
InvalidArgumentExceptionIf $room_id is empty.

◆ cbDeleteClipboardItems()

cbDeleteClipboardItems ( )

◆ cbValidate()

cbValidate ( )

◆ checkHierarchy()

checkHierarchy ( )

◆ configure()

static configure (   $config = [])
staticprotected

◆ countAll()

static countAll ( )
static

◆ 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.

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

◆ findAll()

static findAll ( )
static

◆ 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.

◆ findByBuilding()

static findByBuilding ( string  $building_id)
static

Finds rooms by a building specified by its ID.

Parameters
string$building_idThe ID of the building.
Returns
array An array with rooms or an empty array.

◆ findByNameOrBuilding()

static findByNameOrBuilding (   $room,
  $building 
)
static

◆ findByPublicBookingPlans()

static findByPublicBookingPlans ( )
static

Retrieves all rooms that have a public booking plan, ordered by name and creation date.

Returns
array A list of rooms with public booking plans.

◆ 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_rooms An (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.

◆ 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.

◆ getActionLink()

getActionLink (   $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.
Returns
string

◆ getActionURL()

getActionURL (   $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.
Returns
string

◆ 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
array An array consisting of all room types which exist in the database.

◆ getDefaultPictureUrl()

getDefaultPictureUrl ( )

◆ getFullName()

getFullName ( )

Returns the full name of this room.

Returns
string The full name of this room.

◆ getIcon()

getIcon (   $role = Icon::ROLE_INFO)

◆ 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.
Returns
string The Link for the room action.
Exceptions
InvalidArgumentExceptionIf $room_id is empty.

◆ getPublicBookingPlansSql()

static getPublicBookingPlansSql ( )
staticprotected

Helper method to return the SQL code for publicBookingPlansExists, countByPublicBookingPlans and getByPublicBookingPlans.

◆ getRequiredProperties()

static getRequiredProperties ( )
static

◆ getRequiredPropertyNames()

getRequiredPropertyNames ( )

◆ getTranslatedClassName()

static getTranslatedClassName (   $item_count = 1)
static

◆ 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.
Returns
string The URL for the room action.
Exceptions
InvalidArgumentExceptionIf $room_id is empty.

◆ publicBookingPlansExists()

static publicBookingPlansExists ( )
static

Checks whether rooms with public booking plans exist.

Returns
bool True, if at least one room has a public booking plan, false otherwise.

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: