PHP Класс Nag, horde

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Автор: Jon Parise ([email protected])
Автор: Chuck Hagenbuch ([email protected])
Автор: Jan Schneider ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
_rsortByAssignee ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by assignee.
_rsortByCompletion ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by completion status.
_rsortByDue ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by due date.
_rsortByEstimate ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by name.
_rsortByName ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by name.
_rsortByOwner ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by owner.
_rsortByPriority ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by priority.
_rsortByStart ( array $a, array $b ) : integer Comparison function for reverse sorting tasks by start date.
_sortByAssignee ( array $a, array $b ) : integer Comparison function for sorting tasks by assignee.
_sortByCompletion ( array $a, array $b ) : integer Comparison function for sorting tasks by completion status.
_sortByDue ( array $a, array $b ) : integer Comparison function for sorting tasks by due date.
_sortByEstimate ( array $a, array $b ) : integer Comparison function for sorting tasks by assignee.
_sortByName ( array $a, array $b ) : integer Comparison function for sorting tasks by name.
_sortByOwner ( array $a, array $b ) : integer Comparison function for sorting tasks by owner.
_sortByPriority ( array $a, array $b ) : integer Comparison function for sorting tasks by priority.
_sortByStart ( array $a, array $b ) : integer Comparison function for sorting tasks by start date.
addTasklist ( array $info, boolean $display = true ) : Horde_Share Creates a new share.
buildCheckboxWidget ( string $name, integer $checked ) : string Builds the HTML for a checkbox widget.
buildMimeMessage ( Horde_View $view, string $template, Horde_Mime_Part $image ) : Horde_Mime_Part Builds the body MIME part of a multipart message.
buildPriorityWidget ( string $name, integer $selected ) : string Builds the HTML for a priority selection widget.
countTasks ( ) : integer Returns the number of taks in task lists that the current user owns.
createTasksFromText ( string $text, string $tasklist = null ) : array Imports one or more tasks parsed from a string.
deleteTasklist ( Horde_Share_Object $tasklist ) Deletes a task list.
formatAlarm ( integer $value ) : string Returns the string matching the given alarm value.
formatAssignee ( string $assignee, boolean $link = false ) : string Returns the full name and a compose to message an assignee.
formatCompletion ( integer $completed ) : string Returns the string representation of the given completion status.
formatDate ( string $unixdate = '', boolean $hours = true ) : string Formats the given Unix-style date string.
formatOrganizer ( string $organizer, boolean $link = false ) : string Returns formatted string representing a task organizer.
formatPriority ( integer $priority ) : string Returns a colored representation of a priority.
getDefaultTasklist ( integer $permission = Horde_Perms::SHOW ) : string Returns the default tasklist for the current user at the specified permissions level.
getImagePart ( string $file ) : Horde_Mime_Part Returns a MIME part for an image to be embedded into a HTML document.
getLabel ( $tasklist ) : string Returns the label to be used for a task list.
getSyncLists ( ) : array Returns the tasklists that should be used for syncing.
getTask ( string $tasklist, string $task ) : Nag_Task Returns a single task.
getUrl ( integer $type, $tasklist ) : string Returns a DAV URL to be used for a task list.
getUserEmail ( $user )
getUserName ( string $uid ) : string Returns the real name, if available, of a user.
hasPermission ( string $tasklist, integer $perm ) : boolean Returns whether the current user has certain permissions on a tasklist.
initialize ( ) Initial app setup code.
listAlarms ( integer $date, array $tasklists = null ) : array Returns all the alarms active right on $date.
listTasklists ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW, boolean $smart = true ) : array Lists all task lists a user has access to.
listTasks ( array $options = [] ) : Nag_Task Retrieves the current user's task list from storage.
parseDate ( string $date, boolean $withtime = true ) : Horde_Date Parses a complete date-time string into a Horde_Date object.
randomColor ( ) : string Returns a random CSS color.
responseFromICal ( string $response ) : string Maps an iCalendar attendee response string to the corresponding Nag value.
secondsToString ( integer $seconds ) : string
sendITipNotifications ( Nag_Task $task, Horde_Notification_Handler $notification, integer $action, Horde_Date $instance = null, string $range = null ) Sends out iTip task notification to the assignee.
sendNotification ( string $action, Nag_Task $task, Nag_Task $old_task = null ) Sends email notifications that a task has been added, edited, or deleted to users that want such notifications.
status ( ) Trigger notifications.
updateTasklist ( Horde_Share_Object $tasklist, array $info ) Updates an existing share.

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

