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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 9.0 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 * @see Zend_Gdata_Extension_AttendeeStatus
30 */
31require_once 'Zend/Gdata/Extension/AttendeeStatus.php';
32
33/**
34 * @see Zend_Gdata_Extension_AttendeeType
35 */
36require_once 'Zend/Gdata/Extension/AttendeeType.php';
37
38/**
39 * @see Zend_Gdata_Extension_EntryLink
40 */
41require_once 'Zend/Gdata/Extension/EntryLink.php';
42
43/**
44 * Data model class to represent a participant
45 *
46 * @category Zend
47 * @package Zend_Gdata
48 * @subpackage Gdata
49 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
50 * @license http://framework.zend.com/license/new-bsd New BSD License
51 */
52class Zend_Gdata_Extension_Who extends Zend_Gdata_Extension
53{
54
55 protected $_rootElement = 'who';
56 protected $_email = null;
57 protected $_rel = null;
58 protected $_valueString = null;
59 protected $_attendeeStatus = null;
60 protected $_attendeeType = null;
61 protected $_entryLink = null;
62
63 /**
64 * Constructs a new Zend_Gdata_Extension_Who object.
65 * @param string $email (optional) Email address.
66 * @param string $rel (optional) Relationship description.
67 * @param string $valueString (optional) Simple string describing this person.
68 * @param Zend_Gdata_Extension_AttendeeStatus $attendeeStatus (optional) The status of the attendee.
69 * @param Zend_Gdata_Extension_AttendeeType $attendeeType (optional) The type of the attendee.
70 * @param string $entryLink URL pointing to an associated entry (Contact kind) describing this person.
71 */
72 public function __construct($email = null, $rel = null, $valueString = null,
73 $attendeeStatus = null, $attendeeType = null, $entryLink = null)
74 {
75 parent::__construct();
76 $this->_email = $email;
77 $this->_rel = $rel;
78 $this->_valueString = $valueString;
79 $this->_attendeeStatus = $attendeeStatus;
80 $this->_attendeeType = $attendeeType;
81 $this->_entryLink = $entryLink;
82 }
83
84 /**
85 * Retrieves a DOMElement which corresponds to this element and all
86 * child properties. This is used to build an entry back into a DOM
87 * and eventually XML text for sending to the server upon updates, or
88 * for application storage/persistence.
89 *
90 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
91 * @return DOMElement The DOMElement representing this element and all
92 * child properties.
93 */
94 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
95 {
96 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
97 if ($this->_email !== null) {
98 $element->setAttribute('email', $this->_email);
99 }
100 if ($this->_rel !== null) {
101 $element->setAttribute('rel', $this->_rel);
102 }
103 if ($this->_valueString !== null) {
104 $element->setAttribute('valueString', $this->_valueString);
105 }
106 if ($this->_attendeeStatus !== null) {
107 $element->appendChild($this->_attendeeStatus->getDOM($element->ownerDocument));
108 }
109 if ($this->_attendeeType !== null) {
110 $element->appendChild($this->_attendeeType->getDOM($element->ownerDocument));
111 }
112 if ($this->_entryLink !== null) {
113 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
114 }
115 return $element;
116 }
117
118 /**
119 * Given a DOMNode representing an attribute, tries to map the data into
120 * instance members. If no mapping is defined, the name and value are
121 * stored in an array.
122 *
123 * @param DOMNode $attribute The DOMNode attribute needed to be handled
124 */
125 protected function takeAttributeFromDOM($attribute)
126 {
127 switch ($attribute->localName) {
128 case 'email':
129 $this->_email = $attribute->nodeValue;
130 break;
131 case 'rel':
132 $this->_rel = $attribute->nodeValue;
133 break;
134 case 'valueString':
135 $this->_valueString = $attribute->nodeValue;
136 break;
137 default:
138 parent::takeAttributeFromDOM($attribute);
139 }
140 }
141
142 /**
143 * Creates individual Entry objects of the appropriate type and
144 * stores them as members of this entry based upon DOM data.
145 *
146 * @param DOMNode $child The DOMNode to process
147 */
148 protected function takeChildFromDOM($child)
149 {
150 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
151 switch ($absoluteNodeName) {
152 case $this->lookupNamespace('gd') . ':' . 'attendeeStatus':
153 $attendeeStatus = new Zend_Gdata_Extension_AttendeeStatus();
154 $attendeeStatus->transferFromDOM($child);
155 $this->_attendeeStatus = $attendeeStatus;
156 break;
157 case $this->lookupNamespace('gd') . ':' . 'attendeeType':
158 $attendeeType = new Zend_Gdata_Extension_AttendeeType();
159 $attendeeType->transferFromDOM($child);
160 $this->_attendeeType = $attendeeType;
161 break;
162 case $this->lookupNamespace('gd') . ':' . 'entryLink':
163 $entryLink = new Zend_Gdata_Extension_EntryLink();
164 $entryLink->transferFromDOM($child);
165 $this->_entryLink = $entryLink;
166 break;
167 default:
168 parent::takeChildFromDOM($child);
169 break;
170 }
171 }
172
173 /**
174 * Retrieves a human readable string describing this attribute's value.
175 *
176 * @return string The attribute value.
177 */
178 public function __toString()
179 {
180 if ($this->_valueString != null) {
181 return $this->_valueString;
182 }
183 else {
184 return parent::__toString();
185 }
186 }
187
188 /**
189 * Get the value for this element's ValueString attribute.
190 *
191 * @return string The requested attribute.
192 */
193 public function getValueString()
194 {
195 return $this->_valueString;
196 }
197
198 /**
199 * Set the value for this element's ValueString attribute.
200 *
201 * @param string $value The desired value for this attribute.
202 * @return Zend_Gdata_Extension_Who The element being modified.
203 */
204 public function setValueString($value)
205 {
206 $this->_valueString = $value;
207 return $this;
208 }
209
210 /**
211 * Get the value for this element's Email attribute.
212 *
213 * @return string The requested attribute.
214 */
215 public function getEmail()
216 {
217 return $this->_email;
218 }
219
220 /**
221 * Set the value for this element's Email attribute.
222 *
223 * @param string $value The desired value for this attribute.
224 * @return Zend_Gdata_Extension_Who The element being modified.
225 */
226 public function setEmail($value)
227 {
228 $this->_email = $value;
229 return $this;
230 }
231
232 /**
233 * Get the value for this element's Rel attribute.
234 *
235 * @return string The requested attribute.
236 */
237 public function getRel()
238 {
239 return $this->_rel;
240 }
241
242 /**
243 * Set the value for this element's Rel attribute.
244 *
245 * @param string $value The desired value for this attribute.
246 * @return Zend_Gdata_Extension_Who The element being modified.
247 */
248 public function setRel($value)
249 {
250 $this->_rel = $value;
251 return $this;
252 }
253
254 /**
255 * Get this entry's AttendeeStatus element.
256 *
257 * @return Zend_Gdata_Extension_AttendeeStatus The requested entry.
258 */
259 public function getAttendeeStatus()
260 {
261 return $this->_attendeeStatus;
262 }
263
264 /**
265 * Set the child's AttendeeStatus element.
266 *
267 * @param Zend_Gdata_Extension_AttendeeStatus $value The desired value for this attribute.
268 * @return Zend_Gdata_Extension_Who The element being modified.
269 */
270 public function setAttendeeStatus($value)
271 {
272 $this->_attendeeStatus = $value;
273 return $this;
274 }
275
276 /**
277 * Get this entry's AttendeeType element.
278 *
279 * @return Zend_Gdata_Extension_AttendeeType The requested entry.
280 */
281 public function getAttendeeType()
282 {
283 return $this->_attendeeType;
284 }
285
286 /**
287 * Set the child's AttendeeType element.
288 *
289 * @param Zend_Gdata_Extension_AttendeeType $value The desired value for this attribute.
290 * @return Zend_Gdata_Extension_Who The element being modified.
291 */
292 public function setAttendeeType($value)
293 {
294 $this->_attendeeType = $value;
295 return $this;
296 }
297
298}
Note: See TracBrowser for help on using the repository browser.