Nag_Driver_Sql
        
        extends Nag_Driver
    
    
            
            in package
            
        
    
    
    
        
            Nag storage implementation for PHP's PEAR database abstraction layer.
The table structure can be created by the scripts/sql/nag.sql script.
See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Tags
Table of Contents
- $tasks : Nag_Task
 - A Nag_Task instance holding the current task list.
 - $_db : Horde_Db_Adapter
 - Handle for the current database connection.
 - $_errormsg : string
 - An error message to throw when something is wrong.
 - $_params : array<string|int, mixed>
 - Hash containing connection parameters.
 - $_tasklist : string
 - String containing the current tasklist.
 - __construct() : Nag_Driver
 - Constructs a new SQL storage object.
 - add() : array<string|int, mixed>
 - Adds a task and handles notification.
 - delete() : mixed
 - Deletes a task and handles notification.
 - deleteAll() : mixed
 - Deletes all tasks for the current task list.
 - get() : Nag_Task
 - Retrieves one or multiple tasks from the database.
 - getByUID() : Nag_Task
 - Retrieves one or multiple tasks from the database by UID.
 - getChildren() : array<string|int, mixed>
 - Retrieves sub-tasks from the database.
 - listAlarms() : array<string|int, mixed>
 - Lists all alarms near $date.
 - modify() : mixed
 - Modifies an existing task and handles notification.
 - open() : mixed
 - Sets the currently open tasklist.
 - retrieve() : mixed
 - Retrieves tasks from the database.
 - synchronize() : mixed
 - Synchronize with the Kolab backend.
 - _add() : string
 - Adds a task to the backend storage.
 - _addRecurrenceFields() : mixed
 - Adds recurrence information to the value hash for SQL INSERT/UPDATE queries.
 - _addTags() : mixed
 - Helper function to add tags from a newly created event to the tagger.
 - _buildTask() : array<string|int, mixed>
 - Return an array describing this task from the provided backend data.
 - _delete() : mixed
 - Deletes a task from the backend.
 - _deleteAll() : array<string|int, mixed>
 - Deletes all tasks from the backend.
 - _getBy() : Nag_Task
 - Retrieves one or multiple tasks from the database.
 - _modify() : mixed
 - Modifies an existing task.
 - _move() : mixed
 - Moves a task to a different tasklist.
 - _updateTags() : mixed
 - Helper function to update an existing event's tags to tagger storage.
 
Properties
$tasks
A Nag_Task instance holding the current task list.
    public
        Nag_Task
    $tasks
    
    
    
    
$_db
Handle for the current database connection.
    protected
        Horde_Db_Adapter
    $_db
    
    
    
    
$_errormsg
An error message to throw when something is wrong.
    protected
        string
    $_errormsg
    
    
    
    
$_params
Hash containing connection parameters.
    protected
        array<string|int, mixed>
    $_params
     = array()
    
    
    
$_tasklist
String containing the current tasklist.
    protected
        string
    $_tasklist
     = ''
    
    
    
Methods
__construct()
Constructs a new SQL storage object.
    public
                    __construct(string $tasklist[, array<string|int, mixed> $params = array() ]) : Nag_Driver
    
        Parameters
- $tasklist : string
 - 
                    
The tasklist to load.
 - $params : array<string|int, mixed> = array()
 - 
                    
A hash containing connection parameters.
 
Return values
Nag_Driver —add()
Adds a task and handles notification.
    public
                    add(array<string|int, mixed> $task) : array<string|int, mixed>
    
        Parameters
- $task : array<string|int, mixed>
 - 
                    
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.
 
 
Return values
array<string|int, mixed> —array(ID,UID) of new task
delete()
Deletes a task and handles notification.
    public
                    delete(string $taskId) : mixed
    
        Parameters
- $taskId : string
 - 
                    
The task to delete.
 
Return values
mixed —deleteAll()
Deletes all tasks for the current task list.
    public
                    deleteAll() : mixed
    
    
    
    Tags
Return values
mixed —get()
Retrieves one or multiple tasks from the database.
    public
                    get(mixed $taskIds) : Nag_Task
    
        Parameters
- $taskIds : mixed
 
Tags
Return values
Nag_Task —A Nag_Task object.
getByUID()
Retrieves one or multiple tasks from the database by UID.
    public
                    getByUID(mixed $uids[, array<string|int, mixed> $tasklists = null ][, bool $getall = true ]) : Nag_Task
    
        Parameters
- $uids : mixed
 - $tasklists : array<string|int, mixed> = null
 - 
                    
An optional array of tasklists to search.
 - $getall : bool = true
 - 
                    
If true, return all instances of the task, otherwise only one. Attempts to find the instance owned by the current user.
 
Tags
Return values
Nag_Task —A Nag_Task object.
getChildren()
Retrieves sub-tasks from the database.
    public
                    getChildren(string $parentId[, bool $include_history = true ]) : array<string|int, mixed>
    
        Parameters