Метод Описание
_getOwner ( Nag_Task $task ) : string Returns the owner of a task.
_notificationPref ( string $user, string $mode, string $tasklist = null ) : boolean Returns whether a user wants email notifications for a tasklist.

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

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

Returns the owner of a task.
protected static _getOwner ( Nag_Task $task ) : string
$task Nag_Task A task.
Результат string The task's owner.

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

Returns whether a user wants email notifications for a tasklist.
protected static _notificationPref ( string $user, string $mode, string $tasklist = null ) : boolean
$user string A user name.
$mode string The check "mode". If "owner", the method checks if the user wants notifications only for tasklists he owns. If "read", the method checks if the user wants notifications for all tasklists he has read access to, or only for shown tasklists and the specified tasklist is currently shown.
$tasklist string The name of the tasklist if mode is "read".
Результат boolean True if the user wants notifications for the tasklist.

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

Comparison function for reverse sorting tasks by assignee.
public static _rsortByAssignee ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater; 0 if they are equal.

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

Comparison function for reverse sorting tasks by completion status.
public static _rsortByCompletion ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater; 0 if they are equal.

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

Comparison function for reverse sorting tasks by due date.
public static _rsortByDue ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater, 0 if they are equal.

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

Comparison function for reverse sorting tasks by name.
public static _rsortByEstimate ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater; 0 if they are equal.

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

Comparison function for reverse sorting tasks by name.
public static _rsortByName ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater; 0 if they are equal.

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

Comparison function for reverse sorting tasks by owner.
public static _rsortByOwner ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater; 0 if they are equal.

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

Comparison function for reverse sorting tasks by priority.
public static _rsortByPriority ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater; 0 if they are equal.

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

Comparison function for reverse sorting tasks by start date.
public static _rsortByStart ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer -1 if task one is greater, 1 if task two is greater, 0 if they are equal.

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

Comparison function for sorting tasks by assignee.
public static _sortByAssignee ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by completion status.
public static _sortByCompletion ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by due date.
public static _sortByDue ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by assignee.
public static _sortByEstimate ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by name.
public static _sortByName ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by owner.
public static _sortByOwner ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by priority.
public static _sortByPriority ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Comparison function for sorting tasks by start date.
public static _sortByStart ( array $a, array $b ) : integer
$a array Task one.
$b array Task two.
Результат integer 1 if task one is greater, -1 if task two is greater; 0 if they are equal.

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

Creates a new share.
public static addTasklist ( array $info, boolean $display = true ) : Horde_Share
$info array Hash with tasklist information.
$display boolean Add the new tasklist to display_tasklists
Результат Horde_Share The new share.

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

Builds the HTML for a checkbox widget.
public static buildCheckboxWidget ( string $name, integer $checked ) : string
$name string The name of the widget.
$checked integer The default checkbox state.
Результат string HTML for a checkbox representing the completion state.

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.

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

Builds the HTML for a priority selection widget.
public static buildPriorityWidget ( string $name, integer $selected ) : string
$name string The name of the widget.
$selected integer The default selected priority.
Результат string The HTML

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

Returns the number of taks in task lists that the current user owns.
public static countTasks ( ) : integer
Результат integer The number of tasks that the user owns.

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

Imports one or more tasks parsed from a string.
public static createTasksFromText ( string $text, string $tasklist = null ) : array
$text string The text to parse into
$tasklist string The tasklist into which the task will be imported. If 'null', the user's default tasklist will be used.
Результат array The UIDs of all tasks that were added.

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

Deletes a task list.
public static deleteTasklist ( Horde_Share_Object $tasklist )
$tasklist Horde_Share_Object The task list to delete.

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

Returns the string matching the given alarm value.
public static formatAlarm ( integer $value ) : string
$value integer The alarm value in minutes.
Результат string The formatted alarm string.

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

Returns the full name and a compose to message an assignee.
public static formatAssignee ( string $assignee, boolean $link = false ) : string
$assignee string The assignee's user name.
$link boolean Whether to link to an email compose screen.
Результат string The formatted assignee name.

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

Returns the string representation of the given completion status.
public static formatCompletion ( integer $completed ) : string
$completed integer The completion value.
Результат string The HTML representation of $completed.

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

Formats the given Unix-style date string.
public static formatDate ( string $unixdate = '', boolean $hours = true ) : string
$unixdate string The Unix-style date value to format.
$hours boolean Whether to add hours.
Результат string The formatted due date string.

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

