\Nag_Driver

Nag_Driver:: defines an API for implementing storage backends for Nag.

See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.

Summary

Methods
Properties
Constants
__construct()
listAlarms()
open()
add()
modify()
delete()
deleteAll()
retrieve()
getChildren()
get()
getByUID()
synchronize()
$tasks
No constants found
_add()
_modify()
_updateTags()
_addTags()
$_tasklist
$_params
$_errormsg
N/A
No private methods found
No private properties found
N/A

Properties

$tasks

$tasks : \Nag_Task

A Nag_Task instance holding the current task list.

Type

\Nag_Task

$_tasklist

$_tasklist : string

String containing the current tasklist.

Type

string

$_params

$_params : array

Hash containing connection parameters.

Type

array

$_errormsg

$_errormsg : string

An error message to throw when something is wrong.

Type

string

Methods

__construct()

__construct(array  $params = array(), string  $errormsg = null) : \Nag_Driver

Constructor - just store the $params in our newly-created object. All other work is done by initialize().

Parameters

array $params

Any parameters needed for this driver.

string $errormsg

Custom error message

Returns

\Nag_Driver

listAlarms()

listAlarms(integer  $date) : array

List all alarms near $date.

Parameters

integer $date

The unix epoch time to check for alarms.

Returns

array —

An array of tasks that have alarms that match.

open()

open(string  $tasklist) 

Sets the currently open tasklist.

Parameters

string $tasklist

The tasklist.

add()

add(array  $task) : array

Adds a task and handles notification.

Parameters

array $task

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.

Returns

array —

array(ID,UID) of new task

modify()

modify(string  $taskId, array  $properties) 

Modifies an existing task and handles notification.

Parameters

string $taskId

The task to modify.

array $properties

A hash with properties. @see add().

Throws

\Nag_Exception

delete()

delete(string  $taskId) 

Deletes a task and handles notification.

Parameters

string $taskId

The task to delete.

deleteAll()

deleteAll() 

Deletes all tasks for the current task list.

Throws

\Nag_Exception

retrieve()

retrieve() 

Retrieves tasks from the database.

Throws

\Nag_Exception

getChildren()

getChildren(string  $parentId, boolean  $include_history = true) : array

Retrieves sub-tasks from the database.

Parameters

string $parentId

The parent id for the sub-tasks to retrieve.

boolean $include_history

Include created/modified info?

Throws

\Nag_Exception

Returns

array —

List of sub-tasks.

get()

get(string  $taskId) : \Nag_Task

Retrieves one task from the database.

Parameters

string $taskId

The id of the task to retrieve.

Throws

\Nag_Exception

Returns

\Nag_Task

A Nag_Task object.

getByUID()

getByUID(  $uids, array  $tasklists = null, boolean  $getall = true) : \Nag_Task

Retrieves one or multiple tasks from the database by UID.

Parameters

$uids
array $tasklists

An optional array of tasklists to search.

boolean $getall

If true, return all instances of the task, otherwise only one. Attempts to find the instance owned by the current user.

Throws

\Horde_Exception_NotFound
\Nag_Exception

Returns

\Nag_Task

A Nag_Task object.

synchronize()

synchronize(mixed  $token = false) 

Synchronize with the Kolab backend.

Parameters

mixed $token

A value indicating the last synchronization point, if available.

_add()

_add(array  $task) 

Parameters

array $task

_modify()

_modify(  $taskId, array  $task) 

Parameters

$taskId
array $task

_updateTags()

_updateTags(array  $task) 

Helper function to update an existing event's tags to tagger storage.

Parameters

array $task

The task to update

_addTags()

_addTags(array  $task) 

Helper function to add tags from a newly created event to the tagger.

Parameters

array $task

The task to save tags to storage for.