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

Nag_Driver::toiCalendar ( task,
&$  calendar 
) [inherited]

Export this task in iCalendar format.

Parameters:
array$taskThe task (hash array) to export.
object$calendarA Horde_iCalendar object that acts as the container.
Returns:
object Horde_iCalendar_vtodo object for this event.

Alarms.

Definition at line 94 of file Driver.php.

References Nag_Driver::singleton().

    {
        global $prefs;

        $vTodo = &Horde_iCalendar::newComponent('vtodo', $calendar);

        $vTodo->setAttribute('UID', $task['uid']);

        if (isset($task['name'])) {
            $vTodo->setAttribute('SUMMARY', $task['name']);
        }

        if (isset($task['desc'])) {
            $vTodo->setAttribute('DESCRIPTION', $task['desc']);
        }

        if (isset($task['priority'])) {
            $vTodo->setAttribute('PRIORITY', $task['priority']);
        }

        if (isset($task['due']) && !empty($task['completed'])) {
            $vTodo->setAttribute('DUE', $task['due']);
        }

        if (!empty($task['completed'])) {
            $vTodo->setAttribute('STATUS', 'COMPLETED');

            // Some applications won't consider a task completed
            // unless it has a COMPLETED: date. Fill in today's date
            // for now, as we don't currently track completion date in
            // Nag.
            $vTodo->setAttribute('COMPLETED', time());
        }

        if (!empty($task['category'])) {
            $vTodo->setAttribute('CATEGORIES', $task['category']);
        }

        /**
         * @TODO Alarms.
         */

        /* Get the task's history. */
        require_once 'Horde/History.php';
        $history = &Horde_History::singleton();
        $log = $history->getHistory('nag:' . $task['tasklist_id'] . ':' . $task['uid']);
        foreach ($log->getData() as $entry) {
            switch ($entry['action']) {
            case 'add':
                $created = $entry['ts'];
                break;

            case 'modify':
                $modified = $entry['ts'];
                break;
            }
        }
        if (!empty($created)) {
            $vTodo->setAttribute('DCREATED', $created);
        }
        if (!empty($modified)) {
            $vTodo->setAttribute('LAST-MODIFIED', $modified);
        }

        return $vTodo;
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index