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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 15.5 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 Photos
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_Photos
25 */
26require_once 'Zend/Gdata/Photos.php';
27
28/**
29 * @see Zend_Gdata_Feed
30 */
31require_once 'Zend/Gdata/Feed.php';
32
33/**
34 * @see Zend_Gdata_Photos_AlbumEntry
35 */
36require_once 'Zend/Gdata/Photos/AlbumEntry.php';
37
38/**
39 * Data model for a collection of album entries, usually
40 * provided by the servers.
41 *
42 * For information on requesting this feed from a server, see the
43 * service class, Zend_Gdata_Photos.
44 *
45 * @category Zend
46 * @package Zend_Gdata
47 * @subpackage Photos
48 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
49 * @license http://framework.zend.com/license/new-bsd New BSD License
50 */
51class Zend_Gdata_Photos_AlbumFeed extends Zend_Gdata_Feed
52{
53 protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry';
54 protected $_feedClassName = 'Zend_Gdata_Photos_AlbumFeed';
55
56 /**
57 * gphoto:id element
58 *
59 * @var Zend_Gdata_Photos_Extension_Id
60 */
61 protected $_gphotoId = null;
62
63 /**
64 * gphoto:user element
65 *
66 * @var Zend_Gdata_Photos_Extension_User
67 */
68 protected $_gphotoUser = null;
69
70 /**
71 * gphoto:access element
72 *
73 * @var Zend_Gdata_Photos_Extension_Access
74 */
75 protected $_gphotoAccess = null;
76
77 /**
78 * gphoto:location element
79 *
80 * @var Zend_Gdata_Photos_Extension_Location
81 */
82 protected $_gphotoLocation = null;
83
84 /**
85 * gphoto:nickname element
86 *
87 * @var Zend_Gdata_Photos_Extension_Nickname
88 */
89 protected $_gphotoNickname = null;
90
91 /**
92 * gphoto:timestamp element
93 *
94 * @var Zend_Gdata_Photos_Extension_Timestamp
95 */
96 protected $_gphotoTimestamp = null;
97
98 /**
99 * gphoto:name element
100 *
101 * @var Zend_Gdata_Photos_Extension_Name
102 */
103 protected $_gphotoName = null;
104
105 /**
106 * gphoto:numphotos element
107 *
108 * @var Zend_Gdata_Photos_Extension_NumPhotos
109 */
110 protected $_gphotoNumPhotos = null;
111
112 /**
113 * gphoto:commentCount element
114 *
115 * @var Zend_Gdata_Photos_Extension_CommentCount
116 */
117 protected $_gphotoCommentCount = null;
118
119 /**
120 * gphoto:commentingEnabled element
121 *
122 * @var Zend_Gdata_Photos_Extension_CommentingEnabled
123 */
124 protected $_gphotoCommentingEnabled = null;
125
126 protected $_entryKindClassMapping = array(
127 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry',
128 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry',
129 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry'
130 );
131
132 public function __construct($element = null)
133 {
134 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
135 parent::__construct($element);
136 }
137
138 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
139 {
140 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
141 if ($this->_gphotoId != null) {
142 $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
143 }
144 if ($this->_gphotoUser != null) {
145 $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
146 }
147 if ($this->_gphotoNickname != null) {
148 $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
149 }
150 if ($this->_gphotoName != null) {
151 $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument));
152 }
153 if ($this->_gphotoLocation != null) {
154 $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument));
155 }
156 if ($this->_gphotoAccess != null) {
157 $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument));
158 }
159 if ($this->_gphotoTimestamp != null) {
160 $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
161 }
162 if ($this->_gphotoNumPhotos != null) {
163 $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument));
164 }
165 if ($this->_gphotoCommentingEnabled != null) {
166 $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
167 }
168 if ($this->_gphotoCommentCount != null) {
169 $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
170 }
171
172 return $element;
173 }
174
175 protected function takeChildFromDOM($child)
176 {
177 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
178
179 switch ($absoluteNodeName) {
180 case $this->lookupNamespace('gphoto') . ':' . 'id';
181 $id = new Zend_Gdata_Photos_Extension_Id();
182 $id->transferFromDOM($child);
183 $this->_gphotoId = $id;
184 break;
185 case $this->lookupNamespace('gphoto') . ':' . 'user';
186 $user = new Zend_Gdata_Photos_Extension_User();
187 $user->transferFromDOM($child);
188 $this->_gphotoUser = $user;
189 break;
190 case $this->lookupNamespace('gphoto') . ':' . 'nickname';
191 $nickname = new Zend_Gdata_Photos_Extension_Nickname();
192 $nickname->transferFromDOM($child);
193 $this->_gphotoNickname = $nickname;
194 break;
195 case $this->lookupNamespace('gphoto') . ':' . 'name';
196 $name = new Zend_Gdata_Photos_Extension_Name();
197 $name->transferFromDOM($child);
198 $this->_gphotoName = $name;
199 break;
200 case $this->lookupNamespace('gphoto') . ':' . 'location';
201 $location = new Zend_Gdata_Photos_Extension_Location();
202 $location->transferFromDOM($child);
203 $this->_gphotoLocation = $location;
204 break;
205 case $this->lookupNamespace('gphoto') . ':' . 'access';
206 $access = new Zend_Gdata_Photos_Extension_Access();
207 $access->transferFromDOM($child);
208 $this->_gphotoAccess = $access;
209 break;
210 case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
211 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
212 $timestamp->transferFromDOM($child);
213 $this->_gphotoTimestamp = $timestamp;
214 break;
215 case $this->lookupNamespace('gphoto') . ':' . 'numphotos';
216 $numphotos = new Zend_Gdata_Photos_Extension_NumPhotos();
217 $numphotos->transferFromDOM($child);
218 $this->_gphotoNumPhotos = $numphotos;
219 break;
220 case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
221 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
222 $commentingEnabled->transferFromDOM($child);
223 $this->_gphotoCommentingEnabled = $commentingEnabled;
224 break;
225 case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
226 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
227 $commentCount->transferFromDOM($child);
228 $this->_gphotoCommentCount = $commentCount;
229 break;
230 case $this->lookupNamespace('atom') . ':' . 'entry':
231 $entryClassName = $this->_entryClassName;
232 $tmpEntry = new Zend_Gdata_App_Entry($child);
233 $categories = $tmpEntry->getCategory();
234 foreach ($categories as $category) {
235 if ($category->scheme == Zend_Gdata_Photos::KIND_PATH &&
236 $this->_entryKindClassMapping[$category->term] != "") {
237 $entryClassName = $this->_entryKindClassMapping[$category->term];
238 break;
239 } else {
240 require_once 'Zend/Gdata/App/Exception.php';
241 throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.');
242 }
243 }
244
245 $newEntry = new $entryClassName($child);
246 $newEntry->setHttpClient($this->getHttpClient());
247 $this->_entry[] = $newEntry;
248 break;
249 default:
250 parent::takeChildFromDOM($child);
251 break;
252 }
253 }
254
255 /**
256 * Get the value for this element's gphoto:user attribute.
257 *
258 * @see setGphotoUser
259 * @return string The requested attribute.
260 */
261 public function getGphotoUser()
262 {
263 return $this->_gphotoUser;
264 }
265
266 /**
267 * Set the value for this element's gphoto:user attribute.
268 *
269 * @param string $value The desired value for this attribute.
270 * @return Zend_Gdata_Photos_Extension_User The element being modified.
271 */
272 public function setGphotoUser($value)
273 {
274 $this->_gphotoUser = $value;
275 return $this;
276 }
277
278 /**
279 * Get the value for this element's gphoto:access attribute.
280 *
281 * @see setGphotoAccess
282 * @return string The requested attribute.
283 */
284 public function getGphotoAccess()
285 {
286 return $this->_gphotoAccess;
287 }
288
289 /**
290 * Set the value for this element's gphoto:access attribute.
291 *
292 * @param string $value The desired value for this attribute.
293 * @return Zend_Gdata_Photos_Extension_Access The element being modified.
294 */
295 public function setGphotoAccess($value)
296 {
297 $this->_gphotoAccess = $value;
298 return $this;
299 }
300
301 /**
302 * Get the value for this element's gphoto:location attribute.
303 *
304 * @see setGphotoLocation
305 * @return string The requested attribute.
306 */
307 public function getGphotoLocation()
308 {
309 return $this->_gphotoLocation;
310 }
311
312 /**
313 * Set the value for this element's gphoto:location attribute.
314 *
315 * @param string $value The desired value for this attribute.
316 * @return Zend_Gdata_Photos_Extension_Location The element being modified.
317 */
318 public function setGphotoLocation($value)
319 {
320 $this->_gphotoLocation = $value;
321 return $this;
322 }
323
324 /**
325 * Get the value for this element's gphoto:name attribute.
326 *
327 * @see setGphotoName
328 * @return string The requested attribute.
329 */
330 public function getGphotoName()
331 {
332 return $this->_gphotoName;
333 }
334
335 /**
336 * Set the value for this element's gphoto:name attribute.
337 *
338 * @param string $value The desired value for this attribute.
339 * @return Zend_Gdata_Photos_Extension_Name The element being modified.
340 */
341 public function setGphotoName($value)
342 {
343 $this->_gphotoName = $value;
344 return $this;
345 }
346
347 /**
348 * Get the value for this element's gphoto:numphotos attribute.
349 *
350 * @see setGphotoNumPhotos
351 * @return string The requested attribute.
352 */
353 public function getGphotoNumPhotos()
354 {
355 return $this->_gphotoNumPhotos;
356 }
357
358 /**
359 * Set the value for this element's gphoto:numphotos attribute.
360 *
361 * @param string $value The desired value for this attribute.
362 * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified.
363 */
364 public function setGphotoNumPhotos($value)
365 {
366 $this->_gphotoNumPhotos = $value;
367 return $this;
368 }
369
370 /**
371 * Get the value for this element's gphoto:commentCount attribute.
372 *
373 * @see setGphotoCommentCount
374 * @return string The requested attribute.
375 */
376 public function getGphotoCommentCount()
377 {
378 return $this->_gphotoCommentCount;
379 }
380
381 /**
382 * Set the value for this element's gphoto:commentCount attribute.
383 *
384 * @param string $value The desired value for this attribute.
385 * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
386 */
387 public function setGphotoCommentCount($value)
388 {
389 $this->_gphotoCommentCount = $value;
390 return $this;
391 }
392
393 /**
394 * Get the value for this element's gphoto:commentingEnabled attribute.
395 *
396 * @see setGphotoCommentingEnabled
397 * @return string The requested attribute.
398 */
399 public function getGphotoCommentingEnabled()
400 {
401 return $this->_gphotoCommentingEnabled;
402 }
403
404 /**
405 * Set the value for this element's gphoto:commentingEnabled attribute.
406 *
407 * @param string $value The desired value for this attribute.
408 * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
409 */
410 public function setGphotoCommentingEnabled($value)
411 {
412 $this->_gphotoCommentingEnabled = $value;
413 return $this;
414 }
415
416 /**
417 * Get the value for this element's gphoto:id attribute.
418 *
419 * @see setGphotoId
420 * @return string The requested attribute.
421 */
422 public function getGphotoId()
423 {
424 return $this->_gphotoId;
425 }
426
427 /**
428 * Set the value for this element's gphoto:id attribute.
429 *
430 * @param string $value The desired value for this attribute.
431 * @return Zend_Gdata_Photos_Extension_Id The element being modified.
432 */
433 public function setGphotoId($value)
434 {
435 $this->_gphotoId = $value;
436 return $this;
437 }
438
439 /**
440 * Get the value for this element's georss:where attribute.
441 *
442 * @see setGeoRssWhere
443 * @return string The requested attribute.
444 */
445 public function getGeoRssWhere()
446 {
447 return $this->_geoRssWhere;
448 }
449
450 /**
451 * Set the value for this element's georss:where attribute.
452 *
453 * @param string $value The desired value for this attribute.
454 * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified.
455 */
456 public function setGeoRssWhere($value)
457 {
458 $this->_geoRssWhere = $value;
459 return $this;
460 }
461
462 /**
463 * Get the value for this element's gphoto:nickname attribute.
464 *
465 * @see setGphotoNickname
466 * @return string The requested attribute.
467 */
468 public function getGphotoNickname()
469 {
470 return $this->_gphotoNickname;
471 }
472
473 /**
474 * Set the value for this element's gphoto:nickname attribute.
475 *
476 * @param string $value The desired value for this attribute.
477 * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
478 */
479 public function setGphotoNickname($value)
480 {
481 $this->_gphotoNickname = $value;
482 return $this;
483 }
484
485 /**
486 * Get the value for this element's gphoto:timestamp attribute.
487 *
488 * @see setGphotoTimestamp
489 * @return string The requested attribute.
490 */
491 public function getGphotoTimestamp()
492 {
493 return $this->_gphotoTimestamp;
494 }
495
496 /**
497 * Set the value for this element's gphoto:timestamp attribute.
498 *
499 * @param string $value The desired value for this attribute.
500 * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
501 */
502 public function setGphotoTimestamp($value)
503 {
504 $this->_gphotoTimestamp = $value;
505 return $this;
506 }
507
508}
Note: See TracBrowser for help on using the repository browser.