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

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_Entry
0026  */
0027 // require_once 'Zend/Gdata/Entry.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Gapps
0031  */
0032 // require_once 'Zend/Gdata/Gapps.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Photos_Extension_Nickname
0036  */
0037 // require_once 'Zend/Gdata/Photos/Extension/Nickname.php';
0038 
0039 /**
0040  * @see Zend_Gdata_Photos_Extension_Thumbnail
0041  */
0042 // require_once 'Zend/Gdata/Photos/Extension/Thumbnail.php';
0043 
0044 /**
0045  * @see Zend_Gdata_Photos_Extension_QuotaCurrent
0046  */
0047 // require_once 'Zend/Gdata/Photos/Extension/QuotaCurrent.php';
0048 
0049 /**
0050  * @see Zend_Gdata_Photos_Extension_QuotaLimit
0051  */
0052 // require_once 'Zend/Gdata/Photos/Extension/QuotaLimit.php';
0053 
0054 /**
0055  * @see Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum
0056  */
0057 // require_once 'Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php';
0058 
0059 /**
0060  * @see Zend_Gdata_Photos_Extension_User
0061  */
0062 // require_once 'Zend/Gdata/Photos/Extension/User.php';
0063 
0064 /**
0065  * @see Zend_Gdata_App_Extension_Category
0066  */
0067 // require_once 'Zend/Gdata/App/Extension/Category.php';
0068 
0069 /**
0070  * Data model class for a User Entry.
0071  *
0072  * To transfer user entries to and from the servers, including
0073  * creating new entries, refer to the service class,
0074  * Zend_Gdata_Photos.
0075  *
0076  * This class represents <atom:entry> in the Google Data protocol.
0077  *
0078  * @category   Zend
0079  * @package    Zend_Gdata
0080  * @subpackage Photos
0081  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0082  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0083  */
0084 class Zend_Gdata_Photos_UserEntry extends Zend_Gdata_Entry
0085 {
0086 
0087     protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry';
0088 
0089     /**
0090      * gphoto:nickname element
0091      *
0092      * @var Zend_Gdata_Photos_Extension_Nickname
0093      */
0094     protected $_gphotoNickname = null;
0095 
0096     /**
0097      * gphoto:user element
0098      *
0099      * @var Zend_Gdata_Photos_Extension_User
0100      */
0101     protected $_gphotoUser = null;
0102 
0103     /**
0104      * gphoto:thumbnail element
0105      *
0106      * @var Zend_Gdata_Photos_Extension_Thumbnail
0107      */
0108     protected $_gphotoThumbnail = null;
0109 
0110     /**
0111      * gphoto:quotalimit element
0112      *
0113      * @var Zend_Gdata_Photos_Extension_QuotaLimit
0114      */
0115     protected $_gphotoQuotaLimit = null;
0116 
0117     /**
0118      * gphoto:quotacurrent element
0119      *
0120      * @var Zend_Gdata_Photos_Extension_QuotaCurrent
0121      */
0122     protected $_gphotoQuotaCurrent = null;
0123 
0124     /**
0125      * gphoto:maxPhotosPerAlbum element
0126      *
0127      * @var Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum
0128      */
0129     protected $_gphotoMaxPhotosPerAlbum = null;
0130 
0131     /**
0132      * Create a new instance.
0133      *
0134      * @param DOMElement $element (optional) DOMElement from which this
0135      *          object should be constructed.
0136      */
0137     public function __construct($element = null)
0138     {
0139         $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
0140         parent::__construct($element);
0141 
0142         $category = new Zend_Gdata_App_Extension_Category(
0143             'http://schemas.google.com/photos/2007#user',
0144             'http://schemas.google.com/g/2005#kind');
0145         $this->setCategory(array($category));
0146     }
0147 
0148     /**
0149      * Retrieves a DOMElement which corresponds to this element and all
0150      * child properties.  This is used to build an entry back into a DOM
0151      * and eventually XML text for application storage/persistence.
0152      *
0153      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0154      * @return DOMElement The DOMElement representing this element and all
0155      *          child properties.
0156      */
0157     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0158     {
0159         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0160         if ($this->_gphotoNickname !== null) {
0161             $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
0162         }
0163         if ($this->_gphotoThumbnail !== null) {
0164             $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument));
0165         }
0166         if ($this->_gphotoUser !== null) {
0167             $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
0168         }
0169         if ($this->_gphotoQuotaCurrent !== null) {
0170             $element->appendChild($this->_gphotoQuotaCurrent->getDOM($element->ownerDocument));
0171         }
0172         if ($this->_gphotoQuotaLimit !== null) {
0173             $element->appendChild($this->_gphotoQuotaLimit->getDOM($element->ownerDocument));
0174         }
0175         if ($this->_gphotoMaxPhotosPerAlbum !== null) {
0176             $element->appendChild($this->_gphotoMaxPhotosPerAlbum->getDOM($element->ownerDocument));
0177         }
0178         return $element;
0179     }
0180 
0181     /**
0182      * Creates individual Entry objects of the appropriate type and
0183      * stores them as members of this entry based upon DOM data.
0184      *
0185      * @param DOMNode $child The DOMNode to process
0186      */
0187     protected function takeChildFromDOM($child)
0188     {
0189         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0190 
0191         switch ($absoluteNodeName) {
0192             case $this->lookupNamespace('gphoto') . ':' . 'nickname';
0193                 $nickname = new Zend_Gdata_Photos_Extension_Nickname();
0194                 $nickname->transferFromDOM($child);
0195                 $this->_gphotoNickname = $nickname;
0196                 break;
0197             case $this->lookupNamespace('gphoto') . ':' . 'thumbnail';
0198                 $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail();
0199                 $thumbnail->transferFromDOM($child);
0200                 $this->_gphotoThumbnail = $thumbnail;
0201                 break;
0202             case $this->lookupNamespace('gphoto') . ':' . 'user';
0203                 $user = new Zend_Gdata_Photos_Extension_User();
0204                 $user->transferFromDOM($child);
0205                 $this->_gphotoUser = $user;
0206                 break;
0207             case $this->lookupNamespace('gphoto') . ':' . 'quotacurrent';
0208                 $quotaCurrent = new Zend_Gdata_Photos_Extension_QuotaCurrent();
0209                 $quotaCurrent->transferFromDOM($child);
0210                 $this->_gphotoQuotaCurrent = $quotaCurrent;
0211                 break;
0212             case $this->lookupNamespace('gphoto') . ':' . 'quotalimit';
0213                 $quotaLimit = new Zend_Gdata_Photos_Extension_QuotaLimit();
0214                 $quotaLimit->transferFromDOM($child);
0215                 $this->_gphotoQuotaLimit = $quotaLimit;
0216                 break;
0217             case $this->lookupNamespace('gphoto') . ':' . 'maxPhotosPerAlbum';
0218                 $maxPhotosPerAlbum = new Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum();
0219                 $maxPhotosPerAlbum->transferFromDOM($child);
0220                 $this->_gphotoMaxPhotosPerAlbum = $maxPhotosPerAlbum;
0221                 break;
0222             default:
0223                 parent::takeChildFromDOM($child);
0224                 break;
0225         }
0226     }
0227 
0228     /**
0229      * Get the value for this element's gphoto:nickname attribute.
0230      *
0231      * @see setGphotoNickname
0232      * @return string The requested attribute.
0233      */
0234     public function getGphotoNickname()
0235     {
0236         return $this->_gphotoNickname;
0237     }
0238 
0239     /**
0240      * Set the value for this element's gphoto:nickname attribute.
0241      *
0242      * @param string $value The desired value for this attribute.
0243      * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
0244      */
0245     public function setGphotoNickname($value)
0246     {
0247         $this->_gphotoNickname = $value;
0248         return $this;
0249     }
0250 
0251     /**
0252      * Get the value for this element's gphoto:thumbnail attribute.
0253      *
0254      * @see setGphotoThumbnail
0255      * @return string The requested attribute.
0256      */
0257     public function getGphotoThumbnail()
0258     {
0259         return $this->_gphotoThumbnail;
0260     }
0261 
0262     /**
0263      * Set the value for this element's gphoto:thumbnail attribute.
0264      *
0265      * @param string $value The desired value for this attribute.
0266      * @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified.
0267      */
0268     public function setGphotoThumbnail($value)
0269     {
0270         $this->_gphotoThumbnail = $value;
0271         return $this;
0272     }
0273 
0274     /**
0275      * Get the value for this element's gphoto:quotacurrent attribute.
0276      *
0277      * @see setGphotoQuotaCurrent
0278      * @return string The requested attribute.
0279      */
0280     public function getGphotoQuotaCurrent()
0281     {
0282         return $this->_gphotoQuotaCurrent;
0283     }
0284 
0285     /**
0286      * Set the value for this element's gphoto:quotacurrent attribute.
0287      *
0288      * @param string $value The desired value for this attribute.
0289      * @return Zend_Gdata_Photos_Extension_QuotaCurrent The element being modified.
0290      */
0291     public function setGphotoQuotaCurrent($value)
0292     {
0293         $this->_gphotoQuotaCurrent = $value;
0294         return $this;
0295     }
0296 
0297     /**
0298      * Get the value for this element's gphoto:quotalimit attribute.
0299      *
0300      * @see setGphotoQuotaLimit
0301      * @return string The requested attribute.
0302      */
0303     public function getGphotoQuotaLimit()
0304     {
0305         return $this->_gphotoQuotaLimit;
0306     }
0307 
0308     /**
0309      * Set the value for this element's gphoto:quotalimit attribute.
0310      *
0311      * @param string $value The desired value for this attribute.
0312      * @return Zend_Gdata_Photos_Extension_QuotaLimit The element being modified.
0313      */
0314     public function setGphotoQuotaLimit($value)
0315     {
0316         $this->_gphotoQuotaLimit = $value;
0317         return $this;
0318     }
0319 
0320     /**
0321      * Get the value for this element's gphoto:maxPhotosPerAlbum attribute.
0322      *
0323      * @see setGphotoMaxPhotosPerAlbum
0324      * @return string The requested attribute.
0325      */
0326     public function getGphotoMaxPhotosPerAlbum()
0327     {
0328         return $this->_gphotoMaxPhotosPerAlbum;
0329     }
0330 
0331     /**
0332      * Set the value for this element's gphoto:maxPhotosPerAlbum attribute.
0333      *
0334      * @param string $value The desired value for this attribute.
0335      * @return Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum The element being modified.
0336      */
0337     public function setGphotoMaxPhotosPerAlbum($value)
0338     {
0339         $this->_gphotoMaxPhotosPerAlbum = $value;
0340         return $this;
0341     }
0342 
0343     /**
0344      * Get the value for this element's gphoto:user attribute.
0345      *
0346      * @see setGphotoUser
0347      * @return string The requested attribute.
0348      */
0349     public function getGphotoUser()
0350     {
0351         return $this->_gphotoUser;
0352     }
0353 
0354     /**
0355      * Set the value for this element's gphoto:user attribute.
0356      *
0357      * @param string $value The desired value for this attribute.
0358      * @return Zend_Gdata_Photos_Extension_User The element being modified.
0359      */
0360     public function setGphotoUser($value)
0361     {
0362         $this->_gphotoUser = $value;
0363         return $this;
0364     }
0365 
0366 }