\Kronolith_Event_Holidays

Copyright 2006-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.

Summary

Methods
Properties
Constants
__construct()
loadHistory()
__set()
__get()
getDriver()
getShare()
hasPermission()
save()
fromDriver()
toiCalendar()
fromiCalendar()
disconnectExceptions()
fromASAppointment()
addEASFiles()
toASAppointment()
toHash()
fromHash()
toAlarm()
toJson()
exists()
setTimezone()
getDuration()
recurs()
getRecurName()
exceptionLink()
exceptionsList()
boundExceptions()
isPrivate()
getTitle()
getLocation()
hasAttendee()
addAttendee()
addResource()
removeResource()
getResources()
setResources()
isAllDay()
synchronizeTags()
readForm()
readRecurrenceForm()
html()
getViewUrl()
getEditUrl()
getDeleteUrl()
getExportUrl()
getLink()
getCSSColors()
getTooltip()
getTimeRange()
getStatusClass()
vfsInit()
getVfsUid()
addFile()
addFileFromData()
deleteFile()
deleteFiles()
listFiles()
vfsDisplayUrl()
vfsEditUrl()
$initialized
$stored
$uid
$sequence
$recurrenceid
$organizer
$title
$location
$timezone
$status
$icon
$description
$url
$private
$first
$last
$attendees
$start
$end
$durMin
$allday
$created
$createdby
$modified
$modifiedby
$alarm
$methods
$calendar
$calendarType
$recurrence
$baseid
$exceptionoriginaldate
No constants found
_handlevEventRecurrence()
_handleEas16Exception()
_getEASFileReference()
_addEASFile()
_handleResources()
_formIDEncode()
_addFile()
_ensureUtf8()
$_id
$_creator
$_internaltags
$_tags
$_geoLocation
$_resources
$_originalStart
$_originalEnd
$_snooze
$_backgroundColor
$_foregroundColor
$_overlap
$_indent
$_span
$_rowspan
$_duration
$_vfs
N/A
No private methods found
$_varRenderer
N/A

Properties

$initialized

$initialized : boolean

Flag that is set to true if this event has data from either a storage backend or a form or other import method.

Type

boolean

$stored

$stored : boolean

Flag that is set to true if this event exists in a storage driver.

Type

boolean

$uid

$uid : string

The UID for this event.

Type

string

$sequence

$sequence : integer

The iCalendar SEQUENCE for this event.

Type

integer

$recurrenceid

$recurrenceid : integer

The iCalendar RECURRENCE-ID for this event exception.

Type

integer

$organizer

$organizer : string

The email address of the organizer of the event, if known.

Type

string

$title

$title : string

The title of this event.

For displaying in the interface use getTitle() instead.

Type

string

$location

$location : string

The location this event occurs at.

Type

string

$timezone

$timezone : string

The timezone of this event.

Type

string

$status

$status : integer

The status of this event.

Type

integer

$icon

$icon : string

URL to an icon of this event.

Type

string

$description

$description : string

The description for this event.

Type

string

$url

$url : string

URL of this event.

Type

string

$private

$private : boolean

Whether the event is private.

Type

boolean

$first

$first : \boolen

Whether this is the event on the first day of a multi-day event.

Type

\boolen

$last

$last : \boolen

Whether this is the event on the last day of a multi-day event.

Type

\boolen

$start

$start : \Horde_Date

The start time of the event.

Type

\Horde_Date

$end

$end : \Horde_Date

The end time of the event.

Type

\Horde_Date

$durMin

$durMin : integer

The duration of this event in minutes

Type

integer

$allday

$allday : boolean

Whether this is an all-day event.

Type

boolean

$created

$created : \Horde_Date

The creation time.

Type

\Horde_Date

$createdby

$createdby : string

The creator string.

Type

string

$modified

$modified : \Horde_Date

The last modification time.

Type

\Horde_Date

$modifiedby

$modifiedby : string

The last-modifier string.

Type

string

$alarm

$alarm : integer

Number of minutes before the event starts to trigger an alarm.

Type

integer

$methods

$methods : array

The particular alarm methods overridden for this event.

Type

array

$calendar

$calendar : string

The identifier of the calender this event exists on.

Type

string

$calendarType

$calendarType : string

The type of the calender this event exists on.

Type

string

$recurrence

$recurrence : \Horde_Date_Recurrence

