PHP Class Nag_Task, 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: Jan Schneider ([email protected])
Exibir arquivo Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$actual float The actual task length.
$alarm integer The task alarm threshold in minutes.
$assignee string The task assignee.
$children array The sub-tasks.
$complete_link string URL to complete the task.
$completed boolean Whether the task is completed.
$completed_date integer The completion date timestamp.
$created Horde_Date The creation time.
$createdby string The creator string.
$delete_link string URL to delete the task.
$desc string The task decription.
$due integer The due date timestamp.
$edit_link string URL to edit the task.
$estimate float The estimated task length.
$id string The task id.
$indent integer This task's idention (child) level.
$internaltags array Task tags from the storage backend (e.g. Kolab)
$lastChild boolean Whether this is the last sub-task.
$methods array The particular alarm methods overridden for this task.
$modified Horde_Date The last modification time.
$modifiedby string The last-modifier string.
$name string The task title.
$organizer string Task organizer
$owner string The task owner.
$parent Nag_Task The parent task.
$parent_id string The parent task's id.
$priority integer The task priority from 1 = highest to 5 = lowest.
$private boolean Whether the task is private.
$recurrence Horde_Date_Recurrence Recurrence rules for recurring tasks.
$snooze integer Snooze minutes for this event's alarm.
$start integer The start date timestamp.
$status integer The assignment status of this task.
$tasklist string This task's tasklist id.
$tasklist_name string Overrides the $tasklist's share name.
$uid string The task uid.
$view_link string URL to view the task.

Protected Properties

Property Type Description
$_dict array Task id => pointer dictionary.
$_inlist boolean Internal flag.
$_pointer integer Internal pointer.
$_storage Nag_Driver A storage driver.
$_tags string Task tags (lazy loaded).

Public Methods

Method Description
__clone ( ) Deep clone so we can clone the child objects too.
__construct ( Nag_Driver $storage = null, array $task = null ) Constructor.
__get ( string $name ) : mixed Getter.
__set ( string $name, mixed $value ) Setter.
actuals ( ) : integer Returns the actual length for this and any sub tasks.
add ( Nag_Task $task, $replace = false ) Adds a sub task to this task.
backgroundColor ( ) : string Returns the background color.
childrenCompleted ( ) : boolean Returns whether all sub tasks are completed.
childrenOverdue ( ) : boolean Returns whether any tasks in the list are overdue.
count ( ) : integer Returns the number of tasks including this and any sub tasks.
each ( ) Returns the next task iterating through all tasks and sub tasks.
estimation ( ) : integer Returns the estimated length for this and any sub tasks.
foregroundColor ( ) : string Returns the foreground color.
fromASTask ( Horde_ActiveSync_Message_Task $message ) Create a nag Task object from an activesync message
fromiCalendar ( Horde_Icalendar_Vtodo $vTodo ) Creates a task from a Horde_Icalendar_Vtodo object.
get ( string $key ) : Nag_Task Returns a sub task by its id.
getFormattedDescription ( ) : string Format the description - link URLs, etc.
getNextDue ( ) : Horde_Date | null Returns the next due date of this task.
getNextStart ( ) : Horde_Date Returns the next start date of this task.
getParent ( ) : mixed Returns the parent task of this task, if one exists.
getSlice ( integer $page, integer $perpage = null ) : Nag_Task Helper method for getting only a slice of the total tasks in this list.
hasSubTasks ( ) : boolean Returns whether this task contains any sub tasks.
hasTask ( string $taskId ) : Nag_Task | false Return the task, if present anywhere in this tasklist, regardless of child depth.
hasTasks ( ) : boolean Returns whether this is a task (not a container) or contains any sub tasks.
loadChildren ( $include_history = true ) Loads all sub-tasks.
loadTags ( ) Recursively loads tags for all tasks contained in this object.
merge ( array $task ) Merges a task hash into this task object.
mergeChildren ( array $children ) Merges an array of tasks into this task's children.
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.
process ( integer $indent = null ) Processes a list of tasks by adding action links, obscuring details of private tasks and calculating indentation.
recurs ( ) : boolean Returns whether this task is a recurring task.
reset ( ) Resets the tasks iterator.
save ( ) Saves this task in the storage backend.
sort ( string $sortby, integer $sortdir, string $altsortby ) Sorts sub tasks by the given criteria.
synchronizeTags ( array $tags ) Syncronizes tags from the tagging backend with the task storage backend, if necessary.
toASTask ( array $options = [] ) : Horde_ActiveSync_Message_Task Create an AS message from this task
toAlarm ( string $user = null, Prefs $prefs = null ) : array Returns an alarm hash of this task suitable for Horde_Alarm.
toHash ( ) : array Returns a hash representation for this task.
toJson ( boolean $full = false, string $time_format = 'H:i' ) : object Returns a simple object suitable for json transport representing this task.
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.
toiCalendar ( Horde_Icalendar $calendar ) : Horde_Icalendar_Vtodo Exports this task in iCalendar format.
treeIcons ( ) : string Returns the HTML code for any tree icons, when displaying this task in a tree view.

