Logo Search packages:      
Sourcecode: nag2 version File versions  Download package

Nag_Driver_datatree::add ( name,
due = 0,
priority = 0,
completed = 0,
category = '',
alarm = 0,
uid = null 

Add a task to the backend storage.

string$nameThe name (short) of the task.
string$descThe description (long) of the task.
integer$dueThe due date of the task.
integer$priorityThe priority of the task.
integer$completedThe completion state of the task.
string$categoryThe category of the task.
integer$completedThe alarm associated with the task.
string$uidA Unique Identifier for the task.
string The Nag ID of the new task.

Definition at line 131 of file datatree.php.

References Nag_Driver::generateUID(), and Nag_Driver::singleton().

        if (is_null($uid)) {
            $uid = $this->generateUID();

        // Create a new DataTree object.
        $obj = &new DataTreeObject(md5(uniqid(mt_rand(), true)));
        $obj->set('tasklist', $this->_tasklist);
        $obj->set('name', $name);
        $obj->set('uid', $uid);
        $obj->set('description', $desc);
        $obj->set('due', $due);
        $obj->set('priority', $priority);
        $obj->set('completed', $completed);
        $obj->set('category', $category);
        $obj->set('modified', time());
        $obj->set('alarm', $alarm);
        $result = $this->_datatree->add($obj);

        /* Return an error immediately if adding failed. */
        if (is_a($result, 'PEAR_Error')) {
            Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
            return $result;

        /* Log the creation of this item in the history log. */
        $history = &Horde_History::singleton();
        $history->log($uid, array('action' => 'add'), true);

        /* Result contains the ID sent back by the add function. */
        return $result;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index