The Horde_Date_Recurrence class for this event.

Type

\Horde_Date_Recurrence

$baseid

$baseid : string

The baseid. For events that represent exceptions this is the UID of the original, recurring event.

Type

string

$exceptionoriginaldate

$exceptionoriginaldate : \Horde_Date

For exceptions, the date of the original recurring event that this is an exception for.

Type

\Horde_Date

$_id

$_id : string

The driver unique identifier for this event.

Type

string

$_creator

$_creator : string

The user id of the creator of the event.

Type

string

$_internaltags

$_internaltags : array

Event tags from the storage backend (e.g. Kolab)

Type

array

$_tags

$_tags : array|string

This tag's events.

Type

array|string

$_geoLocation

$_geoLocation : array

Geolocation

Type

array

$_resources

$_resources : array

All resources of this event.

This is an associative array where keys are resource uids, values are associative arrays with keys attendance and response.

Type

array

$_originalStart

$_originalStart : \Horde_Date

The original start time of the event.

This may differ from $start on multi-day events where $start is the start time on the current day. For recurring events this is the start time of the current recurrence.

Type

\Horde_Date

$_originalEnd

$_originalEnd : \Horde_Date

The original end time of the event.

Type

\Horde_Date

$_snooze

$_snooze : integer

Snooze minutes for this event's alarm.

Type

integer

$_backgroundColor

$_backgroundColor : string

The HTML background color to be used for this event.

Type

string

$_foregroundColor

$_foregroundColor : string

The HTML foreground color to be used for this event.

Type

string

$_overlap

$_overlap : integer

Used in view renderers.

Type

integer

$_indent

$_indent : integer

Used in view renderers.

Type

integer

$_span

$_span : integer

Used in view renderers.

Type

integer

$_rowspan

$_rowspan : integer

Used in view renderers.

Type

integer

$_duration

$_duration : \stdClass

The cached event duration, split up in time units.

Type

\stdClass

$_vfs

$_vfs : \Horde_Vfs

VFS handler

Type

\Horde_Vfs

$_varRenderer

$_varRenderer : \Horde_Core_Ui_VarRenderer

The VarRenderer class to use for printing select elements.

Type

\Horde_Core_Ui_VarRenderer

Methods

__construct()

__construct(\Kronolith_Driver  $driver, mixed  $eventObject = null) 

Constructor.

Parameters

\Kronolith_Driver $driver

The backend driver that this event is stored in.

mixed $eventObject

Backend specific event object that this will represent.

loadHistory()

loadHistory() 

Retrieves history information for this event from the history backend.

__set()

__set(string  $name, mixed  $value) 

Setter.

Sets the 'id' and 'creator' properties.

Parameters

string $name

Property name.

mixed $value

Property value.

__get()

__get(string  $name) : mixed

Getter.

Returns the 'id' and 'creator' properties.

Parameters

string $name

Property name.

Returns

mixed —

Property value.

getDriver()

getDriver() : \Kronolith_Driver

Returns a reference to a driver that's valid for this event.

Returns

\Kronolith_Driver

A driver that this event can use to save itself, etc.

getShare()

getShare() : \Horde_Share

Returns the share this event belongs to.

Throws

\Kronolith_Exception

Returns

\Horde_Share —

This event's share.

hasPermission()

hasPermission(integer  $permission, string  $user = null) : boolean

Encapsulates permissions checking.

Parameters

integer $permission

The permission to check for.

string $user

The user to check permissions for.

Returns

boolean

save()

save() : integer

Saves changes to this event.

Throws

\Kronolith_Exception

Returns

integer —

The event id.

fromDriver()

fromDriver(\Date_Holidays_Holiday  $dhEvent) 

Parse in an event from the driver.

Parameters

\Date_Holidays_Holiday $dhEvent

A holiday returned from the driver

toiCalendar()

toiCalendar(\Horde_Icalendar  $calendar, boolean  $includeFiles = true) : array

Exports this event in iCalendar format.

Parameters

\Horde_Icalendar $calendar

A Horde_Icalendar object that acts as a container.

boolean $includeFiles

Include attached files in the iCalendar file? @since 4.3.0

Returns

array —

An array of Horde_Icalendar_Vevent objects for this event.

fromiCalendar()

fromiCalendar(\Horde_Icalendar_Vevent  $vEvent, boolean  $parseAttendees = false) 

