Properties

$id

$id : string

The task id.

Type

string

$tasklist

$tasklist : string

This task's tasklist id.

Type

string

$tasklist_name

$tasklist_name : string

This task's tasklist name.

Overrides the $tasklist's share name.

Type

string

$uid

$uid : string

The task uid.

Type

string

$owner

$owner : string

The task owner.

Type

string

$assignee

$assignee : string

The task assignee.

Type

string

$name

$name : string

The task title.

Type

string

$desc

$desc : string

The task decription.

Type

string

$start

$start : integer

The start date timestamp.

Type

integer

$due

$due : integer

The due date timestamp.

Type

integer

$recurrence

$recurrence : \Horde_Date_Recurrence

Recurrence rules for recurring tasks.

Type

\Horde_Date_Recurrence

$priority

$priority : integer

The task priority from 1 = highest to 5 = lowest.

Type

integer

$estimate

$estimate : float

The estimated task length.

Type

float

$actual

$actual : float

The actual task length.

Type

float

$completed

$completed : boolean

Whether the task is completed.

Type

boolean

$completed_date

$completed_date : integer

The completion date timestamp.

Type

integer

$created

$created : \Horde_Date

The creation time.

Type

\Horde_Date

$createdby

$createdby : string

The creator string.

Type

string

$modified

$modified : \Horde_Date

The last modification time.

Type

\Horde_Date

$modifiedby

$modifiedby : string

The last-modifier string.

Type

string

$alarm

$alarm : integer

The task alarm threshold in minutes.

Type

integer

$methods

$methods : array

The particular alarm methods overridden for this task.

Type

array

$snooze

$snooze : integer

Snooze minutes for this event's alarm.

Type

integer

$private

$private : boolean

Whether the task is private.

Type

boolean

$view_link

$view_link : string

URL to view the task.

Type

string

$complete_link

$complete_link : string

URL to complete the task.

Type

string

$edit_link

$edit_link : string

URL to edit the task.

Type

string

$delete_link

$delete_link : string

URL to delete the task.

Type

string

$parent_id

$parent_id : string

The parent task's id.

Type

string

$parent

$parent : \Nag_Task

The parent task.

Type

\Nag_Task

$children

$children : array

The sub-tasks.

Type

array

$indent

$indent : integer

This task's idention (child) level.

Type

integer

$lastChild

$lastChild : boolean

Whether this is the last sub-task.

Type

boolean

$internaltags

$internaltags : array

Task tags from the storage backend (e.g. Kolab)

Type

array

$organizer

$organizer : string

Task organizer

Type

string

$status

$status : integer

The assignment status of this task.

Type

integer

$

$ : \tags

array An array of tags this task is tagged with.

Type

\tags

$_storage

$_storage : \Nag_Driver

A storage driver.

Type

\Nag_Driver

$_inlist

$_inlist : boolean

Internal flag.

Type

boolean

$_pointer

$_pointer : integer

Internal pointer.

Type

integer

$_dict

$_dict : array

Task id => pointer dictionary.

Type

array

$_tags

$_tags : string

Task tags (lazy loaded).

Type

string

Methods

__construct()

__construct(\Nag_Driver  $storage = null, array  $task = null) 

Constructor.

Takes a hash and returns a nice wrapper around it.

Parameters

\Nag_Driver $storage

A storage driver.

array $task

A task hash.

__get()

__get(string  $name) : mixed

Getter.

Returns 'tags' property.

Parameters

string $name

Property name.

Returns

mixed —

Property value.

__set()

__set(string  $name, mixed  $value) 

Setter.

Parameters

string $name

Property name.

mixed $value

Property value.

__clone()

__clone() 

Deep clone so we can clone the child objects too.

merge()

merge(array  $task) 

Merges a task hash into this task object.

Parameters

array $task

A task hash.

orphan()

orphan() 

Disconnect this task from any child tasks. Used when building search result sets since child tasks will be re-added if they actually match the result, and there is no guarentee that a tasks's parent will be present in the result set.

save()

save() 

Saves this task in the storage backend.

Throws

\Nag_Exception

getParent()

getParent() : mixed

Returns the parent task of this task, if one exists.

Returns

mixed —

The parent task, null if none exists

add()

add(\Nag_Task  $task,   $replace = false) 

Adds a sub task to this task.

Parameters

\Nag_Task $task

A sub task.

$replace

loadChildren()

loadChildren(  $include_history = true) 

Loads all sub-tasks.

Parameters

$include_history

mergeChildren()

mergeChildren(array  $children) 

Merges an array of tasks into this task's children.

Parameters

array $children

A list of Nag_Tasks.

get()

get(string  $key) : \Nag_Task

Returns a sub task by its id.

The methods goes recursively through all sub tasks until it finds the searched task.

Parameters

string $key

A task id.

Returns

\Nag_Task

The searched task or null.

hasTasks()

hasTasks() : boolean

Returns whether this is a task (not a container) or contains any sub tasks.

Returns

boolean —

True if this is a task or has sub tasks.

hasSubTasks()

hasSubTasks() : boolean

Returns whether this task contains any sub tasks.

Returns

boolean —

True if this task has sub tasks.

childrenCompleted()

childrenCompleted() : boolean

Returns whether all sub tasks are completed.

Returns

boolean —

True if all sub tasks are completed.

childrenOverdue()

childrenOverdue() : boolean

