PHP Class Kronolith, horde

Author: Chuck Hagenbuch ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Méthode Description
_notificationPref ( string $user, string $mode, string $calendar = null ) : mixed Returns whether a user wants email notifications for a calendar.
addCalendarLinks ( ) Adds tags for calendar feeds to the HTML header.
addCoverDates ( &$results, Kronolith_Event $event, Horde_Date $eventStart, Horde_Date $eventEnd, boolean $json, Horde_Date $originalStart = null, Horde_Date $originalEnd = null, Horde_Date $endDate = null ) Adds an event to all the days it covers.
addEvents ( &$results, &$event, $startDate, $endDate, $showRecurrence, $json, $coverDates = true ) Calculates recurrences of an event during a certain period.
addSearchEvents ( array &$events, Kronolith_Event $event, stdClass $query, boolean $json ) Adds an event to set of search results.
addShare ( array $info ) : Horde_Share Creates a new share.
attendeeList ( ) : string Returns a comma separated list of attendees and resources
backgroundColor ( array | Horde_Share_Object $calendar ) : string Returns the background color for a calendar.
buildMimeMessage ( Horde_View $view, string $template, Horde_Mime_Part $image ) : Horde_Mime_Part Builds the body MIME part of a multipart message.
buildStatusWidget ( string $name, string $current = self::STATUS_CONFIRMED, string $any = false ) : string Builds the HTML for an event status widget.
countEvents ( ) : integer Returns the number of events in calendars that the current user owns.
currentDate ( ) : Horde_Date
deleteShare ( Horde_Share $calendar ) Deletes a share and removes all events associated with it.
displayedCalendars ( ) : array Returns a list of currently displayed calendars.
embedCode ( string $calendar ) : string Returs the HTML/javascript snippit needed to embed a calendar in an external website.
eventTabs ( string $tabname, Kronolith_Event $event )
feedUrl ( string $calendar ) : string Returns the feed URL for a calendar.
foregroundColor ( array | Horde_Share_Object | string $calendar ) : string Returns the foreground color for a calendar or a background color.
getAddressbookSearchParams ( ) : array Determines parameters needed to do an address search
getCSSColors ( array | Horde_Share_Object $calendar, boolean $with_attribute = true ) : string Returns the CSS color definition for a calendar.
getCalendar ( Kronolith_Driver $driver ) : Kronolith_Calendar Returns a Kronolith_Calendar object for a driver instance.
getDefaultCalendar ( integer $permission = Horde_Perms::SHOW, boolean $owner_only = false ) : string Returns the default calendar for the current user at the specified permissions level.
getDriver ( string $driver = null, string $calendar = null ) : Kronolith_Driver Attempts to return a single, concrete Kronolith_Driver instance based on a driver name.
getImagePart ( string $file ) : Horde_Mime_Part Returns a MIME part for an image to be embedded into a HTML document.
getInternalCalendar ( string $target ) : Kronolith_Resource | Horde_Share_Object Obtain an internal calendar. Use this where we don't know if we will have a Horde_Share or a Kronolith_Resource based calendar.
getLabel ( $calendar ) : string Returns the label to be used for a calendar.
getRemoteParams ( $calendar ) Check for HTTP authentication credentials
getSyncCalendars ( boolean $prune = false ) : array Returns the calendars that should be used for syncing.
getTagger ( ) : Kronolith_Tagger Obtain a Kronolith_Tagger instance
getUserEmail ( $uid ) Returns the email address, if available, of a user.
getUserName ( $uid ) Returns the real name, if available, of a user.
getView ( string $view ) Get a named Kronolith_View_* object and load it with the appropriate date parameters.
hasApiPermission ( string $api, integer $perm = Horde_Perms::READ ) : boolean Checks whether an API (application) exists and the user has permission to access it.
hasPermission ( string $calendar, integer $perm ) : boolean Returns whether the current user has certain permissions on a calendar.
initialize ( ) Initial app setup code.
isUserEmail ( string $uid, string $email ) Checks if an email address belongs to a user.
listAlarms ( Horde_Date $date, array $calendars, boolean $fullevent = false ) : array Returns all the alarms active on a specific date.
listCalendars ( integer $permission = Horde_Perms::SHOW, boolean $display = false ) : array Returns all calendars a user has access to, according to several parameters/permission levels.
listEvents ( Horde_Date $startDate, Horde_Date $endDate, array $calendars = null, array $options = [] ) : array Returns all the events that happen each day within a time period
listInternalCalendars ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW, string $user = null ) : array Returns all internal calendars a user has access to, according to several parameters/permission levels.
listShareUsers ( Horde_Share_Object $share ) : array Returns a list of user with read access to a share.
mergeEvents ( array &$results, array $events ) Merges results from two listEvents() result sets.
notifyOfResourceRejection ( Kronolith_Event $event ) Check for resource declines and push notice to stack if found.
parseDate ( string $date, boolean $withtime = true, $timezone = null ) : Horde_Date Parses a complete date-time string into a Horde_Date object.
partToString ( integer $part ) : string Maps a Kronolith attendee participation string to a translated string suitable for display.
permissionToJson ( Horde_Perms_Permission $perm, boolean $systemShare = false ) : array Converts a permission object to a json object.
quickAdd ( string $text, string $calendar = null ) : array Imports an event parsed from a string.
randomColor ( ) : string Returns a random CSS color.
readPermsForm ( Horde_Share_Object | Kronolith_Resource_Base $share ) : array Reads a submitted permissions form and updates the share permissions.
recurToString ( integer $type ) : string Maps a Kronolith recurrence value to a translated string suitable for display.
removeUserEvents ( string $user ) Remove all events owned by the specified user in all calendars.
responseFromICal ( string $response ) : string Maps an iCalendar attendee response string to the corresponding Kronolith value.
responseToString ( integer $response ) : string Maps a Kronolith attendee response string to a translated string suitable for display.
search ( object $query, string $calendar = null ) : array Searches for events with the given properties.
sendITipNotifications ( Kronolith_Event $event, Horde_Notification_Handler $notification, integer $action, Horde_Date $instance = null, string $range = null, Kronolith_Attendee_List $cancellations = null ) Sends out iTip event notifications to all attendees of a specific event.
sendNotification ( Kronolith_Event $event, string $action ) Sends email notifications that a event has been added, edited, or deleted to users that want such notifications.
showAjaxView ( ) Returns whether to display the ajax view.
sortEvents ( array $days ) : array Sorts an event list.
statusToString ( integer $status ) : string Maps a Kronolith meeting status string to a translated string suitable for display.
subscribeRemoteCalendar ( array &$info, string $update = false ) Subscribes to or updates a remote calendar.
tabs ( object $renderer )
toTimeslice ( Kronolith_Event $event, $type, $client ) Export an event to a timeslice.
unsubscribeRemoteCalendar ( string $url ) : array Unsubscribes from a remote calendar.
updateShare ( &$calendar, array $info ) Updates an existing share.
validateUserAttendee ( string $user ) : mixed Return Kronolith_Attendee object for a local user.
viewShowLocation ( ) Should we show event location, based on the show_location pref?
viewShowTime ( ) Should we show event time, based on the show_time preference?