Updates the properties of this event from a Horde_Icalendar_Vevent object.

Parameters

\Horde_Icalendar_Vevent $vEvent

The iCalendar data to update from.

boolean $parseAttendees

Parse attendees too? @since Kronolith 4.2

disconnectExceptions()

disconnectExceptions(boolean  $delete = false) 

Disconnect any existing exceptions.

Parameters

boolean $delete

If true, disconnected exceptions will be deleted completely.

fromASAppointment()

fromASAppointment(\Horde_ActiveSync_Message_Appointment  $message) 

Imports the values for this event from a MS ActiveSync Message.

Parameters

\Horde_ActiveSync_Message_Appointment $message

Throws

\Kronolith_Exception

addEASFiles()

addEASFiles(  $message) 

Parameters

$message

toASAppointment()

toASAppointment(array  $options = array()) : \Horde_ActiveSync_Message_Appointment

Export this event as a MS ActiveSync Message

Parameters

array $options

Options:

  • protocolversion: (float) The EAS version to support DEFAULT: 2.5
  • bodyprefs: (array) A BODYPREFERENCE array. DEFAULT: none (No body prefs enforced).
  • truncation: (integer) Truncate event body to this length DEFAULT: none (No truncation).

Returns

\Horde_ActiveSync_Message_Appointment

toHash()

toHash() : array

Exports the values for this event to an array of values.

Throws

\Kronolith_Exception

Returns

array —

Array containing all the values.

fromHash()

fromHash(array  $hash) 

Imports the values for this event from an array of values.

Parameters

array $hash

Array containing all the values.

Throws

\Kronolith_Exception

toAlarm()

toAlarm(\Horde_Date  $time, string  $user = null, \Prefs  $prefs = null) : array

Returns an alarm hash of this event suitable for Horde_Alarm.

Parameters

\Horde_Date $time

Time of alarm.

string $user

The user to return alarms for.

\Prefs $prefs

A Prefs instance.

Returns

array —

Alarm hash or null.

toJson()

toJson(array  $options = array()) : \stdClass

Returns a simple object suitable for json transport representing this event.

Possible properties are:

  • t: title
  • d: description
  • c: calendar id
  • s: start date
  • e: end date
  • fi: first day of a multi-day event
  • la: last day of a multi-day event
  • x: status (Kronolith::STATUS_* constant)
  • al: all-day?
  • bg: background color
  • fg: foreground color
  • pe: edit permissions?
  • pd: delete permissions?
  • vl: variable, i.e. editable length?
  • a: alarm text or minutes
  • r: recurrence type (Horde_DateRecurrence::RECUR* constant)
  • bid: The baseid for an event representing an exception
  • eod: The original date that an exception is replacing
  • ic: icon
  • ln: link
  • aj: ajax link
  • id: event id
  • ty: calendar type (driver)
  • l: location
  • u: url
  • sd: formatted start date
  • st: formatted start time
  • ed: formatted end date
  • et: formatted end time
  • at: attendees
  • rs: resources
  • tg: tag list
  • mt: meeting (Boolean true if event has attendees, false otherwise).
  • cb: created by (string describing when and who created the event).
  • mb: modified by (string describing when and who last modified event).
  • o: organizer (if known)
  • oy: organizer you
  • cr: creator's attendance response
  • fs: Array of attached files.

Parameters

array $options

An array of options:

  • all_day: (boolean) If not null, overrides whether the event is an all-day event. DEFAULT: null (Do not override).
  • full: (boolean) Whether to return all event details. DEFAULT: false (Do not return all details).
  • time_format: (string) The date() format to use for time formatting. DEFAULT: 'H:i'
  • history: (boolean) If true, ensures that this event's history is loaded from the History backend. DEFAULT: false (Do not ensure history is loaded).

Returns

\stdClass —

A simple object.

exists()

exists() : boolean

Checks if the current event is already present in the calendar.

Does the check based on the uid.

Returns

boolean —

True if event exists, false otherwise.

setTimezone()

setTimezone(  $to_original) 

Converts this event between the event's and the local timezone.

Parameters

$to_original

getDuration()

getDuration() 

recurs()

recurs() : boolean

Returns whether this event is a recurring event.

Returns

boolean —

True if this is a recurring event.

getRecurName()

getRecurName() : string

Returns a description of this event's recurring type.

Returns

string —

Human readable recurring type.

