source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/Extension/Reminder.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 4.4 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
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.
15 *
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Gdata
19 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 */
22
23/**
24 * @see Zend_Gdata_Extension
25 */
26require_once 'Zend/Gdata/Extension.php';
27
28/**
29 * Implements the gd:reminder element used to set/retrieve notifications
30 *
31 * @category Zend
32 * @package Zend_Gdata
33 * @subpackage Gdata
34 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 */
37class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension
38{
39
40 protected $_rootElement = 'reminder';
41 protected $_absoluteTime = null;
42 protected $_method = null;
43 protected $_days = null;
44 protected $_hours = null;
45 protected $_minutes = null;
46
47 public function __construct($absoluteTime = null, $method = null, $days = null,
48 $hours = null, $minutes = null)
49 {
50 parent::__construct();
51 $this->_absoluteTime = $absoluteTime;
52 $this->_method = $method;
53 $this->_days = $days;
54 $this->_hours = $hours;
55 $this->_minutes = $minutes;
56 }
57
58 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
59 {
60 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
61 if ($this->_absoluteTime !== null) {
62 $element->setAttribute('absoluteTime', $this->_absoluteTime);
63 }
64 if ($this->_method !== null) {
65 $element->setAttribute('method', $this->_method);
66 }
67 if ($this->_days !== null) {
68 $element->setAttribute('days', $this->_days);
69 }
70 if ($this->_hours !== null) {
71 $element->setAttribute('hours', $this->_hours);
72 }
73 if ($this->_minutes !== null) {
74 $element->setAttribute('minutes', $this->_minutes);
75 }
76 return $element;
77 }
78
79 protected function takeAttributeFromDOM($attribute)
80 {
81 switch ($attribute->localName) {
82 case 'absoluteTime':
83 $this->_absoluteTime = $attribute->nodeValue;
84 break;
85 case 'method':
86 $this->_method = $attribute->nodeValue;
87 break;
88 case 'days':
89 $this->_days = $attribute->nodeValue;
90 break;
91 case 'hours':
92 $this->_hours = $attribute->nodeValue;
93 break;
94 case 'minutes':
95 $this->_minutes = $attribute->nodeValue;
96 break;
97 default:
98 parent::takeAttributeFromDOM($attribute);
99 }
100 }
101
102 public function __toString()
103 {
104 $s;
105 if ($absoluteTime)
106 $s = "at" . $absoluteTime;
107 else if ($days)
108 $s = "in" . $days . "days";
109 else if ($hours)
110 $s = "in" . $hours . "hours";
111 else if ($minutes)
112 $s = "in" . $minutes . "minutes";
113 return $method . $s;
114 }
115
116 public function getAbsoluteTime()
117 {
118 return $this->_absoluteTime;
119 }
120
121 public function setAbsoluteTime($value)
122 {
123 $this->_absoluteTime = $value;
124 return $this;
125 }
126
127 public function getDays()
128 {
129 return $this->_days;
130 }
131
132 public function setDays($value)
133 {
134 $this->_days = $value;
135 return $this;
136 }
137 public function getHours()
138 {
139 return $this->_hours;
140 }
141
142 public function setHours($value)
143 {
144 $this->_hours = $value;
145 return $this;
146 }
147
148 public function getMinutes()
149 {
150 return $this->_minutes;
151 }
152
153 public function setMinutes($value)
154 {
155 $this->_minutes = $value;
156 return $this;
157 }
158
159 public function getMethod()
160 {
161 return $this->_method;
162 }
163
164 public function setMethod($value)
165 {
166 $this->_method = $value;
167 return $this;
168 }
169
170}
Note: See TracBrowser for help on using the repository browser.