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.
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
24
* @see Zend_Gdata_Entry
26
require_once 'Zend/Gdata/Entry.php';
29
* @see Zend_Gdata_Photos_Extension_Id
31
require_once 'Zend/Gdata/Photos/Extension/Id.php';
34
* @see Zend_Gdata_Photos_Extension_PhotoId
36
require_once 'Zend/Gdata/Photos/Extension/PhotoId.php';
39
* @see Zend_Gdata_Photos_Extension_Weight
41
require_once 'Zend/Gdata/Photos/Extension/Weight.php';
44
* @see Zend_Gdata_App_Extension_Category
46
require_once 'Zend/Gdata/App/Extension/Category.php';
49
* Data model class for a Comment Entry.
51
* To transfer user entries to and from the servers, including
52
* creating new entries, refer to the service class,
55
* This class represents <atom:entry> in the Google Data protocol.
59
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
60
* @license http://framework.zend.com/license/new-bsd New BSD License
62
class Zend_Gdata_Photos_CommentEntry extends Zend_Gdata_Entry
65
protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry';
70
* @var Zend_Gdata_Photos_Extension_Id
72
protected $_gphotoId = null;
75
* gphoto:photoid element, differs from gphoto:id as this is an
76
* actual identification number unique exclusively to photo entries,
77
* whereas gphoto:id can refer to all gphoto objects
79
* @var Zend_Gdata_Photos_Extension_PhotoId
81
protected $_gphotoPhotoId = null;
84
* Create a new instance.
86
* @param DOMElement $element (optional) DOMElement from which this
87
* object should be constructed.
89
public function __construct($element = null)
91
foreach (Zend_Gdata_Photos::$namespaces as $nsPrefix => $nsUri) {
92
$this->registerNamespace($nsPrefix, $nsUri);
94
parent::__construct($element);
96
$category = new Zend_Gdata_App_Extension_Category(
97
'http://schemas.google.com/photos/2007#comment',
98
'http://schemas.google.com/g/2005#kind');
99
$this->setCategory(array($category));
103
* Retrieves a DOMElement which corresponds to this element and all
104
* child properties. This is used to build an entry back into a DOM
105
* and eventually XML text for application storage/persistence.
107
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
108
* @return DOMElement The DOMElement representing this element and all
111
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
113
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
114
if ($this->_gphotoId !== null) {
115
$element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
117
if ($this->_gphotoPhotoId !== null) {
118
$element->appendChild($this->_gphotoPhotoId->getDOM($element->ownerDocument));
124
* Creates individual Entry objects of the appropriate type and
125
* stores them as members of this entry based upon DOM data.
127
* @param DOMNode $child The DOMNode to process
129
protected function takeChildFromDOM($child)
131
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
133
switch ($absoluteNodeName) {
134
case $this->lookupNamespace('gphoto') . ':' . 'id';
135
$id = new Zend_Gdata_Photos_Extension_Id();
136
$id->transferFromDOM($child);
137
$this->_gphotoId = $id;
139
case $this->lookupNamespace('gphoto') . ':' . 'photoid';
140
$photoid = new Zend_Gdata_Photos_Extension_PhotoId();
141
$photoid->transferFromDOM($child);
142
$this->_gphotoPhotoId = $photoid;
145
parent::takeChildFromDOM($child);
151
* Get the value for this element's gphoto:photoid attribute.
153
* @see setGphotoPhotoId
154
* @return string The requested attribute.
156
public function getGphotoPhotoId()
158
return $this->_gphotoPhotoId;
162
* Set the value for this element's gphoto:photoid attribute.
164
* @param string $value The desired value for this attribute.
165
* @return Zend_Gdata_Photos_Extension_PhotoId The element being modified.
167
public function setGphotoPhotoId($value)
169
$this->_gphotoPhotoId = $value;
174
* Get the value for this element's gphoto:id attribute.
177
* @return string The requested attribute.
179
public function getGphotoId()
181
return $this->_gphotoId;
185
* Set the value for this element's gphoto:id attribute.
187
* @param string $value The desired value for this attribute.
188
* @return Zend_Gdata_Photos_Extension_Id The element being modified.
190
public function setGphotoId($value)
192
$this->_gphotoId = $value;