File indexing completed on 2024-12-22 05:36:45

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Photos
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Photos
0026  */
0027 // require_once 'Zend/Gdata/Photos.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Feed
0031  */
0032 // require_once 'Zend/Gdata/Feed.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Photos_AlbumEntry
0036  */
0037 // require_once 'Zend/Gdata/Photos/AlbumEntry.php';
0038 
0039 /**
0040  * Data model for a collection of album entries, usually
0041  * provided by the servers.
0042  *
0043  * For information on requesting this feed from a server, see the
0044  * service class, Zend_Gdata_Photos.
0045  *
0046  * @category   Zend
0047  * @package    Zend_Gdata
0048  * @subpackage Photos
0049  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0050  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0051  */
0052 class Zend_Gdata_Photos_AlbumFeed extends Zend_Gdata_Feed
0053 {
0054     protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry';
0055     protected $_feedClassName = 'Zend_Gdata_Photos_AlbumFeed';
0056 
0057     /**
0058      * gphoto:id element
0059      *
0060      * @var Zend_Gdata_Photos_Extension_Id
0061      */
0062     protected $_gphotoId = null;
0063 
0064     /**
0065      * gphoto:user element
0066      *
0067      * @var Zend_Gdata_Photos_Extension_User
0068      */
0069     protected $_gphotoUser = null;
0070 
0071     /**
0072      * gphoto:access element
0073      *
0074      * @var Zend_Gdata_Photos_Extension_Access
0075      */
0076     protected $_gphotoAccess = null;
0077 
0078     /**
0079      * gphoto:location element
0080      *
0081      * @var Zend_Gdata_Photos_Extension_Location
0082      */
0083     protected $_gphotoLocation = null;
0084 
0085     /**
0086      * gphoto:nickname element
0087      *
0088      * @var Zend_Gdata_Photos_Extension_Nickname
0089      */
0090     protected $_gphotoNickname = null;
0091 
0092     /**
0093      * gphoto:timestamp element
0094      *
0095      * @var Zend_Gdata_Photos_Extension_Timestamp
0096      */
0097     protected $_gphotoTimestamp = null;
0098 
0099     /**
0100      * gphoto:name element
0101      *
0102      * @var Zend_Gdata_Photos_Extension_Name
0103      */
0104     protected $_gphotoName = null;
0105 
0106     /**
0107      * gphoto:numphotos element
0108      *
0109      * @var Zend_Gdata_Photos_Extension_NumPhotos
0110      */
0111     protected $_gphotoNumPhotos = null;
0112 
0113     /**
0114      * gphoto:commentCount element
0115      *
0116      * @var Zend_Gdata_Photos_Extension_CommentCount
0117      */
0118     protected $_gphotoCommentCount = null;
0119 
0120     /**
0121      * gphoto:commentingEnabled element
0122      *
0123      * @var Zend_Gdata_Photos_Extension_CommentingEnabled
0124      */
0125     protected $_gphotoCommentingEnabled = null;
0126 
0127     protected $_entryKindClassMapping = array(
0128         'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry',
0129         'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry',
0130         'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry'
0131     );
0132 
0133     public function __construct($element = null)
0134     {
0135         $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
0136         parent::__construct($element);
0137     }
0138 
0139     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0140     {
0141         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0142         if ($this->_gphotoId != null) {
0143             $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
0144         }
0145         if ($this->_gphotoUser != null) {
0146             $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
0147         }
0148         if ($this->_gphotoNickname != null) {
0149             $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
0150         }
0151         if ($this->_gphotoName != null) {
0152             $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument));
0153         }
0154         if ($this->_gphotoLocation != null) {
0155             $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument));
0156         }
0157         if ($this->_gphotoAccess != null) {
0158             $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument));
0159         }
0160         if ($this->_gphotoTimestamp != null) {
0161             $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
0162         }
0163         if ($this->_gphotoNumPhotos != null) {
0164             $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument));
0165         }
0166         if ($this->_gphotoCommentingEnabled != null) {
0167             $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
0168         }
0169         if ($this->_gphotoCommentCount != null) {
0170             $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
0171         }
0172 
0173         return $element;
0174     }
0175 
0176     protected function takeChildFromDOM($child)
0177     {
0178         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0179 
0180         switch ($absoluteNodeName) {
0181             case $this->lookupNamespace('gphoto') . ':' . 'id';
0182                 $id = new Zend_Gdata_Photos_Extension_Id();
0183                 $id->transferFromDOM($child);
0184                 $this->_gphotoId = $id;
0185                 break;
0186             case $this->lookupNamespace('gphoto') . ':' . 'user';
0187                 $user = new Zend_Gdata_Photos_Extension_User();
0188                 $user->transferFromDOM($child);
0189                 $this->_gphotoUser = $user;
0190                 break;
0191             case $this->lookupNamespace('gphoto') . ':' . 'nickname';
0192                 $nickname = new Zend_Gdata_Photos_Extension_Nickname();
0193                 $nickname->transferFromDOM($child);
0194                 $this->_gphotoNickname = $nickname;
0195                 break;
0196             case $this->lookupNamespace('gphoto') . ':' . 'name';
0197                 $name = new Zend_Gdata_Photos_Extension_Name();
0198                 $name->transferFromDOM($child);
0199                 $this->_gphotoName = $name;
0200                 break;
0201             case $this->lookupNamespace('gphoto') . ':' . 'location';
0202                 $location = new Zend_Gdata_Photos_Extension_Location();
0203                 $location->transferFromDOM($child);
0204                 $this->_gphotoLocation = $location;
0205                 break;
0206             case $this->lookupNamespace('gphoto') . ':' . 'access';
0207                 $access = new Zend_Gdata_Photos_Extension_Access();
0208                 $access->transferFromDOM($child);
0209                 $this->_gphotoAccess = $access;
0210                 break;
0211             case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
0212                 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
0213                 $timestamp->transferFromDOM($child);
0214                 $this->_gphotoTimestamp = $timestamp;
0215                 break;
0216             case $this->lookupNamespace('gphoto') . ':' . 'numphotos';
0217                 $numphotos = new Zend_Gdata_Photos_Extension_NumPhotos();
0218                 $numphotos->transferFromDOM($child);
0219                 $this->_gphotoNumPhotos = $numphotos;
0220                 break;
0221             case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
0222                 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
0223                 $commentingEnabled->transferFromDOM($child);
0224                 $this->_gphotoCommentingEnabled = $commentingEnabled;
0225                 break;
0226             case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
0227                 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
0228                 $commentCount->transferFromDOM($child);
0229                 $this->_gphotoCommentCount = $commentCount;
0230                 break;
0231             case $this->lookupNamespace('atom') . ':' . 'entry':
0232                 $entryClassName = $this->_entryClassName;
0233                 $tmpEntry = new Zend_Gdata_App_Entry($child);
0234                 $categories = $tmpEntry->getCategory();
0235                 foreach ($categories as $category) {
0236                     if ($category->scheme == Zend_Gdata_Photos::KIND_PATH &&
0237                         $this->_entryKindClassMapping[$category->term] != "") {
0238                             $entryClassName = $this->_entryKindClassMapping[$category->term];
0239                             break;
0240                     } else {
0241                         // require_once 'Zend/Gdata/App/Exception.php';
0242                         throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.');
0243                     }
0244                 }
0245 
0246                 $newEntry = new $entryClassName($child);
0247                 $newEntry->setHttpClient($this->getHttpClient());
0248                 $this->_entry[] = $newEntry;
0249                 break;
0250             default:
0251                 parent::takeChildFromDOM($child);
0252                 break;
0253         }
0254     }
0255 
0256     /**
0257      * Get the value for this element's gphoto:user attribute.
0258      *
0259      * @see setGphotoUser
0260      * @return string The requested attribute.
0261      */
0262     public function getGphotoUser()
0263     {
0264         return $this->_gphotoUser;
0265     }
0266 
0267     /**
0268      * Set the value for this element's gphoto:user attribute.
0269      *
0270      * @param string $value The desired value for this attribute.
0271      * @return Zend_Gdata_Photos_Extension_User The element being modified.
0272      */
0273     public function setGphotoUser($value)
0274     {
0275         $this->_gphotoUser = $value;
0276         return $this;
0277     }
0278 
0279     /**
0280      * Get the value for this element's gphoto:access attribute.
0281      *
0282      * @see setGphotoAccess
0283      * @return string The requested attribute.
0284      */
0285     public function getGphotoAccess()
0286     {
0287         return $this->_gphotoAccess;
0288     }
0289 
0290     /**
0291      * Set the value for this element's gphoto:access attribute.
0292      *
0293      * @param string $value The desired value for this attribute.
0294      * @return Zend_Gdata_Photos_Extension_Access The element being modified.
0295      */
0296     public function setGphotoAccess($value)
0297     {
0298         $this->_gphotoAccess = $value;
0299         return $this;
0300     }
0301 
0302     /**
0303      * Get the value for this element's gphoto:location attribute.
0304      *
0305      * @see setGphotoLocation
0306      * @return string The requested attribute.
0307      */
0308     public function getGphotoLocation()
0309     {
0310         return $this->_gphotoLocation;
0311     }
0312 
0313     /**
0314      * Set the value for this element's gphoto:location attribute.
0315      *
0316      * @param string $value The desired value for this attribute.
0317      * @return Zend_Gdata_Photos_Extension_Location The element being modified.
0318      */
0319     public function setGphotoLocation($value)
0320     {
0321         $this->_gphotoLocation = $value;
0322         return $this;
0323     }
0324 
0325     /**
0326      * Get the value for this element's gphoto:name attribute.
0327      *
0328      * @see setGphotoName
0329      * @return string The requested attribute.
0330      */
0331     public function getGphotoName()
0332     {
0333         return $this->_gphotoName;
0334     }
0335 
0336     /**
0337      * Set the value for this element's gphoto:name attribute.
0338      *
0339      * @param string $value The desired value for this attribute.
0340      * @return Zend_Gdata_Photos_Extension_Name The element being modified.
0341      */
0342     public function setGphotoName($value)
0343     {
0344         $this->_gphotoName = $value;
0345         return $this;
0346     }
0347 
0348     /**
0349      * Get the value for this element's gphoto:numphotos attribute.
0350      *
0351      * @see setGphotoNumPhotos
0352      * @return string The requested attribute.
0353      */
0354     public function getGphotoNumPhotos()
0355     {
0356         return $this->_gphotoNumPhotos;
0357     }
0358 
0359     /**
0360      * Set the value for this element's gphoto:numphotos attribute.
0361      *
0362      * @param string $value The desired value for this attribute.
0363      * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified.
0364      */
0365     public function setGphotoNumPhotos($value)
0366     {
0367         $this->_gphotoNumPhotos = $value;
0368         return $this;
0369     }
0370 
0371     /**
0372      * Get the value for this element's gphoto:commentCount attribute.
0373      *
0374      * @see setGphotoCommentCount
0375      * @return string The requested attribute.
0376      */
0377     public function getGphotoCommentCount()
0378     {
0379         return $this->_gphotoCommentCount;
0380     }
0381 
0382     /**
0383      * Set the value for this element's gphoto:commentCount attribute.
0384      *
0385      * @param string $value The desired value for this attribute.
0386      * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
0387      */
0388     public function setGphotoCommentCount($value)
0389     {
0390         $this->_gphotoCommentCount = $value;
0391         return $this;
0392     }
0393 
0394     /**
0395      * Get the value for this element's gphoto:commentingEnabled attribute.
0396      *
0397      * @see setGphotoCommentingEnabled
0398      * @return string The requested attribute.
0399      */
0400     public function getGphotoCommentingEnabled()
0401     {
0402         return $this->_gphotoCommentingEnabled;
0403     }
0404 
0405     /**
0406      * Set the value for this element's gphoto:commentingEnabled attribute.
0407      *
0408      * @param string $value The desired value for this attribute.
0409      * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
0410      */
0411     public function setGphotoCommentingEnabled($value)
0412     {
0413         $this->_gphotoCommentingEnabled = $value;
0414         return $this;
0415     }
0416 
0417     /**
0418      * Get the value for this element's gphoto:id attribute.
0419      *
0420      * @see setGphotoId
0421      * @return string The requested attribute.
0422      */
0423     public function getGphotoId()
0424     {
0425         return $this->_gphotoId;
0426     }
0427 
0428     /**
0429      * Set the value for this element's gphoto:id attribute.
0430      *
0431      * @param string $value The desired value for this attribute.
0432      * @return Zend_Gdata_Photos_Extension_Id The element being modified.
0433      */
0434     public function setGphotoId($value)
0435     {
0436         $this->_gphotoId = $value;
0437         return $this;
0438     }
0439 
0440     /**
0441      * Get the value for this element's georss:where attribute.
0442      *
0443      * @see setGeoRssWhere
0444      * @return string The requested attribute.
0445      */
0446     public function getGeoRssWhere()
0447     {
0448         return $this->_geoRssWhere;
0449     }
0450 
0451     /**
0452      * Set the value for this element's georss:where attribute.
0453      *
0454      * @param string $value The desired value for this attribute.
0455      * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified.
0456      */
0457     public function setGeoRssWhere($value)
0458     {
0459         $this->_geoRssWhere = $value;
0460         return $this;
0461     }
0462 
0463     /**
0464      * Get the value for this element's gphoto:nickname attribute.
0465      *
0466      * @see setGphotoNickname
0467      * @return string The requested attribute.
0468      */
0469     public function getGphotoNickname()
0470     {
0471         return $this->_gphotoNickname;
0472     }
0473 
0474     /**
0475      * Set the value for this element's gphoto:nickname attribute.
0476      *
0477      * @param string $value The desired value for this attribute.
0478      * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
0479      */
0480     public function setGphotoNickname($value)
0481     {
0482         $this->_gphotoNickname = $value;
0483         return $this;
0484     }
0485 
0486     /**
0487      * Get the value for this element's gphoto:timestamp attribute.
0488      *
0489      * @see setGphotoTimestamp
0490      * @return string The requested attribute.
0491      */
0492     public function getGphotoTimestamp()
0493     {
0494         return $this->_gphotoTimestamp;
0495     }
0496 
0497     /**
0498      * Set the value for this element's gphoto:timestamp attribute.
0499      *
0500      * @param string $value The desired value for this attribute.
0501      * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
0502      */
0503     public function setGphotoTimestamp($value)
0504     {
0505         $this->_gphotoTimestamp = $value;
0506         return $this;
0507     }
0508 
0509 }