PHP Class Nag_Driver_Sql, horde

The table structure can be created by the scripts/sql/nag.sql script. 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])
Inheritance: extends Nag_Driver
ファイルを表示 Open project: horde/horde

Protected Properties

Property Type Description
$_db Horde_Db_Adapter Handle for the current database connection.

Public Methods

Method Description
__construct ( string $tasklist, array $params = [] ) Constructs a new SQL storage object.
get ( $taskIds ) : Nag_Task Retrieves one or multiple tasks 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 Lists all alarms near $date.
retrieve ( integer $completed = Nag::VIEW_ALL, boolean $include_history = true ) Retrieves tasks from the database.

Protected Methods

Method Description
_add ( array $task ) : string Adds a task to the backend storage.
_addRecurrenceFields ( array &$values, array $task ) Adds recurrence information to the value hash for SQL INSERT/UPDATE queries.
_buildTask ( array $row, boolean $include_history = true ) : array Return an array describing this task from the provided backend data.
_delete ( string $taskId ) Deletes a task from the backend.
_deleteAll ( ) : array Deletes all tasks from the backend.
_getBy ( $taskIds, string $column, array $tasklists = null ) : Nag_Task Retrieves one or multiple tasks from the database.
_modify ( string $taskId, array $task ) Modifies an existing task.
_move ( string $taskId, string $newTasklist ) Moves a task to a different tasklist.

Method Details

__construct() public method

Constructs a new SQL storage object.
public __construct ( string $tasklist, array $params = [] )
$tasklist string The tasklist to load.
$params array A hash containing connection parameters.

_add() protected method

Adds a task to the backend storage.
protected _add ( array $task ) : string
$task array A hash with the following possible properties: - actual: (float) The actual time spent on the task. - alarm: (integer) The alarm associated with the task. - assignee: (string) The assignee of the event. - completed: (integer) The completion state of the task. - desc: (string) The description (long) of the task. - due: (integer) The due date of the task. - estimate: (float) The estimated time to complete the task. - methods: (array) The overridden alarm notification methods. - name: (string) The name (short) of the task. - organizer: (string) The organizer/owner of the task. - owner: (string) The owner of the event. - parent: (string) The parent task. - priority: (integer) The priority of the task. - private: (boolean) Whether the task is private. - recurrence: (Horde_Date_Recurrence|array) Recurrence information. - start: (integer) The start date of the task. - tags: (array) The task tags. - uid: (string) A Unique Identifier for the task.
return string The Nag ID of the new task.

_addRecurrenceFields() protected method

Adds recurrence information to the value hash for SQL INSERT/UPDATE queries.
protected _addRecurrenceFields ( array &$values, array $task )
$values array The fields to update.
$task array The task information.

_buildTask() protected method

Return an array describing this task from the provided backend data.
protected _buildTask ( array $row, boolean $include_history = true ) : array
$row array The backend data
$include_history boolean Include history data.
return array The task data.

_delete() protected method

Deletes a task from the backend.
protected _delete ( string $taskId )
$taskId string The task to delete.

_deleteAll() protected method

Deletes all tasks from the backend.
protected _deleteAll ( ) : array
return array An array of uids that have been removed.

_getBy() protected method

Retrieves one or multiple tasks from the database.
protected _getBy ( $taskIds, string $column, array $tasklists = null ) : Nag_Task
$column string The column name to search for the ID.
$tasklists array
return Nag_Task A Nag_Task object.

_modify() protected method

Modifies an existing task.
protected _modify ( string $taskId, array $task )
$taskId string The task to modify.
$task array

_move() protected method

Moves a task to a different tasklist.
protected _move ( string $taskId, string $newTasklist )
$taskId string The task to move.
$newTasklist string The new tasklist.

get() public method

Retrieves one or multiple tasks from the database.
public get ( $taskIds ) : Nag_Task
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

Lists 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.

retrieve() public method

Retrieves tasks from the database.
public retrieve ( integer $completed = Nag::VIEW_ALL, boolean $include_history = true )
$completed integer Which tasks to retrieve (1 = all tasks, 0 = incomplete tasks, 2 = complete tasks, 3 = future tasks, 4 = future and incomplete tasks).
$include_history boolean Include created/changed data from Horde_History.

Property Details

$_db protected_oe property

Handle for the current database connection.
protected Horde_Db_Adapter $_db
return Horde_Db_Adapter