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-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: AlbumEntry.php 16971 2009-07-22 18:05:45Z mikaelkael $
25 * @see Zend_Gdata_Entry
27 require_once 'Zend/Gdata/Entry.php';
30 * @see Zend_Gdata_Photos_Extension_Access
32 require_once 'Zend/Gdata/Photos/Extension/Access.php';
35 * @see Zend_Gdata_Photos_Extension_BytesUsed
37 require_once 'Zend/Gdata/Photos/Extension/BytesUsed.php';
40 * @see Zend_Gdata_Photos_Extension_Location
42 require_once 'Zend/Gdata/Photos/Extension/Location.php';
45 * @see Zend_Gdata_Photos_Extension_Name
47 require_once 'Zend/Gdata/Photos/Extension/Name.php';
50 * @see Zend_Gdata_Photos_Extension_NumPhotos
52 require_once 'Zend/Gdata/Photos/Extension/NumPhotos.php';
55 * @see Zend_Gdata_Photos_Extension_NumPhotosRemaining
57 require_once 'Zend/Gdata/Photos/Extension/NumPhotosRemaining.php';
60 * @see Zend_Gdata_Photos_Extension_CommentCount
62 require_once 'Zend/Gdata/Photos/Extension/CommentCount.php';
65 * @see Zend_Gdata_Photos_Extension_CommentingEnabled
67 require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php';
70 * @see Zend_Gdata_Photos_Extension_Id
72 require_once 'Zend/Gdata/Photos/Extension/Id.php';
75 * @see Zend_Gdata_Geo_Extension_GeoRssWhere
77 require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php';
80 * @see Zend_Gdata_Media_Extension_MediaGroup
82 require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
85 * @see Zend_Gdata_App_Extension_Category
87 require_once 'Zend/Gdata/App/Extension/Category.php';
90 * Data model class for a Photo Album Entry.
92 * To transfer user entries to and from the servers, including
93 * creating new entries, refer to the service class,
96 * This class represents <atom:entry> in the Google Data protocol.
101 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
102 * @license http://framework.zend.com/license/new-bsd New BSD License
104 class Zend_Gdata_Photos_AlbumEntry
extends Zend_Gdata_Entry
107 protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry';
112 * @var Zend_Gdata_Photos_Extension_Id
114 protected $_gphotoId = null;
117 * gphoto:access element
119 * @var Zend_Gdata_Photos_Extension_Access
121 protected $_gphotoAccess = null;
124 * gphoto:location element
126 * @var Zend_Gdata_Photos_Extension_Location
128 protected $_gphotoLocation = null;
131 * gphoto:user element
133 * @var Zend_Gdata_Photos_Extension_User
135 protected $_gphotoUser = null;
138 * gphoto:nickname element
140 * @var Zend_Gdata_Photos_Extension_Nickname
142 protected $_gphotoNickname = null;
145 * gphoto:timestamp element
147 * @var Zend_Gdata_Photos_Extension_Timestamp
149 protected $_gphotoTimestamp = null;
152 * gphoto:name element
154 * @var Zend_Gdata_Photos_Extension_Name
156 protected $_gphotoName = null;
159 * gphoto:numphotos element
161 * @var Zend_Gdata_Photos_Extension_NumPhotos
163 protected $_gphotoNumPhotos = null;
166 * gphoto:commentCount element
168 * @var Zend_Gdata_Photos_Extension_CommentCount
170 protected $_gphotoCommentCount = null;
173 * gphoto:commentingEnabled element
175 * @var Zend_Gdata_Photos_Extension_CommentingEnabled
177 protected $_gphotoCommentingEnabled = null;
180 * media:group element
182 * @var Zend_Gdata_Media_MediaGroup
184 protected $_mediaGroup = null;
187 * georss:where element
189 * @var Zend_Gdata_Geo_Extension_GeoRssWhere
191 protected $_geoRssWhere = null;
194 * Create a new instance.
196 * @param DOMElement $element (optional) DOMElement from which this
197 * object should be constructed.
199 public function __construct($element = null)
201 $this->registerAllNamespaces(Zend_Gdata_Photos
::$namespaces);
202 parent
::__construct($element);
204 $category = new Zend_Gdata_App_Extension_Category(
205 'http://schemas.google.com/photos/2007#album',
206 'http://schemas.google.com/g/2005#kind');
207 $this->setCategory(array($category));
211 * Retrieves a DOMElement which corresponds to this element and all
212 * child properties. This is used to build an entry back into a DOM
213 * and eventually XML text for application storage/persistence.
215 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
216 * @return DOMElement The DOMElement representing this element and all
219 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
221 $element = parent
::getDOM($doc, $majorVersion, $minorVersion);
222 if ($this->_gphotoTimestamp
!== null) {
223 $element->appendChild($this->_gphotoTimestamp
->getDOM($element->ownerDocument
));
225 if ($this->_gphotoUser
!== null) {
226 $element->appendChild($this->_gphotoUser
->getDOM($element->ownerDocument
));
228 if ($this->_gphotoNickname
!== null) {
229 $element->appendChild($this->_gphotoNickname
->getDOM($element->ownerDocument
));
231 if ($this->_gphotoAccess
!== null) {
232 $element->appendChild($this->_gphotoAccess
->getDOM($element->ownerDocument
));
234 if ($this->_gphotoLocation
!== null) {
235 $element->appendChild($this->_gphotoLocation
->getDOM($element->ownerDocument
));
237 if ($this->_gphotoName
!== null) {
238 $element->appendChild($this->_gphotoName
->getDOM($element->ownerDocument
));
240 if ($this->_gphotoNumPhotos
!== null) {
241 $element->appendChild($this->_gphotoNumPhotos
->getDOM($element->ownerDocument
));
243 if ($this->_gphotoCommentCount
!== null) {
244 $element->appendChild($this->_gphotoCommentCount
->getDOM($element->ownerDocument
));
246 if ($this->_gphotoCommentingEnabled
!== null) {
247 $element->appendChild($this->_gphotoCommentingEnabled
->getDOM($element->ownerDocument
));
249 if ($this->_gphotoId
!== null) {
250 $element->appendChild($this->_gphotoId
->getDOM($element->ownerDocument
));
252 if ($this->_mediaGroup
!== null) {
253 $element->appendChild($this->_mediaGroup
->getDOM($element->ownerDocument
));
259 * Creates individual Entry objects of the appropriate type and
260 * stores them as members of this entry based upon DOM data.
262 * @param DOMNode $child The DOMNode to process
264 protected function takeChildFromDOM($child)
266 $absoluteNodeName = $child->namespaceURI
. ':' . $child->localName
;
268 switch ($absoluteNodeName) {
269 case $this->lookupNamespace('gphoto') . ':' . 'access';
270 $access = new Zend_Gdata_Photos_Extension_Access();
271 $access->transferFromDOM($child);
272 $this->_gphotoAccess
= $access;
274 case $this->lookupNamespace('gphoto') . ':' . 'location';
275 $location = new Zend_Gdata_Photos_Extension_Location();
276 $location->transferFromDOM($child);
277 $this->_gphotoLocation
= $location;
279 case $this->lookupNamespace('gphoto') . ':' . 'name';
280 $name = new Zend_Gdata_Photos_Extension_Name();
281 $name->transferFromDOM($child);
282 $this->_gphotoName
= $name;
284 case $this->lookupNamespace('gphoto') . ':' . 'numphotos';
285 $numPhotos = new Zend_Gdata_Photos_Extension_NumPhotos();
286 $numPhotos->transferFromDOM($child);
287 $this->_gphotoNumPhotos
= $numPhotos;
289 case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
290 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
291 $commentCount->transferFromDOM($child);
292 $this->_gphotoCommentCount
= $commentCount;
294 case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
295 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
296 $commentingEnabled->transferFromDOM($child);
297 $this->_gphotoCommentingEnabled
= $commentingEnabled;
299 case $this->lookupNamespace('gphoto') . ':' . 'id';
300 $id = new Zend_Gdata_Photos_Extension_Id();
301 $id->transferFromDOM($child);
302 $this->_gphotoId
= $id;
304 case $this->lookupNamespace('gphoto') . ':' . 'user';
305 $user = new Zend_Gdata_Photos_Extension_User();
306 $user->transferFromDOM($child);
307 $this->_gphotoUser
= $user;
309 case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
310 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
311 $timestamp->transferFromDOM($child);
312 $this->_gphotoTimestamp
= $timestamp;
314 case $this->lookupNamespace('gphoto') . ':' . 'nickname';
315 $nickname = new Zend_Gdata_Photos_Extension_Nickname();
316 $nickname->transferFromDOM($child);
317 $this->_gphotoNickname
= $nickname;
319 case $this->lookupNamespace('georss') . ':' . 'where';
320 $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere();
321 $geoRssWhere->transferFromDOM($child);
322 $this->_geoRssWhere
= $geoRssWhere;
324 case $this->lookupNamespace('media') . ':' . 'group';
325 $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
326 $mediaGroup->transferFromDOM($child);
327 $this->_mediaGroup
= $mediaGroup;
330 parent
::takeChildFromDOM($child);
336 * Get the value for this element's gphoto:access attribute.
338 * @see setGphotoAccess
339 * @return string The requested attribute.
341 public function getGphotoAccess()
343 return $this->_gphotoAccess
;
347 * Set the value for this element's gphoto:access attribute.
349 * @param string $value The desired value for this attribute.
350 * @return Zend_Gdata_Photos_Extension_Access The element being modified.
352 public function setGphotoAccess($value)
354 $this->_gphotoAccess
= $value;
359 * Get the value for this element's gphoto:location attribute.
361 * @see setGphotoLocation
362 * @return string The requested attribute.
364 public function getGphotoLocation()
366 return $this->_gphotoLocation
;
370 * Set the value for this element's gphoto:location attribute.
372 * @param string $value The desired value for this attribute.
373 * @return Zend_Gdata_Photos_Extension_Location The element being modified.
375 public function setGphotoLocation($value)
377 $this->_location
= $value;
382 * Get the value for this element's gphoto:name attribute.
385 * @return string The requested attribute.
387 public function getGphotoName()
389 return $this->_gphotoName
;
393 * Set the value for this element's gphoto:name attribute.
395 * @param string $value The desired value for this attribute.
396 * @return Zend_Gdata_Photos_Extension_Name The element being modified.
398 public function setGphotoName($value)
400 $this->_gphotoName
= $value;
405 * Get the value for this element's gphoto:numphotos attribute.
407 * @see setGphotoNumPhotos
408 * @return string The requested attribute.
410 public function getGphotoNumPhotos()
412 return $this->_gphotoNumPhotos
;
416 * Set the value for this element's gphoto:numphotos attribute.
418 * @param string $value The desired value for this attribute.
419 * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified.
421 public function setGphotoNumPhotos($value)
423 $this->_gphotoNumPhotos
= $value;
428 * Get the value for this element's gphoto:commentCount attribute.
430 * @see setGphotoCommentCount
431 * @return string The requested attribute.
433 public function getGphotoCommentCount()
435 return $this->_gphotoCommentCount
;
439 * Set the value for this element's gphoto:commentCount attribute.
441 * @param string $value The desired value for this attribute.
442 * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
444 public function setGphotoCommentCount($value)
446 $this->_gphotoCommentCount
= $value;
451 * Get the value for this element's gphoto:commentingEnabled attribute.
453 * @see setGphotoCommentingEnabled
454 * @return string The requested attribute.
456 public function getGphotoCommentingEnabled()
458 return $this->_gphotoCommentingEnabled
;
462 * Set the value for this element's gphoto:commentingEnabled attribute.
464 * @param string $value The desired value for this attribute.
465 * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
467 public function setGphotoCommentingEnabled($value)
469 $this->_gphotoCommentingEnabled
= $value;
474 * Get the value for this element's gphoto:id attribute.
477 * @return string The requested attribute.
479 public function getGphotoId()
481 return $this->_gphotoId
;
485 * Set the value for this element's gphoto:id attribute.
487 * @param string $value The desired value for this attribute.
488 * @return Zend_Gdata_Photos_Extension_Id The element being modified.
490 public function setGphotoId($value)
492 $this->_gphotoId
= $value;
497 * Get the value for this element's georss:where attribute.
499 * @see setGeoRssWhere
500 * @return string The requested attribute.
502 public function getGeoRssWhere()
504 return $this->_geoRssWhere
;
508 * Set the value for this element's georss:where attribute.
510 * @param string $value The desired value for this attribute.
511 * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified.
513 public function setGeoRssWhere($value)
515 $this->_geoRssWhere
= $value;
520 * Get the value for this element's media:group attribute.
523 * @return string The requested attribute.
525 public function getMediaGroup()
527 return $this->_mediaGroup
;
531 * Set the value for this element's media:group attribute.
533 * @param string $value The desired value for this attribute.
534 * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
536 public function setMediaGroup($value)
538 $this->_mediaGroup
= $value;
543 * Get the value for this element's gphoto:user attribute.
546 * @return string The requested attribute.
548 public function getGphotoUser()
550 return $this->_gphotoUser
;
554 * Set the value for this element's gphoto:user attribute.
556 * @param string $value The desired value for this attribute.
557 * @return Zend_Gdata_Photos_Extension_User The element being modified.
559 public function setGphotoUser($value)
561 $this->_gphotoUser
= $value;
566 * Get the value for this element's gphoto:nickname attribute.
568 * @see setGphotoNickname
569 * @return string The requested attribute.
571 public function getGphotoNickname()
573 return $this->_gphotoNickname
;
577 * Set the value for this element's gphoto:nickname attribute.
579 * @param string $value The desired value for this attribute.
580 * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
582 public function setGphotoNickname($value)
584 $this->_gphotoNickname
= $value;
589 * Get the value for this element's gphoto:timestamp attribute.
591 * @see setGphotoTimestamp
592 * @return string The requested attribute.
594 public function getGphotoTimestamp()
596 return $this->_gphotoTimestamp
;
600 * Set the value for this element's gphoto:timestamp attribute.
602 * @param string $value The desired value for this attribute.
603 * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
605 public function setGphotoTimestamp($value)
607 $this->_gphotoTimestamp
= $value;