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_Entry
0026  */
0027 // require_once 'Zend/Gdata/Entry.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Photos_Extension_Id
0031  */
0032 // require_once 'Zend/Gdata/Photos/Extension/Id.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Photos_Extension_PhotoId
0036  */
0037 // require_once 'Zend/Gdata/Photos/Extension/PhotoId.php';
0038 
0039 /**
0040  * @see Zend_Gdata_Photos_Extension_Weight
0041  */
0042 // require_once 'Zend/Gdata/Photos/Extension/Weight.php';
0043 
0044 /**
0045  * @see Zend_Gdata_App_Extension_Category
0046  */
0047 // require_once 'Zend/Gdata/App/Extension/Category.php';
0048 
0049 /**
0050  * Data model class for a Comment Entry.
0051  *
0052  * To transfer user entries to and from the servers, including
0053  * creating new entries, refer to the service class,
0054  * Zend_Gdata_Photos.
0055  *
0056  * This class represents <atom:entry> in the Google Data protocol.
0057  *
0058  * @category   Zend
0059  * @package    Zend_Gdata
0060  * @subpackage Photos
0061  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0062  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0063  */
0064 class Zend_Gdata_Photos_CommentEntry extends Zend_Gdata_Entry
0065 {
0066 
0067     protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry';
0068 
0069     /**
0070      * gphoto:id element
0071      *
0072      * @var Zend_Gdata_Photos_Extension_Id
0073      */
0074     protected $_gphotoId = null;
0075 
0076     /**
0077      * gphoto:photoid element, differs from gphoto:id as this is an
0078      * actual identification number unique exclusively to photo entries,
0079      * whereas gphoto:id can refer to all gphoto objects
0080      *
0081      * @var Zend_Gdata_Photos_Extension_PhotoId
0082      */
0083     protected $_gphotoPhotoId = null;
0084 
0085     /**
0086      * Create a new instance.
0087      *
0088      * @param DOMElement $element (optional) DOMElement from which this
0089      *          object should be constructed.
0090      */
0091     public function __construct($element = null)
0092     {
0093         $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
0094         parent::__construct($element);
0095 
0096         $category = new Zend_Gdata_App_Extension_Category(
0097             'http://schemas.google.com/photos/2007#comment',
0098             'http://schemas.google.com/g/2005#kind');
0099         $this->setCategory(array($category));
0100     }
0101 
0102     /**
0103      * Retrieves a DOMElement which corresponds to this element and all
0104      * child properties.  This is used to build an entry back into a DOM
0105      * and eventually XML text for application storage/persistence.
0106      *
0107      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0108      * @return DOMElement The DOMElement representing this element and all
0109      *          child properties.
0110      */
0111     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0112     {
0113         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0114         if ($this->_gphotoId !== null) {
0115             $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
0116         }
0117         if ($this->_gphotoPhotoId !== null) {
0118             $element->appendChild($this->_gphotoPhotoId->getDOM($element->ownerDocument));
0119         }
0120         return $element;
0121     }
0122 
0123     /**
0124      * Creates individual Entry objects of the appropriate type and
0125      * stores them as members of this entry based upon DOM data.
0126      *
0127      * @param DOMNode $child The DOMNode to process
0128      */
0129     protected function takeChildFromDOM($child)
0130     {
0131         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0132 
0133         switch ($absoluteNodeName) {
0134             case $this->lookupNamespace('gphoto') . ':' . 'id';
0135                 $id = new Zend_Gdata_Photos_Extension_Id();
0136                 $id->transferFromDOM($child);
0137                 $this->_gphotoId = $id;
0138                 break;
0139             case $this->lookupNamespace('gphoto') . ':' . 'photoid';
0140                 $photoid = new Zend_Gdata_Photos_Extension_PhotoId();
0141                 $photoid->transferFromDOM($child);
0142                 $this->_gphotoPhotoId = $photoid;
0143                 break;
0144             default:
0145                 parent::takeChildFromDOM($child);
0146                 break;
0147         }
0148     }
0149 
0150     /**
0151      * Get the value for this element's gphoto:photoid attribute.
0152      *
0153      * @see setGphotoPhotoId
0154      * @return string The requested attribute.
0155      */
0156     public function getGphotoPhotoId()
0157     {
0158         return $this->_gphotoPhotoId;
0159     }
0160 
0161     /**
0162      * Set the value for this element's gphoto:photoid attribute.
0163      *
0164      * @param string $value The desired value for this attribute.
0165      * @return Zend_Gdata_Photos_Extension_PhotoId The element being modified.
0166      */
0167     public function setGphotoPhotoId($value)
0168     {
0169         $this->_gphotoPhotoId = $value;
0170         return $this;
0171     }
0172 
0173     /**
0174      * Get the value for this element's gphoto:id attribute.
0175      *
0176      * @see setGphotoId
0177      * @return string The requested attribute.
0178      */
0179     public function getGphotoId()
0180     {
0181         return $this->_gphotoId;
0182     }
0183 
0184     /**
0185      * Set the value for this element's gphoto:id attribute.
0186      *
0187      * @param string $value The desired value for this attribute.
0188      * @return Zend_Gdata_Photos_Extension_Id The element being modified.
0189      */
0190     public function setGphotoId($value)
0191     {
0192         $this->_gphotoId = $value;
0193         return $this;
0194     }
0195 }