Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
SingleCalendar Class Reference

Public Member Functions

 __construct ($range_id, $start=null, $end=null)
 
 getEvents ($class_names=null, $start=null, $end=null)
 
 storeEvent (CalendarEvent $event, $attendee_ids=[])
 
 setStart ($start)
 
 getStart ()
 
 setEnd ($end)
 
 getEnd ()
 
 getEvent ($event_id=null, $class_names=null)
 
 getNewEvent ()
 
 sortEvents ()
 
 getId ()
 
 getRangeId ()
 
 getRange ()
 
 getRangeObject ()
 
 getPermissionByUser ($user_id=null)
 
 havePermission ($permission, $user_id=null)
 
 checkPermission ($permission, $user_id=null)
 
 deleteEvent ($calendar_event, $all=false)
 
 getListCountEvents ($class_names=null, $user_id=null, $restrictions=null)
 
 createEventMatrix ($start, $end, $step)
 
 adapt_events ($start, $end, $step=900)
 

Static Public Member Functions

static getEventList ($owner_id, $start, $end, $user_id=null, $restrictions=null, $class_names=null)
 
static getDayCalendar ($owner, $time, $user_id=null, $restrictions=null, $class_names=null)
 
static checkRestriction (Event $event, $restrictions)
 

Data Fields

 $events
 
 $range_object
 
 $type
 
 $range
 
 $start
 
 $end
 
 $ts
 

Protected Member Functions

 sendStoreMessage ($event, $is_new, $recipient_ids=null)
 
 deleteEventWithConsultation (CalendarEvent $event)
 
 sendDeleteMessage ($event, $recipient_ids=null)
 

Constructor & Destructor Documentation

__construct (   $range_id,
  $start = null,
  $end = null 
)

Member Function Documentation

adapt_events (   $start,
  $end,
  $step = 900 
)

Returns array with events and other information to build calendar tables for day view.

Parameters
int$startStart time date as unix timestamp
int$endEnd time date as unix timestamp
int$stepSeconds between each row in calendar table.
Returns
Array Array with new calculated events and some other things.
checkPermission (   $permission,
  $user_id = null 
)

Returns whether the given user has the $permission to this calendar. It checks for the actual user if $user_id is null.

Parameters
int$permissionAn accepted calendar permission.
string | null$user_idThe id of the user.
Returns
bool True if the user has the given permission.
static checkRestriction ( Event  $event,
  $restrictions 
)
static

TODO use filter instead

Parameters
Event$event
array$restrictions
Returns
boolean
createEventMatrix (   $start,
  $end,
  $step 
)

Returns an array with all necessary informations to build the day view.

Parameters
type$start
type$end
type$step
type$params
Returns
type
deleteEvent (   $calendar_event,
  $all = false 
)

Deletes an event from this calendar.

Parameters
string | object$calendar_eventThe id of an event or an event object of type CalendarEvent.
boolean$allIf true all events of a group event will be deleted.
Returns
boolean|int The number of deleted events. False if the event was not deleted.
deleteEventWithConsultation ( CalendarEvent  $event)
protected

Deletes a calendar event with regard of the consultation component. Depending whether a CalenderEvent instance is related to a consultation booking or not, the deletion has to be done differently.

Parameters
CalendarEvent$event
Returns
bool True on success, false on failure.
static getDayCalendar (   $owner,
  $time,
  $user_id = null,
  $restrictions = null,
  $class_names = null 
)
static

Returns a SingleCalendar object with all events of the given owner or SingleCalendar object for one day set by timestamp.

Parameters
string | SingleCalendar$ownerThe user id of calendar owner or a calendar object.
int$timeA unix timestamp of this day.
string$user_idThe id of the user who gets access to the calendar (optional, default current user)
array$restrictionsAn array with key value pairs of properties to filter the result (optional).
array$class_namesArray of class names. The class must implement Event (optional).
Returns
Calendar Object with all events of given day.
getEnd ( )

Returns the end date time of this calendar as a unix timestamp.