exceptionLink()

exceptionLink(string  $date) : string

Returns a correcty formatted exception date for recurring events and a link to delete this exception.

Parameters

string $date

Exception in the format Ymd.

Returns

string —

The formatted date and delete link.

exceptionsList()

exceptionsList() : string

Returns a list of exception dates for recurring events including links to delete them.

Returns

string —

List of exception dates and delete links.

boundExceptions()

boundExceptions(boolean  $flat = true) : array

Returns a list of events that represent exceptions to this event's recurrence series, if any. If this event does not recur, an empty array is returned.

Parameters

boolean $flat

If true (the default), returns a flat array containing Kronolith_Event objects. If false, results are in the format of listEvents calls. @see Kronolith::listEvents().

Returns

array —

An array of Kronolith_Event objects whose baseid property is equal to this event's uid. I.e., it is a bound exception.

isPrivate()

isPrivate(string  $user = null) : boolean

Returns whether the event should be considered private.

Parameters

string $user

The current user. If omitted, uses the current user.

Returns

boolean —

Whether to consider the event as private.

getTitle()

getTitle(string  $user = null) : string

Return this events title.

Parameters

string $user

The current user.

Returns

string —

The title of this event

getLocation()

getLocation(string  $user = null) : string

Returns the location of this event, considering private flags.

Parameters

string $user

The current user.

Returns

string —

The location of this event.

hasAttendee()

hasAttendee(string  $email, boolean  $case_sensitive = false, array  $attendees = null) : boolean

Checks to see whether the specified attendee is associated with the current event.

Parameters

string $email

The email address of the attendee.

boolean $case_sensitive

Match in a case sensitive manner. @since 4.3.0

array $attendees

Search that attendee list instead of this event's. @since 4.3.0

Returns

boolean —

True if the specified attendee is present for this event.

addAttendee()

addAttendee(string  $email, integer  $role, integer|boolean  $response, string  $name = null) 

Adds a new attendee to the current event.

This will overwrite an existing attendee if one exists with the same email address.

Parameters

string $email

The email address of the attendee.

integer $role

The role code of the attendee.

integer|boolean $response

The response code of the attendee.

string $name

The name of the attendee.

addResource()

addResource(\Kronolith_Resource  $resource,   $response) 

Adds a single resource to this event.

No validation or acceptence/denial is done here...it should be done when saving the event.

Parameters

\Kronolith_Resource $resource

The resource to add.

$response

removeResource()

removeResource(\Kronolith_Resource  $resource) 

Removes a resource from this event.

Parameters

\Kronolith_Resource $resource

The resource to remove.

getResources()

getResources() : array

Returns all resources.

Returns

array —

A copy of the resources array.

setResources()

setResources(array  $resources) 

Set the entire resource array. Only used when copying an Event.

Parameters

array $resources

The resource array.

isAllDay()

isAllDay() : boolean

Is this event an all-day event?

Since there are no holidays lasting only a few hours, this is always true.

Returns

boolean —

true

synchronizeTags()

synchronizeTags(array  $tags) 

Syncronizes tags from the tagging backend with the task storage backend, if necessary.

Parameters

array $tags

Tags from the tagging backend.

readForm()

readForm(\Kronolith_Event|null  $existing = null) 

Reads form/post data and updates this event's properties.

Parameters

\Kronolith_Event|null $existing

If this is an exception event this is taken as the base event. @since 4.2.6

readRecurrenceForm()

readRecurrenceForm(  $start,   $timezone,   $recurrence = null) 

Parameters

$start
$timezone
$recurrence

html()

html(  $property) 

Parameters

$property

getViewUrl()

getViewUrl(array  $params = array(),   $full = false,   $encoded = true) : \Horde_Url

Parameters

array $params
$full
$encoded

Returns

\Horde_Url

getEditUrl()

getEditUrl(array  $params = array(),   $full = false) : \Horde_Url

Parameters

array $params
$full

Returns

\Horde_Url

getDeleteUrl()

getDeleteUrl(array  $params = array(),   $full = false) : \Horde_Url

Parameters

array $params
$full

Returns

\Horde_Url

getExportUrl()

getExportUrl(array  $params = array(),   $full = false) : \Horde_Url

Parameters

array $params
$full

Returns

\Horde_Url

getLink()

getLink(  $datetime = null,   $icons = true,   $from_url = null,   $full = false,   $encoded = true) 