Méthodes protégées

Méthode Description
_sortEventStartTime ( $a, $b ) Used with usort() to sort events based on their start times.

Method Details

_notificationPref() public static méthode

Returns whether a user wants email notifications for a calendar.
public static _notificationPref ( string $user, string $mode, string $calendar = null ) : mixed
$user string A user name.
$mode string The check "mode". If "owner", the method checks if the user wants notifications only for calendars he owns. If "read", the method checks if the user wants notifications for all calendars he has read access to, or only for shown calendars and the specified calendar is currently shown.
$calendar string The name of the calendar if mode is "read".
Résultat mixed The user's email, time, and language preferences if they want a notification for this calendar.

_sortEventStartTime() protected static méthode

Used with usort() to sort events based on their start times.
protected static _sortEventStartTime ( $a, $b )

addCoverDates() public static méthode

Adds an event to all the days it covers.
public static addCoverDates ( &$results, Kronolith_Event $event, Horde_Date $eventStart, Horde_Date $eventEnd, boolean $json, Horde_Date $originalStart = null, Horde_Date $originalEnd = null, Horde_Date $endDate = null )
$event Kronolith_Event An event object.
$eventStart Horde_Date The event's start of the actual recurrence.
$eventEnd Horde_Date The event's end of the actual recurrence.
$json boolean Store the results of the events' toJson() method?
$originalStart Horde_Date The actual starting time of a single event spanning multiple days.
$originalEnd Horde_Date The actual ending time of a single event spanning multiple days.
$endDate Horde_Date

