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

Nag_Driver_sql::modify ( taskId,
name,
desc,
due = 0,
priority = 0,
completed = 0,
category = '',
alarm = 0 
)

Modify an existing task.

Parameters:
string$taskIdThe task to modify.
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.

Definition at line 207 of file sql.php.

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

    {
        /* Make sure we have a valid database connection. */
        $this->_connect();

        $query = sprintf('UPDATE %s SET' .
                         ' task_name = ?, ' .
                         ' task_desc = ?, ' .
                         ' task_due = ?, ' .
                         ' task_priority = ?, ' .
                         ' task_completed = ?, ' .
                         ' task_category = ?, ' .
                         ' task_alarm = ? ' .
                         'WHERE task_owner = ? AND task_id = ?',
                         $this->_params['table']);
        $values = array(String::convertCharset($name, NLS::getCharset(), $this->_params['charset']),
                        String::convertCharset($desc, NLS::getCharset(), $this->_params['charset']),
                        (int)$due,
                        (int)$priority,
                        (int)$completed,
                        String::convertCharset($category, NLS::getCharset(), $this->_params['charset']),
                        (int)$alarm,
                        $this->_tasklist,
                        $taskId);

        /* Log the query at a DEBUG log level. */
        Horde::logMessage(sprintf('Nag_Driver_sql::modify(): %s', $query),
                          __FILE__, __LINE__, PEAR_LOG_DEBUG);

        /* Attempt the update query. */
        $result = $this->_db->query($query, $values);
        if (is_a($result, 'PEAR_Error')) {
            Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
            return $result;
        }

        /* Log the modification of this item in the history log. */
        $task = $this->get($taskId);
        if (!empty($task['uid'])) {
            $history = &Horde_History::singleton();
            $history->log('nag:' . $this->_tasklist . ':' . $task['uid'], array('action' => 'modify'), true);
        }

        return true;
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index