PHP Class Nag_Api, horde

This file defines Nag's external API interface. Other applications can interact with Nag through this API.
Inheritance: extends Horde_Registry_Api
Afficher le fichier Open project: horde/horde

Protected Properties

Свойство Type Description
$_links array Links.

Méthodes publiques

Méthode Description
addTask ( array $task ) Adds a task.
addTasklist ( string $name, string $description = '', string $color = '', array $params = [] ) : string Adds a new task list.
ajaxDefaults ( ) : array Returns a number of defaults necessary for the ajax view.
browse ( string $path = '', array $properties = [] ) : array Browse through Nag's object tree.
delete ( string | array $uid ) : boolean Deletes a task identified by UID.
deleteTask ( string $tasklist, string $id ) Deletes a task identified by tasklist and ID.
deleteTasklist ( string $id ) Deletes a task list.
export ( string $uid, string $contentType, array $options = [] ) : string Exports a task, identified by UID, in the requested content type.
exportTasklist ( string $tasklist, string $contentType ) : string Exports a tasklist in the requested content type.
getActionTimestamp ( string $uid, string $action, string $tasklist = null, boolean $modSeq = false ) : integer Returns the timestamp of an operation for a given uid an action.
getChanges ( integer $start, integer $end, boolean $isModSeq = false, string $tasklist = null ) : array Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.
getChangesByModSeq ( integer $start, integer $end, string $tasklist = null ) : array Return all changes occuring between the specified modification sequences.
getDefaultShare ( ) : string Retrieve the UID for the current user's default tasklist.
getDisplayedTasklists ( ) : array Returns the displayed task lists.
getHighestModSeq ( string $id = null ) : integer Return the largest modification sequence from the history backend.
getTask ( string $tasklist, string $id ) : Nag_Task Returns a task object.
getTasklist ( string $name ) : Horde_Share_Object Returns a task list.
import ( string $content, string $contentType, string $tasklist = null ) : string Imports one or more tasks represented in the specified content type.
listBy ( string $action, integer $timestamp, string $tasklist = null, integer $end = null, boolean $isModSeq = false ) : array Returns an array of UIDs for tasks that have had $action happen since $timestamp.
listCostObjects ( array $criteria ) CostObject API: Lists active tasks as cost objects.
listTagInfo ( array $tags = null, $user = null ) : array Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.
listTasklists ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW, boolean $smart = true ) : array Returns a list of task lists.
listTasks ( array $options = [] ) : array Retrieves the current user's task list from storage.
listTimeObjectCategories ( )
listTimeObjects ( array $categories, mixed $start, mixed $end ) Lists active tasks as time objects.
listUids ( mixed $tasklists = null ) : array Returns an array of UIDs for all tasks that the current user is authorized to see.
modified ( string $uid, string $tasklist = null ) : integer Returns the last modification timestamp of a given uid.
path_delete ( string $path ) : string Deletes a file from the Nag tree.
put ( string $path, string $content, string $content_type ) : array Saves a file into the Nag tree.
quickAdd ( string $text, string $tasklist = null ) : array Imports one or more tasks parsed from a string.
replace ( string $uid, string $content, string $contentType ) : boolean Replaces the task identified by UID with the content represented in the specified content type.
saveTimeObject ( array $timeobject ) Saves properties of a time object back to the task that it represents.
searchTags ( array $names, integer $max = 10, integer $from, string $resource_type = '', string $user = null, boolean $raw = false ) : array SearchTags API: Returns an application-agnostic array (useful for when doing a tag search across multiple applications)
setDisplayedTasklists ( array $list ) Sets the displayed task lists.
sources ( boolean $writeable = false, boolean $sync_only = false ) : array Returns a list of available sources.
toggleCompletion ( string $task_id, string $tasklist_id ) : boolean | string Toggles the task completion flag.
updateAttendee ( Horde_Icalendar_Vtodo $response, string $sender = null ) Updates an attendee's response status for a specified task assignment.
updateCostObject ( string $id, array $data ) CostObject API: Update a single costobject.
updateTask ( string $tasklist, string $id, array $task ) Changes a task identified by tasklist and ID.
updateTasklist ( string $name, array $info ) Updates an existing task list.

Method Details

addTask() public méthode

Adds a task.
public addTask ( array $task )
$task array A hash with task information.

addTasklist() public méthode

Adds a new task list.
public addTasklist ( string $name, string $description = '', string $color = '', array $params = [] ) : string
$name string Task list name.
$description string Task list description.
$color string Task list color.
$params array Any addtional parameters needed. @since 4.2.1 - synchronize: (boolean) If true, add task list to the list of task lists to syncronize. DEFAULT: false (do not add to the list).
Résultat string The new tasklist's id.

ajaxDefaults() public méthode

Returns a number of defaults necessary for the ajax view.
public ajaxDefaults ( ) : array
Résultat array A hash with default values.

browse() public méthode

Browse through Nag's object tree.
public browse ( string $path = '', array $properties = [] ) : array
$path string The level of the tree to browse.
$properties array The item properties to return. Defaults to 'name', 'icon', and 'browseable'.
Résultat array The contents of $path

