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])
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Свойство 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

Свойство 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).

Méthodes publiques

Méthode 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 méthode

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

__construct() public méthode

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 méthode

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

__set() public méthode

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

actuals() public méthode

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

add() public méthode

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

backgroundColor() public méthode

Returns the background color.
public backgroundColor ( ) : string
Résultat string A HTML color code.

childrenCompleted() public méthode

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

childrenOverdue() public méthode

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

count() public méthode

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

each() public méthode

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

estimation() public méthode

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

foregroundColor() public méthode

Returns the foreground color.
public foregroundColor ( ) : string
Résultat string A HTML color code.

fromASTask() public méthode

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 méthode

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 méthode

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.
Résultat Nag_Task The searched task or null.

getFormattedDescription() public méthode

Format the description - link URLs, etc.
public getFormattedDescription ( ) : string
Résultat string

getNextDue() public méthode

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

getNextStart() public méthode

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

getParent() public méthode

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

getSlice() public méthode

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.
Résultat Nag_Task The resulting task list.

hasSubTasks() public méthode

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

hasTask() public méthode

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.
Résultat Nag_Task | false The task object, if found. Otherwise false.

hasTasks() public méthode

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

loadChildren() public méthode

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

loadTags() public méthode

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

merge() public méthode

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

mergeChildren() public méthode

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

orphan() public méthode

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 méthode

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 méthode

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

reset() public méthode

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

save() public méthode

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

sort() public méthode

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 méthode

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 méthode

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).
Résultat Horde_ActiveSync_Message_Task

toAlarm() public méthode

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.
Résultat array Alarm hash or null.

toHash() public méthode

Returns a hash representation for this task.
public toHash ( ) : array
Résultat array A task hash.

toJson() public méthode

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.
Résultat object A simple object.

toggleComplete() public méthode

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 méthode

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.
Résultat Horde_Icalendar_Vtodo A vtodo component of this task.

treeIcons() public méthode

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

Property Details

$_dict protected_oe property

Task id => pointer dictionary.
protected array $_dict
Résultat array

$_inlist protected_oe property

Internal flag.
See also: each()
protected bool $_inlist
Résultat boolean

$_pointer protected_oe property

Internal pointer.
See also: each()
protected int $_pointer
Résultat integer

$_storage protected_oe property

A storage driver.
protected Nag_Driver $_storage
Résultat Nag_Driver

$_tags protected_oe property

Task tags (lazy loaded).
protected string $_tags
Résultat string

$actual public_oe property

The actual task length.
public float $actual
Résultat float

$alarm public_oe property

The task alarm threshold in minutes.
public int $alarm
Résultat integer

$assignee public_oe property

The task assignee.
public string $assignee
Résultat string

$children public_oe property

The sub-tasks.
public array $children
Résultat array

$completed public_oe property

Whether the task is completed.
public bool $completed
Résultat boolean

$completed_date public_oe property

The completion date timestamp.
public int $completed_date
Résultat integer

$created public_oe property

The creation time.
public Horde_Date $created
Résultat Horde_Date

$createdby public_oe property

The creator string.
public string $createdby
Résultat string

$desc public_oe property

The task decription.
public string $desc
Résultat string

$due public_oe property

The due date timestamp.
public int $due
Résultat integer

$estimate public_oe property

The estimated task length.
public float $estimate
Résultat float

$id public_oe property

The task id.
public string $id
Résultat string

$indent public_oe property

This task's idention (child) level.
public int $indent
Résultat integer

$internaltags public_oe property

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

$lastChild public_oe property

Whether this is the last sub-task.
public bool $lastChild
Résultat boolean

$methods public_oe property

The particular alarm methods overridden for this task.
public array $methods
Résultat array

$modified public_oe property

The last modification time.
public Horde_Date $modified
Résultat Horde_Date

$modifiedby public_oe property

The last-modifier string.
public string $modifiedby
Résultat string

$name public_oe property

The task title.
public string $name
Résultat string

$organizer public_oe property

Task organizer
public string $organizer
Résultat string

$owner public_oe property

The task owner.
public string $owner
Résultat string

$parent public_oe property

The parent task.
public Nag_Task $parent
Résultat Nag_Task

$parent_id public_oe property

The parent task's id.
public string $parent_id
Résultat string

$priority public_oe property

The task priority from 1 = highest to 5 = lowest.
public int $priority
Résultat integer

$private public_oe property

Whether the task is private.
public bool $private
Résultat boolean

$recurrence public_oe property

Recurrence rules for recurring tasks.
public Horde_Date_Recurrence $recurrence
Résultat Horde_Date_Recurrence

$snooze public_oe property

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

$start public_oe property

The start date timestamp.
public int $start
Résultat integer

$status public_oe property

The assignment status of this task.
public int $status
Résultat integer

$tasklist public_oe property

This task's tasklist id.
public string $tasklist
Résultat string

$tasklist_name public_oe property

Overrides the $tasklist's share name.
public string $tasklist_name
Résultat string

$uid public_oe property

The task uid.
public string $uid
Résultat string