PHP Class Nag_Driver, horde

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Author: Jon Parise ([email protected])
Author: Jan Schneider ([email protected])
显示文件 Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$tasks Nag_Task A Nag_Task instance holding the current task list.

Protected Properties

Property Type Description
$_errormsg string An error message to throw when something is wrong.
$_params array Hash containing connection parameters.
$_tasklist string String containing the current tasklist.

Public Methods

Method Description
__construct ( array $params = [], string $errormsg = null ) : Nag_Driver Constructor - just store the $params in our newly-created object. All other work is done by initialize().
add ( array $task ) : array Adds a task and handles notification.
delete ( string $taskId ) Deletes a task and handles notification.
deleteAll ( ) Deletes all tasks for the current task list.
get ( string $taskId ) : Nag_Task Retrieves one task from the database.
getByUID ( $uids, array $tasklists = null, boolean $getall = true ) : Nag_Task Retrieves one or multiple tasks from the database by UID.
getChildren ( string $parentId, boolean $include_history = true ) : array Retrieves sub-tasks from the database.
listAlarms ( integer $date ) : array List all alarms near $date.
modify ( string $taskId, array $properties ) Modifies an existing task and handles notification.
open ( string $tasklist ) Sets the currently open tasklist.
retrieve ( ) Retrieves tasks from the database.
synchronize ( mixed $token = false ) Synchronize with the Kolab backend.

Protected Methods

Method Description
_add ( array $task )
_addTags ( array $task ) Helper function to add tags from a newly created event to the tagger.
_modify ( $taskId, array $task )
_updateTags ( array $task ) Helper function to update an existing event's tags to tagger storage.

Method Details

__construct() public method

Constructor - just store the $params in our newly-created object. All other work is done by initialize().
public __construct ( array $params = [], string $errormsg = null ) : Nag_Driver
$params array Any parameters needed for this driver.
$errormsg string Custom error message
return Nag_Driver

_add() abstract protected method

See also: add()
abstract protected _add ( array $task )
$task array

_addTags() protected method

Helper function to add tags from a newly created event to the tagger.
protected _addTags ( array $task )
$task array The task to save tags to storage for.

_modify() abstract protected method

See also: modify()
abstract protected _modify ( $taskId, array $task )
$task array

_updateTags() protected method

Helper function to update an existing event's tags to tagger storage.
protected _updateTags ( array $task )
$task array The task to update

add() public method

Adds a task and handles notification.
public add ( array $task ) : array
$task array A hash with the following possible properties: - desc: (string) The description (long) of the task. - name: (string) The name (short) of the task. - actual: (OPTIONAL, float) The actual time spent on the task. - alarm: (OPTIONAL, integer) The alarm associated with the task. - assignee: (OPTIONAL, string) The assignee of the event. - completed: (OPTIONAL, integer) The completion state of the task. - completed_date: (OPTIONAL, integer) The task's completion date. - due: (OPTIONAL, integer) The due date of the task. - estimate: (OPTIONAL, float) The estimated time to complete the task. - methods: (OPTIONAL, array) The overridden alarm notification methods. - owner: (OPTIONAL, string) The owner of the event. - parent: (OPTIONAL, string) The parent task. - priority: (OPTIONAL, integer) The priority of the task. - private: (OPTIONAL, boolean) Whether the task is private. - recurrence: (OPTIONAL, Horde_Date_Recurrence|array) Recurrence information. - start: (OPTIONAL, integer) The start date of the task. - tags: (OPTIONAL, string) The comma delimited list of tags. - uid: (OPTIONAL, string) A Unique Identifier for the task.
return array array(ID,UID) of new task

delete() public method

Deletes a task and handles notification.
public delete ( string $taskId )
$taskId string The task to delete.

deleteAll() public method

Deletes all tasks for the current task list.
public deleteAll ( )

get() public method

Retrieves one task from the database.
public get ( string $taskId ) : Nag_Task
$taskId string The id of the task to retrieve.
return Nag_Task A Nag_Task object.

getByUID() public method

Retrieves one or multiple tasks from the database by UID.
public getByUID ( $uids, array $tasklists = null, boolean $getall = true ) : Nag_Task
$tasklists array An optional array of tasklists to search.
$getall boolean If true, return all instances of the task, otherwise only one. Attempts to find the instance owned by the current user.
return Nag_Task A Nag_Task object.

getChildren() public method

Retrieves sub-tasks from the database.
public getChildren ( string $parentId, boolean $include_history = true ) : array
$parentId string The parent id for the sub-tasks to retrieve.
$include_history boolean Include created/modified info?
return array List of sub-tasks.

listAlarms() public method

List all alarms near $date.
public listAlarms ( integer $date ) : array
$date integer The unix epoch time to check for alarms.
return array An array of tasks that have alarms that match.

modify() public method

Modifies an existing task and handles notification.
public modify ( string $taskId, array $properties )
$taskId string The task to modify.
$properties array A hash with properties. @see add().

open() public method

Sets the currently open tasklist.
public open ( string $tasklist )
$tasklist string The tasklist.

retrieve() public method

Retrieves tasks from the database.
public retrieve ( )

synchronize() public method

Synchronize with the Kolab backend.
public synchronize ( mixed $token = false )
$token mixed A value indicating the last synchronization point, if available.

Property Details

$_errormsg protected_oe property

An error message to throw when something is wrong.
protected string $_errormsg
return string

$_params protected_oe property

Hash containing connection parameters.
protected array $_params
return array

$_tasklist protected_oe property

String containing the current tasklist.
protected string $_tasklist
return string

$tasks public_oe property

A Nag_Task instance holding the current task list.
public Nag_Task $tasks
return Nag_Task