addEvents() public static méthode

Calculates recurrences of an event during a certain period.
public static addEvents ( &$results, &$event, $startDate, $endDate, $showRecurrence, $json, $coverDates = true )

addSearchEvents() public static méthode

Adds an event to set of search results.
public static addSearchEvents ( array &$events, Kronolith_Event $event, stdClass $query, boolean $json )
$events array The list of events to update with the new event.
$event Kronolith_Event An event from a search result.
$query stdClass A search query.
$json boolean Store the results of the events' toJson() method?

addShare() public static méthode

Creates a new share.
public static addShare ( array $info ) : Horde_Share
$info array Hash with calendar information.
Résultat Horde_Share The new share.

attendeeList() public static méthode

Returns a comma separated list of attendees and resources
public static attendeeList ( ) : string
Résultat string Attendee/Resource list.

backgroundColor() public static méthode

Returns the background color for a calendar.
public static backgroundColor ( array | Horde_Share_Object $calendar ) : string
$calendar array | Horde_Share_Object A calendar share or a hash from a remote calender definition.
Résultat string A HTML color code.

buildMimeMessage() public static méthode

Builds the body MIME part of a multipart message.
public static buildMimeMessage ( Horde_View $view, string $template, Horde_Mime_Part $image ) : Horde_Mime_Part
$view Horde_View A view to render the HTML and plain text templates for the messate.
$template string The template base name for the view.
$image Horde_Mime_Part The MIME part of a related image.
Résultat Horde_Mime_Part A multipart/alternative MIME part.

buildStatusWidget() public static méthode

Builds the HTML for an event status widget.
public static buildStatusWidget ( string $name, string $current = self::STATUS_CONFIRMED, string $any = false ) : string
$name string The name of the widget.
$current string The selected status value.
$any string Whether an 'any' item should be added
Résultat string The HTML

countEvents() public static méthode

Returns the number of events in calendars that the current user owns.
public static countEvents ( ) : integer
Résultat integer The number of events.

currentDate() public static méthode

public static currentDate ( ) : Horde_Date
Résultat Horde_Date

deleteShare() public static méthode

Deletes a share and removes all events associated with it.
public static deleteShare ( Horde_Share $calendar )
$calendar Horde_Share The share to delete.

displayedCalendars() public static méthode

Returns a list of currently displayed calendars.
public static displayedCalendars ( ) : array
Résultat array Currently displayed calendars.

embedCode() public static méthode

Returs the HTML/javascript snippit needed to embed a calendar in an external website.
public static embedCode ( string $calendar ) : string
$calendar string A calendar name.
Résultat string The calendar's embed snippit.

eventTabs() public static méthode

public static eventTabs ( string $tabname, Kronolith_Event $event )
$tabname string
$event Kronolith_Event

feedUrl() public static méthode

Returns the feed URL for a calendar.
public static feedUrl ( string $calendar ) : string
$calendar string A calendar name.
Résultat string The calendar's feed URL.

foregroundColor() public static méthode

Returns the foreground color for a calendar or a background color.
public static foregroundColor ( array | Horde_Share_Object | string $calendar ) : string
$calendar array | Horde_Share_Object | string A color string, a calendar share or a hash from a remote calender definition.
Résultat string A HTML color code.

getAddressbookSearchParams() public static méthode

Determines parameters needed to do an address search
public static getAddressbookSearchParams ( ) : array
Résultat array An array with two keys: 'fields' and 'sources'.

getCSSColors() public static méthode

