web/lib/Zend/Gdata/Photos/AlbumEntry.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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-2010 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 20096 2010-01-06 02:05:09Z bkarwin $
       
    22  */
       
    23 
       
    24 /**
       
    25  * @see Zend_Gdata_Entry
       
    26  */
       
    27 require_once 'Zend/Gdata/Entry.php';
       
    28 
       
    29 /**
       
    30  * @see Zend_Gdata_Photos_Extension_Access
       
    31  */
       
    32 require_once 'Zend/Gdata/Photos/Extension/Access.php';
       
    33 
       
    34 /**
       
    35  * @see Zend_Gdata_Photos_Extension_BytesUsed
       
    36  */
       
    37 require_once 'Zend/Gdata/Photos/Extension/BytesUsed.php';
       
    38 
       
    39 /**
       
    40  * @see Zend_Gdata_Photos_Extension_Location
       
    41  */
       
    42 require_once 'Zend/Gdata/Photos/Extension/Location.php';
       
    43 
       
    44 /**
       
    45  * @see Zend_Gdata_Photos_Extension_Name
       
    46  */
       
    47 require_once 'Zend/Gdata/Photos/Extension/Name.php';
       
    48 
       
    49 /**
       
    50  * @see Zend_Gdata_Photos_Extension_NumPhotos
       
    51  */
       
    52 require_once 'Zend/Gdata/Photos/Extension/NumPhotos.php';
       
    53 
       
    54 /**
       
    55  * @see Zend_Gdata_Photos_Extension_NumPhotosRemaining
       
    56  */
       
    57 require_once 'Zend/Gdata/Photos/Extension/NumPhotosRemaining.php';
       
    58 
       
    59 /**
       
    60  * @see Zend_Gdata_Photos_Extension_CommentCount
       
    61  */
       
    62 require_once 'Zend/Gdata/Photos/Extension/CommentCount.php';
       
    63 
       
    64 /**
       
    65  * @see Zend_Gdata_Photos_Extension_CommentingEnabled
       
    66  */
       
    67 require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php';
       
    68 
       
    69 /**
       
    70  * @see Zend_Gdata_Photos_Extension_Id
       
    71  */
       
    72 require_once 'Zend/Gdata/Photos/Extension/Id.php';
       
    73 
       
    74 /**
       
    75  * @see Zend_Gdata_Geo_Extension_GeoRssWhere
       
    76  */
       
    77 require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php';
       
    78 
       
    79 /**
       
    80  * @see Zend_Gdata_Media_Extension_MediaGroup
       
    81  */
       
    82 require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
       
    83 
       
    84 /**
       
    85  * @see Zend_Gdata_App_Extension_Category
       
    86  */
       
    87 require_once 'Zend/Gdata/App/Extension/Category.php';
       
    88 
       
    89 /**
       
    90  * Data model class for a Photo Album Entry.
       
    91  *
       
    92  * To transfer user entries to and from the servers, including
       
    93  * creating new entries, refer to the service class,
       
    94  * Zend_Gdata_Photos.
       
    95  *
       
    96  * This class represents <atom:entry> in the Google Data protocol.
       
    97  *
       
    98  * @category   Zend
       
    99  * @package    Zend_Gdata
       
   100  * @subpackage Photos
       
   101  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
   102  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
   103  */
       
   104 class Zend_Gdata_Photos_AlbumEntry extends Zend_Gdata_Entry
       
   105 {
       
   106 
       
   107     protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry';
       
   108 
       
   109     /**
       
   110      * gphoto:id element
       
   111      *
       
   112      * @var Zend_Gdata_Photos_Extension_Id
       
   113      */
       
   114     protected $_gphotoId = null;
       
   115 
       
   116     /**
       
   117      * gphoto:access element
       
   118      *
       
   119      * @var Zend_Gdata_Photos_Extension_Access
       
   120      */
       
   121     protected $_gphotoAccess = null;
       
   122 
       
   123     /**
       
   124      * gphoto:location element
       
   125      *
       
   126      * @var Zend_Gdata_Photos_Extension_Location
       
   127      */
       
   128     protected $_gphotoLocation = null;
       
   129 
       
   130     /**
       
   131      * gphoto:user element
       
   132      *
       
   133      * @var Zend_Gdata_Photos_Extension_User
       
   134      */
       
   135     protected $_gphotoUser = null;
       
   136 
       
   137     /**
       
   138      * gphoto:nickname element
       
   139      *
       
   140      * @var Zend_Gdata_Photos_Extension_Nickname
       
   141      */
       
   142     protected $_gphotoNickname = null;
       
   143 
       
   144     /**
       
   145      * gphoto:timestamp element
       
   146      *
       
   147      * @var Zend_Gdata_Photos_Extension_Timestamp
       
   148      */
       
   149     protected $_gphotoTimestamp = null;
       
   150 
       
   151     /**
       
   152      * gphoto:name element
       
   153      *
       
   154      * @var Zend_Gdata_Photos_Extension_Name
       
   155      */
       
   156     protected $_gphotoName = null;
       
   157 
       
   158     /**
       
   159      * gphoto:numphotos element
       
   160      *
       
   161      * @var Zend_Gdata_Photos_Extension_NumPhotos
       
   162      */
       
   163     protected $_gphotoNumPhotos = null;
       
   164 
       
   165     /**
       
   166      * gphoto:commentCount element
       
   167      *
       
   168      * @var Zend_Gdata_Photos_Extension_CommentCount
       
   169      */
       
   170     protected $_gphotoCommentCount = null;
       
   171 
       
   172     /**
       
   173      * gphoto:commentingEnabled element
       
   174      *
       
   175      * @var Zend_Gdata_Photos_Extension_CommentingEnabled
       
   176      */
       
   177     protected $_gphotoCommentingEnabled = null;
       
   178 
       
   179     /**
       
   180      * media:group element
       
   181      *
       
   182      * @var Zend_Gdata_Media_MediaGroup
       
   183      */
       
   184     protected $_mediaGroup = null;
       
   185 
       
   186     /**
       
   187      * georss:where element
       
   188      *
       
   189      * @var Zend_Gdata_Geo_Extension_GeoRssWhere
       
   190      */
       
   191     protected $_geoRssWhere = null;
       
   192 
       
   193     /**
       
   194      * Create a new instance.
       
   195      *
       
   196      * @param DOMElement $element (optional) DOMElement from which this
       
   197      *          object should be constructed.
       
   198      */
       
   199     public function __construct($element = null)
       
   200     {
       
   201         $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
       
   202         parent::__construct($element);
       
   203 
       
   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));
       
   208     }
       
   209 
       
   210     /**
       
   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.
       
   214      *
       
   215      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
       
   216      * @return DOMElement The DOMElement representing this element and all
       
   217      *          child properties.
       
   218      */
       
   219     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
       
   220     {
       
   221         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
       
   222         if ($this->_gphotoTimestamp !== null) {
       
   223             $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
       
   224         }
       
   225         if ($this->_gphotoUser !== null) {
       
   226             $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
       
   227         }
       
   228         if ($this->_gphotoNickname !== null) {
       
   229             $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
       
   230         }
       
   231         if ($this->_gphotoAccess !== null) {
       
   232             $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument));
       
   233         }
       
   234         if ($this->_gphotoLocation !== null) {
       
   235             $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument));
       
   236         }
       
   237         if ($this->_gphotoName !== null) {
       
   238             $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument));
       
   239         }
       
   240         if ($this->_gphotoNumPhotos !== null) {
       
   241             $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument));
       
   242         }
       
   243         if ($this->_gphotoCommentCount !== null) {
       
   244             $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
       
   245         }
       
   246         if ($this->_gphotoCommentingEnabled !== null) {
       
   247             $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
       
   248         }
       
   249         if ($this->_gphotoId !== null) {
       
   250             $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
       
   251         }
       
   252         if ($this->_mediaGroup !== null) {
       
   253             $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
       
   254         }
       
   255         return $element;
       
   256     }
       
   257 
       
   258     /**
       
   259      * Creates individual Entry objects of the appropriate type and
       
   260      * stores them as members of this entry based upon DOM data.
       
   261      *
       
   262      * @param DOMNode $child The DOMNode to process
       
   263      */
       
   264     protected function takeChildFromDOM($child)
       
   265     {
       
   266         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
       
   267 
       
   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;
       
   273                 break;
       
   274             case $this->lookupNamespace('gphoto') . ':' . 'location';
       
   275                 $location = new Zend_Gdata_Photos_Extension_Location();
       
   276                 $location->transferFromDOM($child);
       
   277                 $this->_gphotoLocation = $location;
       
   278                 break;
       
   279             case $this->lookupNamespace('gphoto') . ':' . 'name';
       
   280                 $name = new Zend_Gdata_Photos_Extension_Name();
       
   281                 $name->transferFromDOM($child);
       
   282                 $this->_gphotoName = $name;
       
   283                 break;
       
   284             case $this->lookupNamespace('gphoto') . ':' . 'numphotos';
       
   285                 $numPhotos = new Zend_Gdata_Photos_Extension_NumPhotos();
       
   286                 $numPhotos->transferFromDOM($child);
       
   287                 $this->_gphotoNumPhotos = $numPhotos;
       
   288                 break;
       
   289             case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
       
   290                 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
       
   291                 $commentCount->transferFromDOM($child);
       
   292                 $this->_gphotoCommentCount = $commentCount;
       
   293                 break;
       
   294             case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
       
   295                 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
       
   296                 $commentingEnabled->transferFromDOM($child);
       
   297                 $this->_gphotoCommentingEnabled = $commentingEnabled;
       
   298                 break;
       
   299             case $this->lookupNamespace('gphoto') . ':' . 'id';
       
   300                 $id = new Zend_Gdata_Photos_Extension_Id();
       
   301                 $id->transferFromDOM($child);
       
   302                 $this->_gphotoId = $id;
       
   303                 break;
       
   304             case $this->lookupNamespace('gphoto') . ':' . 'user';
       
   305                 $user = new Zend_Gdata_Photos_Extension_User();
       
   306                 $user->transferFromDOM($child);
       
   307                 $this->_gphotoUser = $user;
       
   308                 break;
       
   309             case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
       
   310                 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
       
   311                 $timestamp->transferFromDOM($child);
       
   312                 $this->_gphotoTimestamp = $timestamp;
       
   313                 break;
       
   314             case $this->lookupNamespace('gphoto') . ':' . 'nickname';
       
   315                 $nickname = new Zend_Gdata_Photos_Extension_Nickname();
       
   316                 $nickname->transferFromDOM($child);
       
   317                 $this->_gphotoNickname = $nickname;
       
   318                 break;
       
   319             case $this->lookupNamespace('georss') . ':' . 'where';
       
   320                 $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere();
       
   321                 $geoRssWhere->transferFromDOM($child);
       
   322                 $this->_geoRssWhere = $geoRssWhere;
       
   323                 break;
       
   324             case $this->lookupNamespace('media') . ':' . 'group';
       
   325                 $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
       
   326                 $mediaGroup->transferFromDOM($child);
       
   327                 $this->_mediaGroup = $mediaGroup;
       
   328                 break;
       
   329             default:
       
   330                 parent::takeChildFromDOM($child);
       
   331                 break;
       
   332         }
       
   333     }
       
   334 
       
   335     /**
       
   336      * Get the value for this element's gphoto:access attribute.
       
   337      *
       
   338      * @see setGphotoAccess
       
   339      * @return string The requested attribute.
       
   340      */
       
   341     public function getGphotoAccess()
       
   342     {
       
   343         return $this->_gphotoAccess;
       
   344     }
       
   345 
       
   346     /**
       
   347      * Set the value for this element's gphoto:access attribute.
       
   348      *
       
   349      * @param string $value The desired value for this attribute.
       
   350      * @return Zend_Gdata_Photos_Extension_Access The element being modified.
       
   351      */
       
   352     public function setGphotoAccess($value)
       
   353     {
       
   354         $this->_gphotoAccess = $value;
       
   355         return $this;
       
   356     }
       
   357 
       
   358     /**
       
   359      * Get the value for this element's gphoto:location attribute.
       
   360      *
       
   361      * @see setGphotoLocation
       
   362      * @return string The requested attribute.
       
   363      */
       
   364     public function getGphotoLocation()
       
   365     {
       
   366         return $this->_gphotoLocation;
       
   367     }
       
   368 
       
   369     /**
       
   370      * Set the value for this element's gphoto:location attribute.
       
   371      *
       
   372      * @param string $value The desired value for this attribute.
       
   373      * @return Zend_Gdata_Photos_Extension_Location The element being modified.
       
   374      */
       
   375     public function setGphotoLocation($value)
       
   376     {
       
   377         $this->_location = $value;
       
   378         return $this;
       
   379     }
       
   380 
       
   381     /**
       
   382      * Get the value for this element's gphoto:name attribute.
       
   383      *
       
   384      * @see setGphotoName
       
   385      * @return string The requested attribute.
       
   386      */
       
   387     public function getGphotoName()
       
   388     {
       
   389         return $this->_gphotoName;
       
   390     }
       
   391 
       
   392     /**
       
   393      * Set the value for this element's gphoto:name attribute.
       
   394      *
       
   395      * @param string $value The desired value for this attribute.
       
   396      * @return Zend_Gdata_Photos_Extension_Name The element being modified.
       
   397      */
       
   398     public function setGphotoName($value)
       
   399     {
       
   400         $this->_gphotoName = $value;
       
   401         return $this;
       
   402     }
       
   403 
       
   404     /**
       
   405      * Get the value for this element's gphoto:numphotos attribute.
       
   406      *
       
   407      * @see setGphotoNumPhotos
       
   408      * @return string The requested attribute.
       
   409      */
       
   410     public function getGphotoNumPhotos()
       
   411     {
       
   412         return $this->_gphotoNumPhotos;
       
   413     }
       
   414 
       
   415     /**
       
   416      * Set the value for this element's gphoto:numphotos attribute.
       
   417      *
       
   418      * @param string $value The desired value for this attribute.
       
   419      * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified.
       
   420      */
       
   421     public function setGphotoNumPhotos($value)
       
   422     {
       
   423         $this->_gphotoNumPhotos = $value;
       
   424         return $this;
       
   425     }
       
   426 
       
   427     /**
       
   428      * Get the value for this element's gphoto:commentCount attribute.
       
   429      *
       
   430      * @see setGphotoCommentCount
       
   431      * @return string The requested attribute.
       
   432      */
       
   433     public function getGphotoCommentCount()
       
   434     {
       
   435         return $this->_gphotoCommentCount;
       
   436     }
       
   437 
       
   438     /**
       
   439      * Set the value for this element's gphoto:commentCount attribute.
       
   440      *
       
   441      * @param string $value The desired value for this attribute.
       
   442      * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
       
   443      */
       
   444     public function setGphotoCommentCount($value)
       
   445     {
       
   446         $this->_gphotoCommentCount = $value;
       
   447         return $this;
       
   448     }
       
   449 
       
   450     /**
       
   451      * Get the value for this element's gphoto:commentingEnabled attribute.
       
   452      *
       
   453      * @see setGphotoCommentingEnabled
       
   454      * @return string The requested attribute.
       
   455      */
       
   456     public function getGphotoCommentingEnabled()
       
   457     {
       
   458         return $this->_gphotoCommentingEnabled;
       
   459     }
       
   460 
       
   461     /**
       
   462      * Set the value for this element's gphoto:commentingEnabled attribute.
       
   463      *
       
   464      * @param string $value The desired value for this attribute.
       
   465      * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
       
   466      */
       
   467     public function setGphotoCommentingEnabled($value)
       
   468     {
       
   469         $this->_gphotoCommentingEnabled = $value;
       
   470         return $this;
       
   471     }
       
   472 
       
   473     /**
       
   474      * Get the value for this element's gphoto:id attribute.
       
   475      *
       
   476      * @see setGphotoId
       
   477      * @return string The requested attribute.
       
   478      */
       
   479     public function getGphotoId()
       
   480     {
       
   481         return $this->_gphotoId;
       
   482     }
       
   483 
       
   484     /**
       
   485      * Set the value for this element's gphoto:id attribute.
       
   486      *
       
   487      * @param string $value The desired value for this attribute.
       
   488      * @return Zend_Gdata_Photos_Extension_Id The element being modified.
       
   489      */
       
   490     public function setGphotoId($value)
       
   491     {
       
   492         $this->_gphotoId = $value;
       
   493         return $this;
       
   494     }
       
   495 
       
   496     /**
       
   497      * Get the value for this element's georss:where attribute.
       
   498      *
       
   499      * @see setGeoRssWhere
       
   500      * @return string The requested attribute.
       
   501      */
       
   502     public function getGeoRssWhere()
       
   503     {
       
   504         return $this->_geoRssWhere;
       
   505     }
       
   506 
       
   507     /**
       
   508      * Set the value for this element's georss:where attribute.
       
   509      *
       
   510      * @param string $value The desired value for this attribute.
       
   511      * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified.
       
   512      */
       
   513     public function setGeoRssWhere($value)
       
   514     {
       
   515         $this->_geoRssWhere = $value;
       
   516         return $this;
       
   517     }
       
   518 
       
   519     /**
       
   520      * Get the value for this element's media:group attribute.
       
   521      *
       
   522      * @see setMediaGroup
       
   523      * @return string The requested attribute.
       
   524      */
       
   525     public function getMediaGroup()
       
   526     {
       
   527         return $this->_mediaGroup;
       
   528     }
       
   529 
       
   530     /**
       
   531      * Set the value for this element's media:group attribute.
       
   532      *
       
   533      * @param string $value The desired value for this attribute.
       
   534      * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
       
   535      */
       
   536     public function setMediaGroup($value)
       
   537     {
       
   538         $this->_mediaGroup = $value;
       
   539         return $this;
       
   540     }
       
   541 
       
   542     /**
       
   543      * Get the value for this element's gphoto:user attribute.
       
   544      *
       
   545      * @see setGphotoUser
       
   546      * @return string The requested attribute.
       
   547      */
       
   548     public function getGphotoUser()
       
   549     {
       
   550         return $this->_gphotoUser;
       
   551     }
       
   552 
       
   553     /**
       
   554      * Set the value for this element's gphoto:user attribute.
       
   555      *
       
   556      * @param string $value The desired value for this attribute.
       
   557      * @return Zend_Gdata_Photos_Extension_User The element being modified.
       
   558      */
       
   559     public function setGphotoUser($value)
       
   560     {
       
   561         $this->_gphotoUser = $value;
       
   562         return $this;
       
   563     }
       
   564 
       
   565     /**
       
   566      * Get the value for this element's gphoto:nickname attribute.
       
   567      *
       
   568      * @see setGphotoNickname
       
   569      * @return string The requested attribute.
       
   570      */
       
   571     public function getGphotoNickname()
       
   572     {
       
   573         return $this->_gphotoNickname;
       
   574     }
       
   575 
       
   576     /**
       
   577      * Set the value for this element's gphoto:nickname attribute.
       
   578      *
       
   579      * @param string $value The desired value for this attribute.
       
   580      * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
       
   581      */
       
   582     public function setGphotoNickname($value)
       
   583     {
       
   584         $this->_gphotoNickname = $value;
       
   585         return $this;
       
   586     }
       
   587 
       
   588     /**
       
   589      * Get the value for this element's gphoto:timestamp attribute.
       
   590      *
       
   591      * @see setGphotoTimestamp
       
   592      * @return string The requested attribute.
       
   593      */
       
   594     public function getGphotoTimestamp()
       
   595     {
       
   596         return $this->_gphotoTimestamp;
       
   597     }
       
   598 
       
   599     /**
       
   600      * Set the value for this element's gphoto:timestamp attribute.
       
   601      *
       
   602      * @param string $value The desired value for this attribute.
       
   603      * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
       
   604      */
       
   605     public function setGphotoTimestamp($value)
       
   606     {
       
   607         $this->_gphotoTimestamp = $value;
       
   608         return $this;
       
   609     }
       
   610 }