Method Details

__clone() public method

Deep clone so we can clone the child objects too.
public __clone ( )

__construct() public method

Takes a hash and returns a nice wrapper around it.
public __construct ( Nag_Driver $storage = null, array $task = null )
$storage Nag_Driver A storage driver.
$task array A task hash.

__get() public method

Returns 'tags' property.
public __get ( string $name ) : mixed
$name string Property name.
return mixed Property value.

__set() public method

Setter.
public __set ( string $name, mixed $value )
$name string Property name.
$value mixed Property value.

actuals() public method

Returns the actual length for this and any sub tasks.
public actuals ( ) : integer
return integer The actual length sum.

add() public method

Adds a sub task to this task.
public add ( Nag_Task $task, $replace = false )
$task Nag_Task A sub task.

backgroundColor() public method

Returns the background color.
public backgroundColor ( ) : string
return string A HTML color code.

childrenCompleted() public method

Returns whether all sub tasks are completed.
public childrenCompleted ( ) : boolean
return boolean True if all sub tasks are completed.

childrenOverdue() public method

Returns whether any tasks in the list are overdue.
public childrenOverdue ( ) : boolean
return boolean True if any task or sub tasks are overdue.

count() public method

Returns the number of tasks including this and any sub tasks.
public count ( ) : integer
return integer The number of tasks and sub tasks.

each() public method

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

estimation() public method

Returns the estimated length for this and any sub tasks.
public estimation ( ) : integer
return integer The estimated length sum.

foregroundColor() public method

Returns the foreground color.
public foregroundColor ( ) : string
return string A HTML color code.

fromASTask() public method

Create a nag Task object from an activesync message
public fromASTask ( Horde_ActiveSync_Message_Task $message )
$message Horde_ActiveSync_Message_Task The task object

fromiCalendar() public method

Creates a task from a Horde_Icalendar_Vtodo object.
public fromiCalendar ( Horde_Icalendar_Vtodo $vTodo )
$vTodo Horde_Icalendar_Vtodo The iCalendar data to update from.

get() public method

The methods goes recursively through all sub tasks until it finds the searched task.
public get ( string $key ) : Nag_Task
$key string A task id.
return Nag_Task The searched task or null.

getFormattedDescription() public method

Format the description - link URLs, etc.
public getFormattedDescription ( ) : string
return string

getNextDue() public method

Takes recurring tasks into account.
public getNextDue ( ) : Horde_Date | null
return Horde_Date | null The next due date or null if no due date.

getNextStart() public method

Takes recurring tasks into account.
public getNextStart ( ) : Horde_Date
return Horde_Date The next start date.

getParent() public method

Returns the parent task of this task, if one exists.
public getParent ( ) : mixed
return mixed The parent task, null if none exists

getSlice() public method

Helper method for getting only a slice of the total tasks in this list.
public getSlice ( integer $page, integer $perpage = null ) : Nag_Task
$page integer The starting page.
$perpage integer The count of tasks per page.
return Nag_Task The resulting task list.

hasSubTasks() public method

Returns whether this task contains any sub tasks.
public hasSubTasks ( ) : boolean
return boolean True if this task has sub tasks.

hasTask() public method

Return the task, if present anywhere in this tasklist, regardless of child depth.
public hasTask ( string $taskId ) : Nag_Task | false
$taskId string The task id we are looking for.
return Nag_Task | false The task object, if found. Otherwise false.

hasTasks() public method

Returns whether this is a task (not a container) or contains any sub tasks.
public hasTasks ( ) : boolean
return boolean True if this is a task or has sub tasks.

loadChildren() public method

Loads all sub-tasks.
public loadChildren ( $include_history = true )

loadTags() public method

Recursively loads tags for all tasks contained in this object.
public loadTags ( )

merge() public method

Merges a task hash into this task object.
public merge ( array $task )
$task array A task hash.

mergeChildren() public method

Merges an array of tasks into this task's children.
public mergeChildren ( array $children )
$children array A list of Nag_Tasks.

orphan() public method

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.
public orphan ( )

process() public method

Processes a list of tasks by adding action links, obscuring details of private tasks and calculating indentation.
public process ( integer $indent = null )
$indent integer The indention level of the tasks.

recurs() public method

Returns whether this task is a recurring task.
public recurs ( ) : boolean
return boolean True if this is a recurring task.

reset() public method

Call this each time before looping through the tasks.
See also: each()
public reset ( )

save() public method

Saves this task in the storage backend.
public save ( )

sort() public method