delete() public méthode

Deletes a task identified by UID.
public delete ( string | array $uid ) : boolean
$uid string | array Identify the task to delete, either a single UID or an array.
Résultat boolean Success or failure.

deleteTask() public méthode

Deletes a task identified by tasklist and ID.
public deleteTask ( string $tasklist, string $id )
$tasklist string A tasklist id.
$id string A task id.

deleteTasklist() public méthode

Deletes a task list.
public deleteTasklist ( string $id )
$id string A task list id.

export() public méthode

Exports a task, identified by UID, in the requested content type.
public export ( string $uid, string $contentType, array $options = [] ) : string
$uid string Identify the task to export.
$contentType string What format should the data be in? A string with one of: - text/calendar: iCalendar 2.0. Recommended as this is specified in RFC 2445. - text/x-vcalendar: vCalendar 1.0 format. Still in wide use. - activesync: Horde_ActiveSync_Message_Task. - raw: Nag_Task.
$options array Any additional options for the exporter.
Résultat string The requested data.

exportTasklist() public méthode

Exports a tasklist in the requested content type.
public exportTasklist ( string $tasklist, string $contentType ) : string
$tasklist string The tasklist to export.
$contentType string What format should the data be in? A string with one of:
text/calendar (VCALENDAR 2.0. Recommended as
               this is specified in rfc2445)
text/x-vcalendar (old VCALENDAR 1.0 format.
                 Still in wide use)
Résultat string The iCalendar representation of the tasklist.

getActionTimestamp() public méthode

Returns the timestamp of an operation for a given uid an action.
public getActionTimestamp ( string $uid, string $action, string $tasklist = null, boolean $modSeq = false ) : integer
$uid string The uid to look for.
$action string The action to check for - add, modify, or delete.
$tasklist string The tasklist to be used. If 'null', the user's default tasklist will be used.
$modSeq boolean Request a modification sequence instead of a timestamp. @since 4.1.1
Résultat integer The timestamp for this action.

getChanges() public méthode

Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.
public getChanges ( integer $start, integer $end, boolean $isModSeq = false, string $tasklist = null ) : array
$start integer The starting timestamp
$end integer The ending timestamp.
$isModSeq boolean If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1
$tasklist string The sources to check. @since 4.2.0
Résultat array An hash with 'add', 'modify' and 'delete' arrays.

getChangesByModSeq() public méthode

Return all changes occuring between the specified modification sequences.
Since: 4.1.1
public getChangesByModSeq ( integer $start, integer $end, string $tasklist = null ) : array
$start integer The starting modseq.
$end integer The ending modseq.
$tasklist string The sources to check. @since 4.2.0
Résultat array The changes @see getChanges()

getDefaultShare() public méthode

Retrieve the UID for the current user's default tasklist.
Since: 4.2.0
public getDefaultShare ( ) : string
Résultat string UID.

getDisplayedTasklists() public méthode

Returns the displayed task lists.
public getDisplayedTasklists ( ) : array
Résultat array Displayed tasklists.

getHighestModSeq() public méthode

Return the largest modification sequence from the history backend.
Since: 4.1.1
public getHighestModSeq ( string $id = null ) : integer
$id string Limit the check to this tasklist. @since 4.2.0
Résultat integer The modseq.

getTask() public méthode

Returns a task object.
public getTask ( string $tasklist, string $id ) : Nag_Task
$tasklist string A tasklist id.
$id string A task id.
Résultat Nag_Task The matching task object.

getTasklist() public méthode

Returns a task list.
public getTasklist ( string $name ) : Horde_Share_Object
$name string A task list name.
Résultat Horde_Share_Object The task list.

import() public méthode

If a UID is present in the content and the task is already in the database, a replace is performed rather than an add.
public import ( string $content, string $contentType, string $tasklist = null ) : string
$content string The content of the task.
$contentType string What format is the data in? Currently supports: text/calendar text/x-vcalendar
$tasklist string The tasklist into which the task will be imported. If 'null', the user's default tasklist will be used.
Résultat string The new UID on one import, an array of UIDs on multiple imports,

listBy() public méthode

Returns an array of UIDs for tasks that have had $action happen since $timestamp.
public listBy ( string $action, integer $timestamp, string $tasklist = null, integer $end = null, boolean $isModSeq = false ) : array
$action string The action to check for - add, modify, or delete.
$timestamp integer The time to start the search.
$tasklist string The tasklist to be used. If 'null', the user's default tasklist will be used.
$end integer The optional ending timestamp.
$isModSeq boolean If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1
Résultat array An array of UIDs matching the action and time criteria.

listCostObjects() public méthode

CostObject API: Lists active tasks as cost objects.
public listCostObjects ( array $criteria )
$criteria array Filter attributes

listTagInfo() public méthode

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.
public listTagInfo ( array $tags = null, $user = null ) : array
$tags array An optional array of tag_ids. If omitted, all tags will be included.
Résultat array An array containing tag_name, and total

listTasklists() public méthode

Returns a list of task lists.
public listTasklists ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW, boolean $smart = true ) : array
$owneronly boolean Only return tasklists that this user owns? Defaults to false.
$permission integer The permission to filter tasklists by.
$smart boolean Include smart tasklists in results.
Résultat array The task lists.

