[44] | 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-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @see Zend_Gdata_Entry
|
---|
| 25 | */
|
---|
| 26 | require_once 'Zend/Gdata/Entry.php';
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * @see Zend_Gdata_Photos_Extension_Id
|
---|
| 30 | */
|
---|
| 31 | require_once 'Zend/Gdata/Photos/Extension/Id.php';
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * @see Zend_Gdata_Photos_Extension_PhotoId
|
---|
| 35 | */
|
---|
| 36 | require_once 'Zend/Gdata/Photos/Extension/PhotoId.php';
|
---|
| 37 |
|
---|
| 38 | /**
|
---|
| 39 | * @see Zend_Gdata_Photos_Extension_Weight
|
---|
| 40 | */
|
---|
| 41 | require_once 'Zend/Gdata/Photos/Extension/Weight.php';
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * @see Zend_Gdata_App_Extension_Category
|
---|
| 45 | */
|
---|
| 46 | require_once 'Zend/Gdata/App/Extension/Category.php';
|
---|
| 47 |
|
---|
| 48 | /**
|
---|
| 49 | * Data model class for a Comment Entry.
|
---|
| 50 | *
|
---|
| 51 | * To transfer user entries to and from the servers, including
|
---|
| 52 | * creating new entries, refer to the service class,
|
---|
| 53 | * Zend_Gdata_Photos.
|
---|
| 54 | *
|
---|
| 55 | * This class represents <atom:entry> in the Google Data protocol.
|
---|
| 56 | *
|
---|
| 57 | * @category Zend
|
---|
| 58 | * @package Zend_Gdata
|
---|
| 59 | * @subpackage Photos
|
---|
| 60 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 61 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 62 | */
|
---|
| 63 | class Zend_Gdata_Photos_CommentEntry extends Zend_Gdata_Entry
|
---|
| 64 | {
|
---|
| 65 |
|
---|
| 66 | protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry';
|
---|
| 67 |
|
---|
| 68 | /**
|
---|
| 69 | * gphoto:id element
|
---|
| 70 | *
|
---|
| 71 | * @var Zend_Gdata_Photos_Extension_Id
|
---|
| 72 | */
|
---|
| 73 | protected $_gphotoId = null;
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * gphoto:photoid element, differs from gphoto:id as this is an
|
---|
| 77 | * actual identification number unique exclusively to photo entries,
|
---|
| 78 | * whereas gphoto:id can refer to all gphoto objects
|
---|
| 79 | *
|
---|
| 80 | * @var Zend_Gdata_Photos_Extension_PhotoId
|
---|
| 81 | */
|
---|
| 82 | protected $_gphotoPhotoId = null;
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
| 85 | * Create a new instance.
|
---|
| 86 | *
|
---|
| 87 | * @param DOMElement $element (optional) DOMElement from which this
|
---|
| 88 | * object should be constructed.
|
---|
| 89 | */
|
---|
| 90 | public function __construct($element = null)
|
---|
| 91 | {
|
---|
| 92 | $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
|
---|
| 93 | parent::__construct($element);
|
---|
| 94 |
|
---|
| 95 | $category = new Zend_Gdata_App_Extension_Category(
|
---|
| 96 | 'http://schemas.google.com/photos/2007#comment',
|
---|
| 97 | 'http://schemas.google.com/g/2005#kind');
|
---|
| 98 | $this->setCategory(array($category));
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | /**
|
---|
| 102 | * Retrieves a DOMElement which corresponds to this element and all
|
---|
| 103 | * child properties. This is used to build an entry back into a DOM
|
---|
| 104 | * and eventually XML text for application storage/persistence.
|
---|
| 105 | *
|
---|
| 106 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
| 107 | * @return DOMElement The DOMElement representing this element and all
|
---|
| 108 | * child properties.
|
---|
| 109 | */
|
---|
| 110 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 111 | {
|
---|
| 112 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 113 | if ($this->_gphotoId !== null) {
|
---|
| 114 | $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
|
---|
| 115 | }
|
---|
| 116 | if ($this->_gphotoPhotoId !== null) {
|
---|
| 117 | $element->appendChild($this->_gphotoPhotoId->getDOM($element->ownerDocument));
|
---|
| 118 | }
|
---|
| 119 | return $element;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | /**
|
---|
| 123 | * Creates individual Entry objects of the appropriate type and
|
---|
| 124 | * stores them as members of this entry based upon DOM data.
|
---|
| 125 | *
|
---|
| 126 | * @param DOMNode $child The DOMNode to process
|
---|
| 127 | */
|
---|
| 128 | protected function takeChildFromDOM($child)
|
---|
| 129 | {
|
---|
| 130 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
| 131 |
|
---|
| 132 | switch ($absoluteNodeName) {
|
---|
| 133 | case $this->lookupNamespace('gphoto') . ':' . 'id';
|
---|
| 134 | $id = new Zend_Gdata_Photos_Extension_Id();
|
---|
| 135 | $id->transferFromDOM($child);
|
---|
| 136 | $this->_gphotoId = $id;
|
---|
| 137 | break;
|
---|
| 138 | case $this->lookupNamespace('gphoto') . ':' . 'photoid';
|
---|
| 139 | $photoid = new Zend_Gdata_Photos_Extension_PhotoId();
|
---|
| 140 | $photoid->transferFromDOM($child);
|
---|
| 141 | $this->_gphotoPhotoId = $photoid;
|
---|
| 142 | break;
|
---|
| 143 | default:
|
---|
| 144 | parent::takeChildFromDOM($child);
|
---|
| 145 | break;
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | /**
|
---|
| 150 | * Get the value for this element's gphoto:photoid attribute.
|
---|
| 151 | *
|
---|
| 152 | * @see setGphotoPhotoId
|
---|
| 153 | * @return string The requested attribute.
|
---|
| 154 | */
|
---|
| 155 | public function getGphotoPhotoId()
|
---|
| 156 | {
|
---|
| 157 | return $this->_gphotoPhotoId;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | /**
|
---|
| 161 | * Set the value for this element's gphoto:photoid attribute.
|
---|
| 162 | *
|
---|
| 163 | * @param string $value The desired value for this attribute.
|
---|
| 164 | * @return Zend_Gdata_Photos_Extension_PhotoId The element being modified.
|
---|
| 165 | */
|
---|
| 166 | public function setGphotoPhotoId($value)
|
---|
| 167 | {
|
---|
| 168 | $this->_gphotoPhotoId = $value;
|
---|
| 169 | return $this;
|
---|
| 170 | }
|
---|
| 171 |
|
---|
| 172 | /**
|
---|
| 173 | * Get the value for this element's gphoto:id attribute.
|
---|
| 174 | *
|
---|
| 175 | * @see setGphotoId
|
---|
| 176 | * @return string The requested attribute.
|
---|
| 177 | */
|
---|
| 178 | public function getGphotoId()
|
---|
| 179 | {
|
---|
| 180 | return $this->_gphotoId;
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | /**
|
---|
| 184 | * Set the value for this element's gphoto:id attribute.
|
---|
| 185 | *
|
---|
| 186 | * @param string $value The desired value for this attribute.
|
---|
| 187 | * @return Zend_Gdata_Photos_Extension_Id The element being modified.
|
---|
| 188 | */
|
---|
| 189 | public function setGphotoId($value)
|
---|
| 190 | {
|
---|
| 191 | $this->_gphotoId = $value;
|
---|
| 192 | return $this;
|
---|
| 193 | }
|
---|
| 194 | }
|
---|