Sorts sub tasks by the given criteria.
public sort ( string $sortby, integer $sortdir, string $altsortby )
$sortby string The field by which to sort (Nag::SORT_PRIORITY, Nag::SORT_NAME Nag::SORT_DUE, Nag::SORT_COMPLETION).
$sortdir integer The direction by which to sort (Nag::SORT_ASCEND, Nag::SORT_DESCEND).
$altsortby string The secondary sort field.

synchronizeTags() public method

Syncronizes tags from the tagging backend with the task storage backend, if necessary.
public synchronizeTags ( array $tags )
$tags array Tags from the tagging backend.

toASTask() public method

Create an AS message from this task
public toASTask ( array $options = [] ) : Horde_ActiveSync_Message_Task
$options array 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).
return Horde_ActiveSync_Message_Task

toAlarm() public method

Returns an alarm hash of this task suitable for Horde_Alarm.
public toAlarm ( string $user = null, Prefs $prefs = null ) : array
$user string The user to return alarms for.
$prefs Prefs A Prefs instance.
return array Alarm hash or null.

toHash() public method

Returns a hash representation for this task.
public toHash ( ) : array
return array A task hash.

toJson() public method

Returns a simple object suitable for json transport representing this task.
public toJson ( boolean $full = false, string $time_format = 'H:i' ) : object
$full boolean Whether to return all task details.
$time_format string The date() format to use for time formatting.
return object A simple object.

toggleComplete() public method

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.
public toggleComplete ( $ignore_children = false )

toiCalendar() public method

Exports this task in iCalendar format.
public toiCalendar ( Horde_Icalendar $calendar ) : Horde_Icalendar_Vtodo
$calendar Horde_Icalendar A Horde_Icalendar object that acts as the container.
return Horde_Icalendar_Vtodo A vtodo component of this task.

treeIcons() public method

Returns the HTML code for any tree icons, when displaying this task in a tree view.
public treeIcons ( ) : string
return string The HTML code for necessary tree icons.

Property Details

$_dict protected_oe property

Task id => pointer dictionary.
protected array $_dict
return array

$_inlist protected_oe property

Internal flag.
See also: each()
protected bool $_inlist
return boolean

$_pointer protected_oe property

Internal pointer.
See also: each()
protected int $_pointer
return integer

$_storage protected_oe property

A storage driver.
protected Nag_Driver $_storage
return Nag_Driver

$_tags protected_oe property

Task tags (lazy loaded).
protected string $_tags
return string

$actual public_oe property

The actual task length.
public float $actual
return float

$alarm public_oe property

The task alarm threshold in minutes.
public int $alarm
return integer

$assignee public_oe property

The task assignee.
public string $assignee
return string

$children public_oe property

The sub-tasks.
public array $children
return array

$completed public_oe property

Whether the task is completed.
public bool $completed
return boolean

$completed_date public_oe property

The completion date timestamp.
public int $completed_date
return integer

$created public_oe property

The creation time.
public Horde_Date $created
return Horde_Date

$createdby public_oe property

The creator string.
public string $createdby
return string

$desc public_oe property

The task decription.
public string $desc
return string

$due public_oe property

The due date timestamp.
public int $due
return integer

$estimate public_oe property

The estimated task length.
public float $estimate
return float

$id public_oe property

The task id.
public string $id
return string

$indent public_oe property

This task's idention (child) level.
public int $indent
return integer

$internaltags public_oe property

Task tags from the storage backend (e.g. Kolab)
public array $internaltags
return array

$lastChild public_oe property

Whether this is the last sub-task.
public bool $lastChild
return boolean

$methods public_oe property

The particular alarm methods overridden for this task.
public array $methods
return array

$modified public_oe property

The last modification time.
public Horde_Date $modified
return Horde_Date

$modifiedby public_oe property

The last-modifier string.
public string $modifiedby
return string

$name public_oe property

The task title.
public string $name
return string

$organizer public_oe property

Task organizer
public string $organizer
return string

$owner public_oe property

The task owner.
public string $owner
return string

$parent public_oe property

The parent task.
public Nag_Task $parent
return Nag_Task

$parent_id public_oe property

The parent task's id.
public string $parent_id
return string

$priority public_oe property

The task priority from 1 = highest to 5 = lowest.
public int $priority
return integer

$private public_oe property

Whether the task is private.
public bool $private
return boolean

$recurrence public_oe property

Recurrence rules for recurring tasks.
public Horde_Date_Recurrence $recurrence
return Horde_Date_Recurrence

$snooze public_oe property

Snooze minutes for this event's alarm.
See also: Horde_Alarm::snooze()
public int $snooze
return integer

$start public_oe property

The start date timestamp.
public int $start
return integer

$status public_oe property

The assignment status of this task.
public int $status
return integer

$tasklist public_oe property

This task's tasklist id.
public string $tasklist
return string

$tasklist_name public_oe property

Overrides the $tasklist's share name.
public string $tasklist_name
return string

$uid public_oe property

The task uid.
public string $uid
return string