Returns the CSS color definition for a calendar.
public static getCSSColors ( array | Horde_Share_Object $calendar, boolean $with_attribute = true ) : string
$calendar array | Horde_Share_Object A calendar share or a hash from a remote calender definition.
$with_attribute boolean Whether to wrap the colors inside a "style" attribute.
Résultat string A CSS string with color definitions.

getCalendar() public static méthode

Returns a Kronolith_Calendar object for a driver instance.
public static getCalendar ( Kronolith_Driver $driver ) : Kronolith_Calendar
$driver Kronolith_Driver
Résultat Kronolith_Calendar The matching calendar instance.

getDefaultCalendar() public static méthode

Returns the default calendar for the current user at the specified permissions level.
public static getDefaultCalendar ( integer $permission = Horde_Perms::SHOW, boolean $owner_only = false ) : string
$permission integer Horde_Perms constant for permission level required.
$owner_only boolean Only consider owner-owned calendars.
Résultat string The calendar id, or null if none.

getDriver() public static méthode

This singleton method automatically retrieves all parameters required for the specified driver.
public static getDriver ( string $driver = null, string $calendar = null ) : Kronolith_Driver
$driver string The type of concrete Kronolith_Driver subclass to return.
$calendar string The calendar name. The format depends on the driver being used.
Résultat Kronolith_Driver The newly created concrete Kronolith_Driver instance.

getImagePart() public static méthode

Returns a MIME part for an image to be embedded into a HTML document.
public static getImagePart ( string $file ) : Horde_Mime_Part
$file string An image file name.
Résultat Horde_Mime_Part A MIME part representing the image.

getInternalCalendar() public static méthode

Obtain an internal calendar. Use this where we don't know if we will have a Horde_Share or a Kronolith_Resource based calendar.
public static getInternalCalendar ( string $target ) : Kronolith_Resource | Horde_Share_Object
$target string The calendar id to retrieve.
Résultat Kronolith_Resource | Horde_Share_Object

getLabel() public static méthode

Attaches the owner name of shared calendars if necessary.
public static getLabel ( $calendar ) : string
Résultat string The calendar's label.

getRemoteParams() public static méthode

Check for HTTP authentication credentials
public static getRemoteParams ( $calendar )

getSyncCalendars() public static méthode

Returns the calendars that should be used for syncing.
public static getSyncCalendars ( boolean $prune = false ) : array
$prune boolean Remove calendar ids from the sync list that no longer exist. The values are pruned *after* the results are passed back to the client to give sync clients a chance to remove their entries.
Résultat array An array of calendar ids

getTagger() public static méthode

Obtain a Kronolith_Tagger instance
public static getTagger ( ) : Kronolith_Tagger
Résultat Kronolith_Tagger

getUserEmail() public static méthode

Returns the email address, if available, of a user.
public static getUserEmail ( $uid )

getUserName() public static méthode

Returns the real name, if available, of a user.
public static getUserName ( $uid )

getView() public static méthode

Get a named Kronolith_View_* object and load it with the appropriate date parameters.
public static getView ( string $view )
$view string The name of the view.

hasApiPermission() public static méthode

Checks whether an API (application) exists and the user has permission to access it.
public static hasApiPermission ( string $api, integer $perm = Horde_Perms::READ ) : boolean
$api string The API (application) to check.
$perm integer The permission to check.
Résultat boolean True if the API can be accessed.

hasPermission() public static méthode

Returns whether the current user has certain permissions on a calendar.
public static hasPermission ( string $calendar, integer $perm ) : boolean
$calendar string A calendar id.
$perm integer A Horde_Perms permission mask.
Résultat boolean True if the current user has the requested permissions.

initialize() public static méthode

Globals defined:
public static initialize ( )

isUserEmail() public static méthode

Checks if an email address belongs to a user.
public static isUserEmail ( string $uid, string $email )
$uid string user id to check
$email string email address to check

listAlarms() public static méthode

Returns all the alarms active on a specific date.
public static listAlarms ( Horde_Date $date, array $calendars, boolean $fullevent = false ) : array
$date Horde_Date The date to check for alarms.
$calendars array The calendars to check for events.
$fullevent boolean Whether to return complete alarm objects or only alarm IDs.
Résultat array The alarms active on the date. A hash with calendar names as keys and arrays of events or event ids as values.

