8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * Implements the gd:reminder element used to set/retrieve notifications
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension
41 protected $_rootElement = 'reminder';
42 protected $_absoluteTime = null;
43 protected $_method = null;
44 protected $_days = null;
45 protected $_hours = null;
46 protected $_minutes = null;
48 public function __construct($absoluteTime = null, $method = null, $days = null,
49 $hours = null, $minutes = null)
51 parent::__construct();
52 $this->_absoluteTime = $absoluteTime;
53 $this->_method = $method;
55 $this->_hours = $hours;
56 $this->_minutes = $minutes;
59 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
61 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
62 if ($this->_absoluteTime !== null) {
63 $element->setAttribute('absoluteTime', $this->_absoluteTime);
65 if ($this->_method !== null) {
66 $element->setAttribute('method', $this->_method);
68 if ($this->_days !== null) {
69 $element->setAttribute('days', $this->_days);
71 if ($this->_hours !== null) {
72 $element->setAttribute('hours', $this->_hours);
74 if ($this->_minutes !== null) {
75 $element->setAttribute('minutes', $this->_minutes);
80 protected function takeAttributeFromDOM($attribute)
82 switch ($attribute->localName) {
84 $this->_absoluteTime = $attribute->nodeValue;
87 $this->_method = $attribute->nodeValue;
90 $this->_days = $attribute->nodeValue;
93 $this->_hours = $attribute->nodeValue;
96 $this->_minutes = $attribute->nodeValue;
99 parent::takeAttributeFromDOM($attribute);
103 public function __toString()
106 if ($this->_absoluteTime)
107 $s = " at " . $this->_absoluteTime;
108 else if ($this->_days)
109 $s = " in " . $this->_days . " days";
110 else if ($this->_hours)
111 $s = " in " . $this->_hours . " hours";
112 else if ($this->_minutes)
113 $s = " in " . $this->_minutes . " minutes";
114 return $this->_method . $s;
117 public function getAbsoluteTime()
119 return $this->_absoluteTime;
122 public function setAbsoluteTime($value)
124 $this->_absoluteTime = $value;
128 public function getDays()
133 public function setDays($value)
135 $this->_days = $value;
138 public function getHours()
140 return $this->_hours;
143 public function setHours($value)
145 $this->_hours = $value;
149 public function getMinutes()
151 return $this->_minutes;
154 public function setMinutes($value)
156 $this->_minutes = $value;
160 public function getMethod()
162 return $this->_method;
165 public function setMethod($value)
167 $this->_method = $value;