Stud.IP  4.2 Revision
SingleCalendar Class Reference
Collaboration diagram for SingleCalendar:
Collaboration graph

Public Member Functions

 __construct ($range_id, $start=null, $end=null)
 
 getEvents ($class_names=null, $start=null, $end=null)
 
 storeEvent (CalendarEvent $event, $attendee_ids=array())
 
 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
 

Protected Member Functions

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

Constructor & Destructor Documentation

◆ __construct()

__construct (   $range_id,
  $start = null,
  $end = null 
)
Here is the call graph for this function:

Member Function Documentation

◆ adapt_events()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkPermission()

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.
Here is the call graph for this function:

◆ checkRestriction()

static checkRestriction ( Event  $event,
  $restrictions 
)
static

TODO use filter instead

Parameters
Event$event
array$restrictions
Returns
boolean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createEventMatrix()

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
Here is the call graph for this function:

◆ deleteEvent()

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.
Here is the call graph for this function:

◆ getDayCalendar()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEnd()

getEnd ( )

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

Returns
int Unix timestamp.
Here is the caller graph for this function:

◆ getEvent()

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.
Here is the call graph for this function:

◆ getEventList()

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)
Here is the caller graph for this function:

◆ getEvents()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getId()

getId ( )

An alias for SingleCalendar::getRangeId().

See also
SingleCalendar::getRangeId()
Here is the call graph for this function:

◆ getListCountEvents()

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.
Here is the call graph for this function:

◆ getNewEvent()

getNewEvent ( )

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

Returns
The new event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPermissionByUser()

getPermissionByUser (   $user_id = null)

Returns the permission of the given user for this calendar.

Parameters
string$user_idUser id.
Returns
int The calendar permission.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRange()

getRange ( )

Returns the object range of this calendar.

Returns
int The object range.
Here is the caller graph for this function:

◆ getRangeId()

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.
Here is the caller graph for this function:

◆ getRangeObject()

getRangeObject ( )

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

Returns
int The object range.

◆ getStart()

getStart ( )

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

Returns
int Unix timestamp.
Here is the caller graph for this function:

◆ havePermission()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDeleteMessage()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendStoreMessage()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnd()

setEnd (   $end)

Sets the end date time by given unix timestamp.

Parameters
int$endUnix timestamp.
Here is the caller graph for this function:

◆ setStart()

setStart (   $start)

Sets the start date time by given unix timestamp.

Parameters
int$startUnix timestamp.

◆ sortEvents()

sortEvents ( )

Sorts all events by start time.

◆ storeEvent()

storeEvent ( CalendarEvent  $event,
  $attendee_ids = array() 
)

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.
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ $end

$end

◆ $events

◆ $range

$range

◆ $range_object

$range_object

◆ $start

$start

◆ $type

$type

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