listTasks() public méthode

This function will also sort the resulting list, if requested.
public listTasks ( array $options = [] ) : array
$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. DEFAULT: show_completed pref is used. - 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. - include_tags: (boolean) Autoload all tags. DEFAULT: false (Tags are lazy loaded as needed.) - json: (boolean) Return data as JSON. DEFAULT: false (Data is returned as Nag_Task) - tasklists: (array) An array of tasklists to include. DEFAULT: Use $GLOBALS['display_tasklists'];
Résultat array An array of the requested tasks.

listTimeObjectCategories() public méthode

listTimeObjects() public méthode

Lists active tasks as time objects.
public listTimeObjects ( array $categories, mixed $start, mixed $end )
$categories array The time categories (from listTimeObjectCategories) to list.
$start mixed The start date of the period.
$end mixed The end date of the period.

listUids() public méthode

Returns an array of UIDs for all tasks that the current user is authorized to see.
public listUids ( mixed $tasklists = null ) : array
$tasklists mixed The tasklist or an array of taskslists to list.
Résultat array An array of UIDs for all tasks the user can access.

modified() public méthode

Returns the last modification timestamp of a given uid.
public modified ( string $uid, string $tasklist = null ) : integer
$uid string The uid to look for.
$tasklist string The tasklist to look in.
Résultat integer The timestamp for the last modification of $uid.

path_delete() public méthode

Deletes a file from the Nag tree.
public path_delete ( string $path ) : string
$path string The path to the file.
Résultat string The event's UID

put() public méthode

Saves a file into the Nag tree.
public put ( string $path, string $content, string $content_type ) : array
$path string The path where to PUT the file.
$content string The file content.
$content_type string The file's content type.
Résultat array The event UIDs

quickAdd() public méthode

Imports one or more tasks parsed from a string.
public quickAdd ( 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.
Résultat array The UIDs of all tasks that were added.

replace() public méthode

If you want to replace multiple tasks with the UID specified in the VCALENDAR data, you may use $this->import instead. This automatically does a replace if existings UIDs are found.
public replace ( string $uid, string $content, string $contentType ) : boolean
$uid string Identify the task to replace.
$content string The content of the task.
$contentType string What format is the data in? Currently supports: - text/x-vcalendar - text/calendar
Résultat boolean Success or failure.

saveTimeObject() public méthode

At the moment only the title, description and due date are saved.
public saveTimeObject ( array $timeobject )
$timeobject array A time object hash.

searchTags() public méthode

The 'raw' results array can be returned instead by setting $raw = true.
public searchTags ( array $names, integer $max = 10, integer $from, string $resource_type = '', string $user = null, boolean $raw = false ) : array
$names array An array of tag_names to search for.
$max integer The maximum number of resources to return.
$from integer The number of the resource to start with.
$resource_type string The resource type [bookmark, '']
$user string Restrict results to resources owned by $user.
$raw boolean Return the raw data?
Résultat array An array of results:
 'title'    - The title for this resource.
 'desc'     - A terse description of this resource.
 'view_url' - The URL to view this resource.
 'app'      - The Horde application this resource belongs to.
 'icon'     - URL to an image.

setDisplayedTasklists() public méthode

Sets the displayed task lists.
public setDisplayedTasklists ( array $list )
$list array Displayed tasklists.

sources() public méthode

Returns a list of available sources.
Since: 4.2.0
public sources ( boolean $writeable = false, boolean $sync_only = false ) : array
$writeable boolean If true, limits to writeable sources.
$sync_only boolean Only include synchable address books.
Résultat array An array of the available sources. Keys are source IDs, values are source titles.

toggleCompletion() public méthode

Toggles the task completion flag.
public toggleCompletion ( string $task_id, string $tasklist_id ) : boolean | string
$task_id string The task ID.
$tasklist_id string The tasklist that contains the task.
Résultat boolean | string True if the task has been toggled, a due date if there are still incomplete recurrences, otherwise false.

updateAttendee() public méthode

Updates an attendee's response status for a specified task assignment.
public updateAttendee ( Horde_Icalendar_Vtodo $response, string $sender = null )
$response Horde_Icalendar_Vtodo A Horde_Icalendar_Vtodo object, with a valid UID attribute that points to an existing task. This is typically the vTodo portion of an iTip task-request response, with the attendee's response in an ATTENDEE parameter.
$sender string The email address of the person initiating the update. Attendees are only updated if this address matches.

updateCostObject() public méthode

CostObject API: Update a single costobject.
public updateCostObject ( string $id, array $data )
$id string The task id.
$data array The data to update. Currently support: -: hours The amount of hours to add to the existing actual hours.

updateTask() public méthode

Changes a task identified by tasklist and ID.
public updateTask ( string $tasklist, string $id, array $task )
$tasklist string A tasklist id.
$id string A task id.
$task array A hash with overwriting task information.

updateTasklist() public static méthode

Updates an existing task list.
public static updateTasklist ( string $name, array $info )
$name string A task list name.
$info array Hash with task list information.

Property Details