Returns formatted string representing a task organizer.
public static formatOrganizer ( string $organizer, boolean $link = false ) : string
$organizer string The organinzer, as an email or mailto: format.
$link boolean Whether to link to an email compose screen.
Результат string The formatted organizer name.

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

Returns a colored representation of a priority.
public static formatPriority ( integer $priority ) : string
$priority integer The priority level.
Результат string The HTML representation of $priority.

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

Returns the default tasklist for the current user at the specified permissions level.
public static getDefaultTasklist ( integer $permission = Horde_Perms::SHOW ) : string
$permission integer Horde_Perms constant for permission level required.
Результат string The default tasklist or null if none.

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.

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

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

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

Returns the tasklists that should be used for syncing.
public static getSyncLists ( ) : array
Результат array An array of task list ids

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

Returns a single task.
public static getTask ( string $tasklist, string $task ) : Nag_Task
$tasklist string A tasklist.
$task string A task id.
Результат Nag_Task The task hash.

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

Returns a DAV URL to be used for a task list.
public static getUrl ( integer $type, $tasklist ) : string
$type integer A Nag::DAV_* constant.
Результат string The task list's URL.

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

public static getUserEmail ( $user )

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

Returns the real name, if available, of a user.
public static getUserName ( string $uid ) : string
$uid string The userid of the user to retrieve
Результат string The fullname of the user.

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

Returns whether the current user has certain permissions on a tasklist.
public static hasPermission ( string $tasklist, integer $perm ) : boolean
$tasklist string A tasklist id.
$perm integer A Horde_Perms permission mask.
Результат boolean True if the current user has the requested permissions.

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

Initial app setup code.
public static initialize ( )

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

Returns all the alarms active right on $date.
public static listAlarms ( integer $date, array $tasklists = null ) : array
$date integer The unix epoch time to check for alarms.
$tasklists array An array of tasklists
Результат array An array of Nag_Task objects with alarms active on $date.

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

Lists all task lists a user has access to.
public static listTasklists ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW, boolean $smart = true ) : array
$owneronly boolean Only return task lists that this user owns? Defaults to false.
$permission integer The permission to filter task lists by.
$smart boolean Include SmartLists in the results.
Результат array The task lists.

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

This function will also sort the resulting list, if requested.
public static listTasks ( array $options = [] ) : Nag_Task
$options array Options array: - altsortby: (string) The secondary sort field. Same values as sortdir. DEFAULT: altsortby pref is used. - completed: (integer) Which task to retrieve. A Nag::VIEW_* constant. DEFAULT: show_completed pref is used. - external: (boolean) Whether to include tasks from other applications too. DEFAULT: true. - include_history: (boolean) Autoload created/modified data from Horde_History. DEFAULT: true (Automatically load history data). - include_tags: (boolean) Autoload all tags. DEFAULT: false (Tags are lazy loaded as needed.) - sortby: (string) A Nag::SORT_* constant for the field to sort by. DEFAULT: sortby pref is used. - sortdir: (string) Direction of sort. NAG::SORT_ASCEND or NAG::SORT_DESCEND. DEFAULT: sortdir pref is used. - tasklists: (array) An array of tasklists to include. DEFAULT: Use $GLOBALS['display_tasklists'];
Результат Nag_Task A list of the requested tasks.

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

Parses a complete date-time string into a Horde_Date object.
public static parseDate ( string $date, boolean $withtime = true ) : Horde_Date
$date string The date-time string to parse.
$withtime boolean Whether time is included in the string.
Результат Horde_Date The parsed date.

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

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

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

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

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

public static secondsToString ( integer $seconds ) : string
$seconds integer
Результат string

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

Can be used to send task invitations, updates, and cancellations.
public static sendITipNotifications ( Nag_Task $task, Horde_Notification_Handler $notification, integer $action, Horde_Date $instance = null, string $range = null )
$task Nag_Task The task 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 Nag::ITIP_* values.
$instance Horde_Date If cancelling a single instance of a recurring task, the date of this instance.
$range string The range parameter if this is a recurring event. Possible values are self::RANGE_THISANDFUTURE

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

Sends email notifications that a task has been added, edited, or deleted to users that want such notifications.
public static sendNotification ( string $action, Nag_Task $task, Nag_Task $old_task = null )
$action string The event action. One of "add", "edit", or "delete".
$task Nag_Task The changed task.
$old_task Nag_Task The original task if $action is "edit".

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

Trigger notifications.
public static status ( )

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

Updates an existing share.
public static updateTasklist ( Horde_Share_Object $tasklist, array $info )
$tasklist Horde_Share_Object The share to update.
$info array Hash with task list information.