listCalendars() public static méthode

Returns all calendars a user has access to, according to several parameters/permission levels.
public static listCalendars ( integer $permission = Horde_Perms::SHOW, boolean $display = false ) : array
$permission integer The permission to filter calendars by.
$display boolean Only return calendars that are supposed to be displayed per configuration and user preference.
Résultat array The calendar list.

listEvents() public static méthode

Returns all the events that happen each day within a time period
Deprecation:
public static listEvents ( Horde_Date $startDate, Horde_Date $endDate, array $calendars = null, array $options = [] ) : array
$startDate Horde_Date The start of the time range.
$endDate Horde_Date The end of the time range.
$calendars array The calendars to check for events.
$options array Additional options: - show_recurrence: (boolean) Return every instance of a recurring event? DEFAULT: false (Only return recurring events once inside $startDate - $endDate range) - has_alarm: (boolean) Only return events with alarms. DEFAULT: false (Return all events) - json: (boolean) Store the results of the event's toJson() method? DEFAULT: false - cover_dates: (boolean) Add the events to all days that they cover? DEFAULT: true - hide_exceptions: (boolean) Hide events that represent exceptions to a recurring event. DEFAULT: false (Do not hide exception events) - fetch_tags: (boolean) Fetch tags for all events. DEFAULT: false (Do not fetch event tags)
Résultat array The events happening in this time period.

listInternalCalendars() public static méthode

This method takes the $conf['share']['hidden'] setting into account. If this setting is enabled, even if requesting permissions different than SHOW, it will only return calendars that the user owns or has SHOW permissions for. For checking individual calendar's permissions, use hasPermission() instead.
public static listInternalCalendars ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW, string $user = null ) : array
$owneronly boolean Only return calenders that this user owns? Defaults to false.
$permission integer The permission to filter calendars by.
$user string The user to list calendars for, if not the current.
Résultat array The calendar list.

listShareUsers() public static méthode

Returns a list of user with read access to a share.
public static listShareUsers ( Horde_Share_Object $share ) : array
$share Horde_Share_Object A share object.
Résultat array A hash of share users.

mergeEvents() public static méthode

Merges results from two listEvents() result sets.
public static mergeEvents ( array &$results, array $events )
$results array First list of events.
$events array List of events to be merged into the first one.

notifyOfResourceRejection() public static méthode

Check for resource declines and push notice to stack if found.
public static notifyOfResourceRejection ( Kronolith_Event $event )
$event Kronolith_Event

parseDate() public static méthode

Parses a complete date-time string into a Horde_Date object.
public static parseDate ( string $date, boolean $withtime = true, $timezone = null ) : Horde_Date
$date string The date-time string to parse.
$withtime boolean Whether time is included in the string.
Résultat Horde_Date The parsed date.

partToString() public static méthode

Maps a Kronolith attendee participation string to a translated string suitable for display.
public static partToString ( integer $part ) : string
$part integer The attendee participation; one of the Kronolith::PART_XXX constants.
Résultat string The translated displayable attendee participation string.

permissionToJson() public static méthode

This methods filters out any permissions for the owner and converts the user name if necessary.
public static permissionToJson ( Horde_Perms_Permission $perm, boolean $systemShare = false ) : array
$perm Horde_Perms_Permission A permission object.
$systemShare boolean Is this from a system share?
Résultat array A hash suitable for json.

quickAdd() public méthode

Imports an event parsed from a string.
public quickAdd ( string $text, string $calendar = null ) : array
$text string The text to parse into an event
$calendar string The calendar into which the event will be imported. If 'null', the user's default calendar will be used.
Résultat array The UID of all events that were added.

randomColor() public static méthode

Returns a random CSS color.
public static randomColor ( ) : string
Résultat string A random CSS color string.

readPermsForm() public static méthode

