PHP Класс Kronolith, horde

Автор: Chuck Hagenbuch ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
_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?

Защищенные методы

Метод Описание
_sortEventStartTime ( $a, $b ) Used with usort() to sort events based on their start times.

Описание методов

_notificationPref() публичный статический метод

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".
Результат mixed The user's email, time, and language preferences if they want a notification for this calendar.

_sortEventStartTime() защищенный статический метод

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

addCoverDates() публичный статический метод

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() публичный статический метод

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

addSearchEvents() публичный статический метод

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() публичный статический метод

Creates a new share.
public static addShare ( array $info ) : Horde_Share
$info array Hash with calendar information.
Результат Horde_Share The new share.

attendeeList() публичный статический метод

Returns a comma separated list of attendees and resources
public static attendeeList ( ) : string
Результат string Attendee/Resource list.

backgroundColor() публичный статический метод

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.
Результат string A HTML color code.

buildMimeMessage() публичный статический метод

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.
Результат Horde_Mime_Part A multipart/alternative MIME part.

buildStatusWidget() публичный статический метод

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
Результат string The HTML

countEvents() публичный статический метод

Returns the number of events in calendars that the current user owns.
public static countEvents ( ) : integer
Результат integer The number of events.

currentDate() публичный статический метод

public static currentDate ( ) : Horde_Date
Результат Horde_Date

deleteShare() публичный статический метод

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

displayedCalendars() публичный статический метод

Returns a list of currently displayed calendars.
public static displayedCalendars ( ) : array
Результат array Currently displayed calendars.

embedCode() публичный статический метод

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.
Результат string The calendar's embed snippit.

eventTabs() публичный статический метод

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

feedUrl() публичный статический метод

Returns the feed URL for a calendar.
public static feedUrl ( string $calendar ) : string
$calendar string A calendar name.
Результат string The calendar's feed URL.

foregroundColor() публичный статический метод

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.
Результат string A HTML color code.

getAddressbookSearchParams() публичный статический метод

Determines parameters needed to do an address search
public static getAddressbookSearchParams ( ) : array
Результат array An array with two keys: 'fields' and 'sources'.

getCSSColors() публичный статический метод

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.
Результат string A CSS string with color definitions.

getCalendar() публичный статический метод

Returns a Kronolith_Calendar object for a driver instance.
public static getCalendar ( Kronolith_Driver $driver ) : Kronolith_Calendar
$driver Kronolith_Driver
Результат Kronolith_Calendar The matching calendar instance.

getDefaultCalendar() публичный статический метод

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.
Результат string The calendar id, or null if none.

getDriver() публичный статический метод

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.
Результат Kronolith_Driver The newly created concrete Kronolith_Driver instance.

getImagePart() публичный статический метод

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.
Результат Horde_Mime_Part A MIME part representing the image.

getInternalCalendar() публичный статический метод

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.
Результат Kronolith_Resource | Horde_Share_Object

getLabel() публичный статический метод

Attaches the owner name of shared calendars if necessary.
public static getLabel ( $calendar ) : string
Результат string The calendar's label.

getRemoteParams() публичный статический метод

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

getSyncCalendars() публичный статический метод

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.
Результат array An array of calendar ids

getTagger() публичный статический метод

Obtain a Kronolith_Tagger instance
public static getTagger ( ) : Kronolith_Tagger
Результат Kronolith_Tagger

getUserEmail() публичный статический метод

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

getUserName() публичный статический метод

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

getView() публичный статический метод

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() публичный статический метод

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.
Результат boolean True if the API can be accessed.

hasPermission() публичный статический метод

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.
Результат boolean True if the current user has the requested permissions.

initialize() публичный статический метод

Globals defined:
public static initialize ( )

isUserEmail() публичный статический метод

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() публичный статический метод

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.
Результат array The alarms active on the date. A hash with calendar names as keys and arrays of events or event ids as values.

listCalendars() публичный статический метод

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.
Результат array The calendar list.

listEvents() публичный статический метод

Returns all the events that happen each day within a time period
Устаревший:
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)
Результат array The events happening in this time period.

listInternalCalendars() публичный статический метод

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.
Результат array The calendar list.

listShareUsers() публичный статический метод

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.
Результат array A hash of share users.

mergeEvents() публичный статический метод

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() публичный статический метод

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

parseDate() публичный статический метод

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.
Результат Horde_Date The parsed date.

partToString() публичный статический метод

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.
Результат string The translated displayable attendee participation string.

permissionToJson() публичный статический метод

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?
Результат array A hash suitable for json.

quickAdd() публичный метод

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.
Результат array The UID of all events that were added.

randomColor() публичный статический метод

Returns a random CSS color.
public static randomColor ( ) : string
Результат string A random CSS color string.

readPermsForm() публичный статический метод

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.
Результат array A list of error messages.

recurToString() публичный статический метод

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.
Результат string The translated displayable recurrence value string.

removeUserEvents() публичный статический метод

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() публичный статический метод

Maps an iCalendar attendee response string to the corresponding Kronolith value.
public static responseFromICal ( string $response ) : string
$response string The attendee response.
Результат string The Kronolith response value.

responseToString() публичный статический метод

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.
Результат string The translated displayable attendee response string.

sendITipNotifications() публичный статический метод

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() публичный статический метод

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() публичный статический метод

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

sortEvents() публичный статический метод

Sorts an event list.
public static sortEvents ( array $days ) : array
$days array A list of days with events.
Результат array The sorted day list.

statusToString() публичный статический метод

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.
Результат string The translated displayable meeting status string.

subscribeRemoteCalendar() публичный статический метод

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 tabs ( object $renderer )
$renderer object A Kronolith view.

toTimeslice() публичный статический метод

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

unsubscribeRemoteCalendar() публичный статический метод

Unsubscribes from a remote calendar.
public static unsubscribeRemoteCalendar ( string $url ) : array
$url string The calendar URL.
Результат array Hash with the deleted calendar's information.

updateShare() публичный статический метод

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

validateUserAttendee() публичный статический метод

Return Kronolith_Attendee object for a local user.
public static validateUserAttendee ( string $user ) : mixed
$user string The local username.
Результат mixed Return the Kronolith_Attendee object for $user, or false if the auth backend supports user listing and the user is not found.

viewShowLocation() публичный статический метод

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

viewShowTime() публичный статический метод

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