Returns whether any tasks in the list are overdue.

Returns

boolean —

True if any task or sub tasks are overdue.

count()

count() : integer

Returns the number of tasks including this and any sub tasks.

Returns

integer —

The number of tasks and sub tasks.

estimation()

estimation() : integer

Returns the estimated length for this and any sub tasks.

Returns

integer —

The estimated length sum.

actuals()

actuals() : integer

Returns the actual length for this and any sub tasks.

Returns

integer —

The actual length sum.

recurs()

recurs() : boolean

Returns whether this task is a recurring task.

Returns

boolean —

True if this is a recurring task.

toggleComplete()

toggleComplete(  $ignore_children = false) 

Toggles completion status of this task. Moves a recurring task to the next occurence on completion. Enforces the rule that sub tasks must be completed before parent tasks.

Parameters

$ignore_children

getNextStart()

getNextStart() : \Horde_Date

Returns the next start date of this task.

Takes recurring tasks into account.

Returns

\Horde_Date —

The next start date.

getNextDue()

getNextDue() : \Horde_Date|null

Returns the next due date of this task.

Takes recurring tasks into account.

Returns

\Horde_Date|null —

The next due date or null if no due date.

getFormattedDescription()

getFormattedDescription() : string

Format the description - link URLs, etc.

Returns

string

reset()

reset() 

Resets the tasks iterator.

Call this each time before looping through the tasks.

hasTask()

hasTask(string  $taskId) : \Nag_Task|false

Return the task, if present anywhere in this tasklist, regardless of child depth.

Parameters

string $taskId

The task id we are looking for.

Returns

\Nag_Task|false —

The task object, if found. Otherwise false.

each()

each() 

Returns the next task iterating through all tasks and sub tasks.

Call reset() each time before looping through the tasks: $tasks->reset(); while ($task = $tasks->each() { ... }

getSlice()

getSlice(integer  $page, integer  $perpage = null) : \Nag_Task

Helper method for getting only a slice of the total tasks in this list.

Parameters

integer $page

The starting page.

integer $perpage

The count of tasks per page.

Returns

\Nag_Task

The resulting task list.

process()

process(integer  $indent = null) 

Processes a list of tasks by adding action links, obscuring details of private tasks and calculating indentation.

Parameters

integer $indent

The indention level of the tasks.

backgroundColor()

backgroundColor() : string

Returns the background color.

Returns

string —

A HTML color code.

foregroundColor()

foregroundColor() : string

Returns the foreground color.

Returns

string —

A HTML color code.

treeIcons()

treeIcons() : string

Returns the HTML code for any tree icons, when displaying this task in a tree view.

Returns

string —

The HTML code for necessary tree icons.

loadTags()

loadTags() 

Recursively loads tags for all tasks contained in this object.

synchronizeTags()

synchronizeTags(array  $tags) 

Syncronizes tags from the tagging backend with the task storage backend, if necessary.

Parameters

array $tags

Tags from the tagging backend.

sort()

sort(string  $sortby, integer  $sortdir, string  $altsortby) 

Sorts sub tasks by the given criteria.

Parameters

string $sortby

The field by which to sort (Nag::SORT_PRIORITY, Nag::SORT_NAME Nag::SORT_DUE, Nag::SORT_COMPLETION).

integer $sortdir

The direction by which to sort (Nag::SORT_ASCEND, Nag::SORT_DESCEND).

string $altsortby

The secondary sort field.

toHash()

toHash() : array

Returns a hash representation for this task.

Returns

array —

A task hash.

toJson()

toJson(boolean  $full = false, string  $time_format = 'H:i') : object

Returns a simple object suitable for json transport representing this task.

Parameters

boolean $full

Whether to return all task details.

string $time_format

The date() format to use for time formatting.

Returns

object —

A simple object.

toAlarm()

toAlarm(string  $user = null, \Prefs  $prefs = null) : array

Returns an alarm hash of this task suitable for Horde_Alarm.

Parameters

string $user

The user to return alarms for.

\Prefs $prefs

A Prefs instance.

Returns

array —

Alarm hash or null.

toiCalendar()

toiCalendar(\Horde_Icalendar  $calendar) : \Horde_Icalendar_Vtodo

Exports this task in iCalendar format.

Parameters

\Horde_Icalendar $calendar

A Horde_Icalendar object that acts as the container.

Returns

\Horde_Icalendar_Vtodo —

A vtodo component of this task.

toASTask()

toASTask(array  $options = array()) : \Horde_ActiveSync_Message_Task

Create an AS message from this task

Parameters

array $options

Options:

  • protocolversion: (float) The EAS version to support DEFAULT: 2.5
  • bodyprefs: (array) A BODYPREFERENCE array. DEFAULT: none (No body prefs enforced).
  • truncation: (integer) Truncate event body to this length DEFAULT: none (No truncation).

Returns

\Horde_ActiveSync_Message_Task

fromiCalendar()

fromiCalendar(\Horde_Icalendar_Vtodo  $vTodo) 

Creates a task from a Horde_Icalendar_Vtodo object.

Parameters

\Horde_Icalendar_Vtodo $vTodo

The iCalendar data to update from.

fromASTask()

fromASTask(\Horde_ActiveSync_Message_Task  $message) 

Create a nag Task object from an activesync message

Parameters

\Horde_ActiveSync_Message_Task $message

The task object