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