Returns
int Unix timestamp.
getEvent (   $event_id = null,
  $class_names = null 
)

Returns a event by given $event_id. Returns a new event of type CalendarEvent with default data if the id is null or unknown. If $class_names is set, only these types of Object will be returned.

Parameters
string$event_id
array$class_namesNames of classes which inherits Event.
Returns
Event|null The found event, a new CalendarEvent or null if no event other than a CalendarEvent was found.
static getEventList (   $owner_id,
  $start,
  $end,
  $user_id = null,
  $restrictions = null,
  $class_names = null 
)
static

Returns an array of all events (with calculated recurrences) in the given time range.

Parameters
string$owner_idThe user id of calendar owner.
int$timeA unix timestamp of this day.
string$user_idThe id of the user who gets access to the calendar (optional, default current user)
array$restrictionsAn array with key value pairs of properties to filter the result (optional).
array$class_namesArray of class names. The class must implement Event (optional).
Returns
array All events in the given time range (with calculated recurrences)
getEvents (   $class_names = null,
  $start = null,
  $end = null 
)

Returns all events of given class names between start and end. Returns events of all types if no class names are given.

Parameters
array | null$class_namesThe names of classes that implements Event.
int$startThe start date time.
int$endThe end date time.
Returns
This calendar object.
Exceptions
InvalidArgumentException
getListCountEvents (   $class_names = null,
  $user_id = null,
  $restrictions = null 
)

Returns an array with all days between start and end of this SingleCalendar. The keys are the timestamps of the days (12:00) and the values are number of events for a day.

Parameters
string$user_idUse the permissions of this user.
array$restrictions
Returns
array An array with year day as key and number of events per day as value.
getNewEvent ( )

Creates a new event, sets some default data and returns it.

Returns
The new event.
getPermissionByUser (   $user_id = null)

Returns the permission of the given user for this calendar.

Parameters
string$user_idUser id.
Returns
int The calendar permission.
getRange ( )

Returns the object range of this calendar.

Returns
int The object range.
getRangeId ( )

Returns the range id of this calendar. Possible range id are for objects of type user, inst, fak, group.

Returns
string The range id.
getRangeObject ( )

Returns the range object (user, course, institute) of this calendar.

Returns
int The object range.
getStart ( )

Returns the start date time of this calendar as a unix timestamp.

Returns
int Unix timestamp.
havePermission (   $permission,
  $user_id = null 
)

Returns whether the given user has at least the $permission to this calendar. It checks for the actual user if $user_id is null.

Parameters
int$permissionAn accepted calendar permission.
string | null$user_idThe id of the user.
Returns
bool True if the user has at least the given permission.
sendDeleteMessage (   $event,
  $recipient_ids = null 
)
protected

Sends a message to the owner of the calendar that this event was deleted by another user.

Parameters
CalendarEvent$eventThe deleted event.
null|arrayArray with user_ids of the recipients. If not set the owner of the given event is used as recipient.
sendStoreMessage (   $event,
  $is_new,
  $recipient_ids = null 
)
protected

Sends a message to the owner of the calendar that a new event was inserted or an old event was modified by another user.

Parameters
CalendarEvent$eventThe new or updated event.
bool$is_newTrue if the event is new.
null|arrayArray with user_ids of the recipients. If not set the owner of the given event is used as recipient.
setEnd (   $end)

Sets the end date time by given unix timestamp.

Parameters
int$endUnix timestamp.
setStart (   $start)

Sets the start date time by given unix timestamp.

Parameters
int$startUnix timestamp.
sortEvents ( )

Sorts all events by start time.

storeEvent ( CalendarEvent  $event,
  $attendee_ids = [] 
)

Stores the event in the calendars of all attendees.

Parameters
CalendarEvent$eventThe event to store.
array$attendee_idsThe user ids of the attendees.
Returns
bool|int The number of stored events or false if an error occured.

Field Documentation

$end
$range
$range_object
$start
$ts
$type

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