Reads a submitted permissions form and updates the share permissions.
public static readPermsForm ( Horde_Share_Object | Kronolith_Resource_Base $share ) : array
$share Horde_Share_Object | Kronolith_Resource_Base The share to update.
Résultat array A list of error messages.

recurToString() public static méthode

Maps a Kronolith recurrence value to a translated string suitable for display.
public static recurToString ( integer $type ) : string
$type integer The recurrence value; one of the Horde_Date_Recurrence::RECUR_XXX constants.
Résultat string The translated displayable recurrence value string.

removeUserEvents() public static méthode

Remove all events owned by the specified user in all calendars.
public static removeUserEvents ( string $user )
$user string The user name to delete events for.

responseFromICal() public static méthode

Maps an iCalendar attendee response string to the corresponding Kronolith value.
public static responseFromICal ( string $response ) : string
$response string The attendee response.
Résultat string The Kronolith response value.

responseToString() public static méthode

Maps a Kronolith attendee response string to a translated string suitable for display.
public static responseToString ( integer $response ) : string
$response integer The attendee response; one of the Kronolith::RESPONSE_XXX constants.
Résultat string The translated displayable attendee response string.

sendITipNotifications() public static méthode

Can be used to send event invitations, event updates as well as event cancellations.
public static sendITipNotifications ( Kronolith_Event $event, Horde_Notification_Handler $notification, integer $action, Horde_Date $instance = null, string $range = null, Kronolith_Attendee_List $cancellations = null )
$event Kronolith_Event The event in question.
$notification Horde_Notification_Handler A notification object used to show result status.
$action integer The type of notification to send. One of the Kronolith::ITIP_* values.
$instance Horde_Date If cancelling a single instance of a recurring event, the date of this instance.
$range string The range parameter if this is a recurring event. Possible values are self::RANGE_THISANDFUTURE
$cancellations Kronolith_Attendee_List If $action is 'CANCEL', but it is due to removing attendees and not canceling the entire event, these are the uninvited attendees and are the ONLY people that will receive the CANCEL iTIP. @since 4.2.10

sendNotification() public static méthode

Sends email notifications that a event has been added, edited, or deleted to users that want such notifications.
public static sendNotification ( Kronolith_Event $event, string $action )
$event Kronolith_Event An event.
$action string The event action. One of "add", "edit", or "delete".

showAjaxView() public static méthode

return boolean True if the ajax view should be displayed.
public static showAjaxView ( )

sortEvents() public static méthode

Sorts an event list.
public static sortEvents ( array $days ) : array
$days array A list of days with events.
Résultat array The sorted day list.

statusToString() public static méthode

Maps a Kronolith meeting status string to a translated string suitable for display.
public static statusToString ( integer $status ) : string
$status integer The meeting status; one of the Kronolith::STATUS_XXX constants.
Résultat string The translated displayable meeting status string.

subscribeRemoteCalendar() public static méthode

Subscribes to or updates a remote calendar.
public static subscribeRemoteCalendar ( array &$info, string $update = false )
$info array Hash with calendar information.
$update string If present, the original URL of the calendar to update.

tabs() public static méthode

public static tabs ( object $renderer )
$renderer object A Kronolith view.

toTimeslice() public static méthode

Export an event to a timeslice.
public static toTimeslice ( Kronolith_Event $event, $type, $client )
$event Kronolith_Event

unsubscribeRemoteCalendar() public static méthode

Unsubscribes from a remote calendar.
public static unsubscribeRemoteCalendar ( string $url ) : array
$url string The calendar URL.
Résultat array Hash with the deleted calendar's information.

updateShare() public static méthode

Updates an existing share.
public static updateShare ( &$calendar, array $info )
$info array Hash with calendar information.

validateUserAttendee() public static méthode

Return Kronolith_Attendee object for a local user.
public static validateUserAttendee ( string $user ) : mixed
$user string The local username.
Résultat mixed Return the Kronolith_Attendee object for $user, or false if the auth backend supports user listing and the user is not found.

viewShowLocation() public static méthode

Should we show event location, based on the show_location pref?
public static viewShowLocation ( )

viewShowTime() public static méthode

Should we show event time, based on the show_time preference?
public static viewShowTime ( )