Parameters

$datetime
$icons
$from_url
$full
$encoded

getCSSColors()

getCSSColors(boolean  $with_attribute = true) : string

Returns the CSS color definition for this event.

Parameters

boolean $with_attribute

Whether to wrap the colors inside a "style" attribute.

Returns

string —

A CSS string with color definitions.

getTooltip()

getTooltip() : string

Returns

string —

A tooltip for quick descriptions of this event.

getTimeRange()

getTimeRange() : string

Returns

string —

The time range of the event ("All Day", "1:00pm-3:00pm", "08:00-22:00").

getStatusClass()

getStatusClass() : string

Returns

string —

The CSS class for the event based on its status.

vfsInit()

vfsInit() : \Horde_Vfs

Loads the VFS configuration and initializes the VFS backend.

Throws

\Kronolith_Exception

Returns

\Horde_Vfs —

A VFS object.

getVfsUid()

getVfsUid() : string

Return a unique id suitable for identifying this event in the VFS. Takes into account there may be multiple users with access to the same UID in different calendars.

Returns

string —

The unique id.

addFile()

addFile(array  $info) 

Saves a file into the VFS backend associated with this event.

Parameters

array $info

A hash with the file information as returned from a Horde_Form_Type_file.

Throws

\Kronolith_Exception

addFileFromData()

addFileFromData(array  $info) 

Saves a file into the VFS backend associated with this event.

Parameters

array $info

A hash with the file information and the file contents in 'data'.

Throws

\Kronolith_Exception

deleteFile()

deleteFile(string  $file) 

Deletes a file from the VFS backend associated with this event.

Parameters

string $file

The file name.

Throws

\Kronolith_Exception

deleteFiles()

deleteFiles() 

Deletes all files from the VFS backend associated with this event.

Throws

\Kronolith_Exception

listFiles()

listFiles() : array

Returns all files from the VFS backend associated with this event.

Returns

array —

A list of hashes with file informations.

vfsDisplayUrl()

vfsDisplayUrl(array  $file) : string

Returns a link to display and download a file from the VFS backend associated with this object.

Parameters

array $file

The file information hash as returned from self::listFiles.

Returns

string —

The HTML code of the generated link.

vfsEditUrl()

vfsEditUrl(array  $file) : string

Returns a link to display, download, and delete a file from the VFS backend associated with this object.

Parameters

array $file

The file information hash as returned from self::listFiles.

Returns

string —

The HTML code of the generated link.

_handlevEventRecurrence()

_handlevEventRecurrence(\Horde_Icalendar  $vEvent) 

Handle parsing recurrence related fields.

Parameters

\Horde_Icalendar $vEvent

Throws

\Kronolith_Exception

_handleEas16Exception()

_handleEas16Exception(\Horde_ActiveSync_Message_Appointment  $message) : boolean

Handle adding/editing exceptions from EAS 16.0 clients.

Parameters

\Horde_ActiveSync_Message_Appointment $message

Returns

boolean

_getEASFileReference()

_getEASFileReference(  $filename) 

Parameters

$filename

_addEASFile()

_addEASFile(\Horde_ActiveSync_Message_AirSyncBaseAdd  $add) 

Parameters

\Horde_ActiveSync_Message_AirSyncBaseAdd $add

_handleResources()

_handleResources(\Kronolith_Event|null  $existing = null) 

Handles updating/saving this event's resources. Unless this event recurs, this will delete this event from any resource calendars that are no longer needed (as when a resource is removed from an existing event). If this event is an exception, i.e., contains a baseid, AND $existing is provided, the resources from the original event are used for purposes of determining any resources that need to be removed.

Parameters

\Kronolith_Event|null $existing

An existing base event.

_formIDEncode()

_formIDEncode(  $id) 

Parameters

$id

_addFile()

_addFile(array  $info, boolean  $data = false) 

Saves a file into the VFS backend associated with this event.

Parameters

array $info

A hash with the file information.

boolean $data

Whether the file contents is in $info['data'].

Throws

\Kronolith_Exception

_ensureUtf8()

_ensureUtf8(string  $text) : string|boolean

Ensure the given string is valid UTF-8.

Parameters

string $text

The string to ensure contains no invalid UTF-8 sequences.

Returns

string|boolean —

The valid UTF-8 string, possibly with illegal sequences removed.