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-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Entry
27 require_once 'Zend/Gdata/Entry.php';
30 * @see Zend_Gdata_Gapps
32 require_once 'Zend/Gdata/Gapps.php';
35 * @see Zend_Gdata_Photos_Extension_Nickname
37 require_once 'Zend/Gdata/Photos/Extension/Nickname.php';
40 * @see Zend_Gdata_Photos_Extension_Thumbnail
42 require_once 'Zend/Gdata/Photos/Extension/Thumbnail.php';
45 * @see Zend_Gdata_Photos_Extension_QuotaCurrent
47 require_once 'Zend/Gdata/Photos/Extension/QuotaCurrent.php';
50 * @see Zend_Gdata_Photos_Extension_QuotaLimit
52 require_once 'Zend/Gdata/Photos/Extension/QuotaLimit.php';
55 * @see Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum
57 require_once 'Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php';
60 * @see Zend_Gdata_Photos_Extension_User
62 require_once 'Zend/Gdata/Photos/Extension/User.php';
65 * @see Zend_Gdata_App_Extension_Category
67 require_once 'Zend/Gdata/App/Extension/Category.php';
70 * Data model class for a User Entry.
72 * To transfer user entries to and from the servers, including
73 * creating new entries, refer to the service class,
76 * This class represents <atom:entry> in the Google Data protocol.
81 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
82 * @license http://framework.zend.com/license/new-bsd New BSD License
84 class Zend_Gdata_Photos_UserEntry extends Zend_Gdata_Entry
87 protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry';
90 * gphoto:nickname element
92 * @var Zend_Gdata_Photos_Extension_Nickname
94 protected $_gphotoNickname = null;
99 * @var Zend_Gdata_Photos_Extension_User
101 protected $_gphotoUser = null;
104 * gphoto:thumbnail element
106 * @var Zend_Gdata_Photos_Extension_Thumbnail
108 protected $_gphotoThumbnail = null;
111 * gphoto:quotalimit element
113 * @var Zend_Gdata_Photos_Extension_QuotaLimit
115 protected $_gphotoQuotaLimit = null;
118 * gphoto:quotacurrent element
120 * @var Zend_Gdata_Photos_Extension_QuotaCurrent
122 protected $_gphotoQuotaCurrent = null;
125 * gphoto:maxPhotosPerAlbum element
127 * @var Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum
129 protected $_gphotoMaxPhotosPerAlbum = null;
132 * Create a new instance.
134 * @param DOMElement $element (optional) DOMElement from which this
135 * object should be constructed.
137 public function __construct($element = null)
139 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
140 parent::__construct($element);
142 $category = new Zend_Gdata_App_Extension_Category(
143 'http://schemas.google.com/photos/2007#user',
144 'http://schemas.google.com/g/2005#kind');
145 $this->setCategory(array($category));
149 * Retrieves a DOMElement which corresponds to this element and all
150 * child properties. This is used to build an entry back into a DOM
151 * and eventually XML text for application storage/persistence.
153 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
154 * @return DOMElement The DOMElement representing this element and all
157 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
159 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
160 if ($this->_gphotoNickname !== null) {
161 $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
163 if ($this->_gphotoThumbnail !== null) {
164 $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument));
166 if ($this->_gphotoUser !== null) {
167 $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
169 if ($this->_gphotoQuotaCurrent !== null) {
170 $element->appendChild($this->_gphotoQuotaCurrent->getDOM($element->ownerDocument));
172 if ($this->_gphotoQuotaLimit !== null) {
173 $element->appendChild($this->_gphotoQuotaLimit->getDOM($element->ownerDocument));
175 if ($this->_gphotoMaxPhotosPerAlbum !== null) {
176 $element->appendChild($this->_gphotoMaxPhotosPerAlbum->getDOM($element->ownerDocument));
182 * Creates individual Entry objects of the appropriate type and
183 * stores them as members of this entry based upon DOM data.
185 * @param DOMNode $child The DOMNode to process
187 protected function takeChildFromDOM($child)
189 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
191 switch ($absoluteNodeName) {
192 case $this->lookupNamespace('gphoto') . ':' . 'nickname';
193 $nickname = new Zend_Gdata_Photos_Extension_Nickname();
194 $nickname->transferFromDOM($child);
195 $this->_gphotoNickname = $nickname;
197 case $this->lookupNamespace('gphoto') . ':' . 'thumbnail';
198 $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail();
199 $thumbnail->transferFromDOM($child);
200 $this->_gphotoThumbnail = $thumbnail;
202 case $this->lookupNamespace('gphoto') . ':' . 'user';
203 $user = new Zend_Gdata_Photos_Extension_User();
204 $user->transferFromDOM($child);
205 $this->_gphotoUser = $user;
207 case $this->lookupNamespace('gphoto') . ':' . 'quotacurrent';
208 $quotaCurrent = new Zend_Gdata_Photos_Extension_QuotaCurrent();
209 $quotaCurrent->transferFromDOM($child);
210 $this->_gphotoQuotaCurrent = $quotaCurrent;
212 case $this->lookupNamespace('gphoto') . ':' . 'quotalimit';
213 $quotaLimit = new Zend_Gdata_Photos_Extension_QuotaLimit();
214 $quotaLimit->transferFromDOM($child);
215 $this->_gphotoQuotaLimit = $quotaLimit;
217 case $this->lookupNamespace('gphoto') . ':' . 'maxPhotosPerAlbum';
218 $maxPhotosPerAlbum = new Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum();
219 $maxPhotosPerAlbum->transferFromDOM($child);
220 $this->_gphotoMaxPhotosPerAlbum = $maxPhotosPerAlbum;
223 parent::takeChildFromDOM($child);
229 * Get the value for this element's gphoto:nickname attribute.
231 * @see setGphotoNickname
232 * @return string The requested attribute.
234 public function getGphotoNickname()
236 return $this->_gphotoNickname;
240 * Set the value for this element's gphoto:nickname attribute.
242 * @param string $value The desired value for this attribute.
243 * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
245 public function setGphotoNickname($value)
247 $this->_gphotoNickname = $value;
252 * Get the value for this element's gphoto:thumbnail attribute.
254 * @see setGphotoThumbnail
255 * @return string The requested attribute.
257 public function getGphotoThumbnail()
259 return $this->_gphotoThumbnail;
263 * Set the value for this element's gphoto:thumbnail attribute.
265 * @param string $value The desired value for this attribute.
266 * @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified.
268 public function setGphotoThumbnail($value)
270 $this->_gphotoThumbnail = $value;
275 * Get the value for this element's gphoto:quotacurrent attribute.
277 * @see setGphotoQuotaCurrent
278 * @return string The requested attribute.
280 public function getGphotoQuotaCurrent()
282 return $this->_gphotoQuotaCurrent;
286 * Set the value for this element's gphoto:quotacurrent attribute.
288 * @param string $value The desired value for this attribute.
289 * @return Zend_Gdata_Photos_Extension_QuotaCurrent The element being modified.
291 public function setGphotoQuotaCurrent($value)
293 $this->_gphotoQuotaCurrent = $value;
298 * Get the value for this element's gphoto:quotalimit attribute.
300 * @see setGphotoQuotaLimit
301 * @return string The requested attribute.
303 public function getGphotoQuotaLimit()
305 return $this->_gphotoQuotaLimit;
309 * Set the value for this element's gphoto:quotalimit attribute.
311 * @param string $value The desired value for this attribute.
312 * @return Zend_Gdata_Photos_Extension_QuotaLimit The element being modified.
314 public function setGphotoQuotaLimit($value)
316 $this->_gphotoQuotaLimit = $value;
321 * Get the value for this element's gphoto:maxPhotosPerAlbum attribute.
323 * @see setGphotoMaxPhotosPerAlbum
324 * @return string The requested attribute.
326 public function getGphotoMaxPhotosPerAlbum()
328 return $this->_gphotoMaxPhotosPerAlbum;
332 * Set the value for this element's gphoto:maxPhotosPerAlbum attribute.
334 * @param string $value The desired value for this attribute.
335 * @return Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum The element being modified.
337 public function setGphotoMaxPhotosPerAlbum($value)
339 $this->_gphotoMaxPhotosPerAlbum = $value;
344 * Get the value for this element's gphoto:user attribute.
347 * @return string The requested attribute.
349 public function getGphotoUser()
351 return $this->_gphotoUser;
355 * Set the value for this element's gphoto:user attribute.
357 * @param string $value The desired value for this attribute.
358 * @return Zend_Gdata_Photos_Extension_User The element being modified.
360 public function setGphotoUser($value)
362 $this->_gphotoUser = $value;