- $parentId : string
 - 
                    
The parent id for the sub-tasks to retrieve.
 - $include_history : bool = true
 - 
                    
Include created/modified info?
 
Tags
Return values
array<string|int, mixed> —List of sub-tasks.
listAlarms()
Lists all alarms near $date.
    public
                    listAlarms(int $date) : array<string|int, mixed>
    
        Parameters
- $date : int
 - 
                    
The unix epoch time to check for alarms.
 
Tags
Return values
array<string|int, mixed> —An array of tasks that have alarms that match.
modify()
Modifies an existing task and handles notification.
    public
                    modify(string $taskId, array<string|int, mixed> $properties) : mixed
    
        Parameters
- $taskId : string
 - 
                    
The task to modify.
 - $properties : array<string|int, mixed>
 - 
                    
A hash with properties. @see add().
 
Tags
Return values
mixed —open()
Sets the currently open tasklist.
    public
                    open(string $tasklist) : mixed
    
        Parameters
- $tasklist : string
 - 
                    
The tasklist.
 
Return values
mixed —retrieve()
Retrieves tasks from the database.
    public
                    retrieve([int $completed = Nag::VIEW_ALL ][, bool $include_history = true ]) : mixed
    
        Parameters
- $completed : int = Nag::VIEW_ALL
 - 
                    
Which tasks to retrieve (1 = all tasks, 0 = incomplete tasks, 2 = complete tasks, 3 = future tasks, 4 = future and incomplete tasks).
 - $include_history : bool = true
 - 
                    
Include created/changed data from Horde_History.
 
Tags
Return values
mixed —synchronize()
Synchronize with the Kolab backend.
    public
                    synchronize([mixed $token = false ]) : mixed
    
        Parameters
- $token : mixed = false
 - 
                    
A value indicating the last synchronization point, if available.
 
Return values
mixed —_add()
Adds a task to the backend storage.
    protected
                    _add(array<string|int, mixed> $task) : string
    
        Parameters
- $task : array<string|int, mixed>
 - 
                    
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.
 
 
Tags
Return values
string —The Nag ID of the new task.
_addRecurrenceFields()
Adds recurrence information to the value hash for SQL INSERT/UPDATE queries.
    protected
                    _addRecurrenceFields(array<string|int, mixed> &$values, array<string|int, mixed> $task) : mixed
    
        Parameters
- $values : array<string|int, mixed>
 - 
                    
The fields to update.
 - $task : array<string|int, mixed>
 - 
                    
The task information.
 
Return values
mixed —_addTags()
Helper function to add tags from a newly created event to the tagger.
    protected
                    _addTags(array<string|int, mixed> $task) : mixed
    
        Parameters
- $task : array<string|int, mixed>
 - 
                    
The task to save tags to storage for.
 
Return values
mixed —_buildTask()
Return an array describing this task from the provided backend data.
    protected
                    _buildTask(array<string|int, mixed> $row[, bool $include_history = true ]) : array<string|int, mixed>
    
        Parameters
- $row : array<string|int, mixed>
 - 
                    
The backend data
 - $include_history : bool = true
 - 
                    
Include history data.
 
Return values
array<string|int, mixed> —The task data.
_delete()
Deletes a task from the backend.
    protected
                    _delete(string $taskId) : mixed
    
        Parameters
- $taskId : string
 - 
                    
The task to delete.
 
Tags
Return values
mixed —_deleteAll()
Deletes all tasks from the backend.
    protected
                    _deleteAll() : array<string|int, mixed>
    
    
    
    Tags
Return values
array<string|int, mixed> —An array of uids that have been removed.
_getBy()
Retrieves one or multiple tasks from the database.
    protected
                    _getBy(mixed $taskIds, string $column[, array<string|int, mixed> $tasklists = null ]) : Nag_Task
    
        Parameters
- $taskIds : mixed
 - $column : string
 - 
                    
The column name to search for the ID.
 - $tasklists : array<string|int, mixed> = null
 
Tags
Return values
Nag_Task —A Nag_Task object.
_modify()
Modifies an existing task.
    protected
                    _modify(string $taskId, array<string|int, mixed> $task) : mixed
    
        Parameters
- $taskId : string
 - 
                    
The task to modify.
 - $task : array<string|int, mixed>
 
Tags
Return values
mixed —_move()
Moves a task to a different tasklist.
    protected
                    _move(string $taskId, string $newTasklist) : mixed
    
        Parameters
- $taskId : string
 - 
                    
The task to move.
 - $newTasklist : string
 - 
                    
The new tasklist.
 
Tags
Return values
mixed —_updateTags()
Helper function to update an existing event's tags to tagger storage.
    protected
                    _updateTags(array<string|int, mixed> $task) : mixed
    
        Parameters
- $task : array<string|int, mixed>
 - 
                    
The task to update