3
* Class representing vTodos.
5
* Copyright 2003-2014 Horde LLC (http://www.horde.org/)
7
* See the enclosed file COPYING for license information (LGPL). If you
8
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
10
* @author Mike Cochrane <mike@graftonhall.co.nz>
12
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
15
class Horde_Icalendar_Vtodo extends Horde_Icalendar
18
* The component type of this class.
22
public $type = 'vTodo';
29
public function exportvCalendar()
31
return $this->_exportvData('VTODO');
35
* Convert this todo to an array of attributes.
37
* @return array Array containing the details of the todo in a hash
38
* as used by Horde applications.
40
public function toArray()
45
$name = $this->getAttribute('SUMMARY');
46
if (!is_array($name)) {
47
$todo['name'] = $name;
49
} catch (Horde_Icalendar_Exception $e) {}
52
$desc = $this->getAttribute('DESCRIPTION');
53
if (!is_array($desc)) {
54
$todo['desc'] = $desc;
56
} catch (Horde_Icalendar_Exception $e) {}
59
$priority = $this->getAttribute('PRIORITY');
60
if (!is_array($priority)) {
61
$todo['priority'] = $priority;
63
} catch (Horde_Icalendar_Exception $e) {}
66
$due = $this->getAttribute('DTSTAMP');
67
if (!is_array($due)) {
70
} catch (Horde_Icalendar_Exception $e) {}
76
* Set the attributes for this todo item from an array.
78
* @param array $todo Array containing the details of the todo in
79
* the same format that toArray() exports.
81
public function fromArray($todo)
83
if (isset($todo['name'])) {
84
$this->setAttribute('SUMMARY', $todo['name']);
86
if (isset($todo['desc'])) {
87
$this->setAttribute('DESCRIPTION', $todo['desc']);
90
if (isset($todo['priority'])) {
91
$this->setAttribute('PRIORITY', $todo['priority']);
94
if (isset($todo['due'])) {
95
$this->setAttribute('DTSTAMP', $todo['due']);