source: extensions/Google2Piwigo/include/Zend/Gdata/Photos/UserEntry.php @ 17475

Revision 17475, 11.0 KB checked in by mistic100, 7 years ago (diff)

new extension: Google2Piwigo

Line 
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-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: UserEntry.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_Entry
26 */
27require_once 'Zend/Gdata/Entry.php';
28
29/**
30 * @see Zend_Gdata_Gapps
31 */
32require_once 'Zend/Gdata/Gapps.php';
33
34/**
35 * @see Zend_Gdata_Photos_Extension_Nickname
36 */
37require_once 'Zend/Gdata/Photos/Extension/Nickname.php';
38
39/**
40 * @see Zend_Gdata_Photos_Extension_Thumbnail
41 */
42require_once 'Zend/Gdata/Photos/Extension/Thumbnail.php';
43
44/**
45 * @see Zend_Gdata_Photos_Extension_QuotaCurrent
46 */
47require_once 'Zend/Gdata/Photos/Extension/QuotaCurrent.php';
48
49/**
50 * @see Zend_Gdata_Photos_Extension_QuotaLimit
51 */
52require_once 'Zend/Gdata/Photos/Extension/QuotaLimit.php';
53
54/**
55 * @see Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum
56 */
57require_once 'Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php';
58
59/**
60 * @see Zend_Gdata_Photos_Extension_User
61 */
62require_once 'Zend/Gdata/Photos/Extension/User.php';
63
64/**
65 * @see Zend_Gdata_App_Extension_Category
66 */
67require_once 'Zend/Gdata/App/Extension/Category.php';
68
69/**
70 * Data model class for a User Entry.
71 *
72 * To transfer user entries to and from the servers, including
73 * creating new entries, refer to the service class,
74 * Zend_Gdata_Photos.
75 *
76 * This class represents <atom:entry> in the Google Data protocol.
77 *
78 * @category   Zend
79 * @package    Zend_Gdata
80 * @subpackage Photos
81 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
82 * @license    http://framework.zend.com/license/new-bsd     New BSD License
83 */
84class Zend_Gdata_Photos_UserEntry extends Zend_Gdata_Entry
85{
86
87    protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry';
88
89    /**
90     * gphoto:nickname element
91     *
92     * @var Zend_Gdata_Photos_Extension_Nickname
93     */
94    protected $_gphotoNickname = null;
95
96    /**
97     * gphoto:user element
98     *
99     * @var Zend_Gdata_Photos_Extension_User
100     */
101    protected $_gphotoUser = null;
102
103    /**
104     * gphoto:thumbnail element
105     *
106     * @var Zend_Gdata_Photos_Extension_Thumbnail
107     */
108    protected $_gphotoThumbnail = null;
109
110    /**
111     * gphoto:quotalimit element
112     *
113     * @var Zend_Gdata_Photos_Extension_QuotaLimit
114     */
115    protected $_gphotoQuotaLimit = null;
116
117    /**
118     * gphoto:quotacurrent element
119     *
120     * @var Zend_Gdata_Photos_Extension_QuotaCurrent
121     */
122    protected $_gphotoQuotaCurrent = null;
123
124    /**
125     * gphoto:maxPhotosPerAlbum element
126     *
127     * @var Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum
128     */
129    protected $_gphotoMaxPhotosPerAlbum = null;
130
131    /**
132     * Create a new instance.
133     *
134     * @param DOMElement $element (optional) DOMElement from which this
135     *          object should be constructed.
136     */
137    public function __construct($element = null)
138    {
139        $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
140        parent::__construct($element);
141
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));
146    }
147
148    /**
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.
152     *
153     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
154     * @return DOMElement The DOMElement representing this element and all
155     *          child properties.
156     */
157    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
158    {
159        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
160        if ($this->_gphotoNickname !== null) {
161            $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
162        }
163        if ($this->_gphotoThumbnail !== null) {
164            $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument));
165        }
166        if ($this->_gphotoUser !== null) {
167            $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
168        }
169        if ($this->_gphotoQuotaCurrent !== null) {
170            $element->appendChild($this->_gphotoQuotaCurrent->getDOM($element->ownerDocument));
171        }
172        if ($this->_gphotoQuotaLimit !== null) {
173            $element->appendChild($this->_gphotoQuotaLimit->getDOM($element->ownerDocument));
174        }
175        if ($this->_gphotoMaxPhotosPerAlbum !== null) {
176            $element->appendChild($this->_gphotoMaxPhotosPerAlbum->getDOM($element->ownerDocument));
177        }
178        return $element;
179    }
180
181    /**
182     * Creates individual Entry objects of the appropriate type and
183     * stores them as members of this entry based upon DOM data.
184     *
185     * @param DOMNode $child The DOMNode to process
186     */
187    protected function takeChildFromDOM($child)
188    {
189        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
190
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;
196                break;
197            case $this->lookupNamespace('gphoto') . ':' . 'thumbnail';
198                $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail();
199                $thumbnail->transferFromDOM($child);
200                $this->_gphotoThumbnail = $thumbnail;
201                break;
202            case $this->lookupNamespace('gphoto') . ':' . 'user';
203                $user = new Zend_Gdata_Photos_Extension_User();
204                $user->transferFromDOM($child);
205                $this->_gphotoUser = $user;
206                break;
207            case $this->lookupNamespace('gphoto') . ':' . 'quotacurrent';
208                $quotaCurrent = new Zend_Gdata_Photos_Extension_QuotaCurrent();
209                $quotaCurrent->transferFromDOM($child);
210                $this->_gphotoQuotaCurrent = $quotaCurrent;
211                break;
212            case $this->lookupNamespace('gphoto') . ':' . 'quotalimit';
213                $quotaLimit = new Zend_Gdata_Photos_Extension_QuotaLimit();
214                $quotaLimit->transferFromDOM($child);
215                $this->_gphotoQuotaLimit = $quotaLimit;
216                break;
217            case $this->lookupNamespace('gphoto') . ':' . 'maxPhotosPerAlbum';
218                $maxPhotosPerAlbum = new Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum();
219                $maxPhotosPerAlbum->transferFromDOM($child);
220                $this->_gphotoMaxPhotosPerAlbum = $maxPhotosPerAlbum;
221                break;
222            default:
223                parent::takeChildFromDOM($child);
224                break;
225        }
226    }
227
228    /**
229     * Get the value for this element's gphoto:nickname attribute.
230     *
231     * @see setGphotoNickname
232     * @return string The requested attribute.
233     */
234    public function getGphotoNickname()
235    {
236        return $this->_gphotoNickname;
237    }
238
239    /**
240     * Set the value for this element's gphoto:nickname attribute.
241     *
242     * @param string $value The desired value for this attribute.
243     * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
244     */
245    public function setGphotoNickname($value)
246    {
247        $this->_gphotoNickname = $value;
248        return $this;
249    }
250
251    /**
252     * Get the value for this element's gphoto:thumbnail attribute.
253     *
254     * @see setGphotoThumbnail
255     * @return string The requested attribute.
256     */
257    public function getGphotoThumbnail()
258    {
259        return $this->_gphotoThumbnail;
260    }
261
262    /**
263     * Set the value for this element's gphoto:thumbnail attribute.
264     *
265     * @param string $value The desired value for this attribute.
266     * @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified.
267     */
268    public function setGphotoThumbnail($value)
269    {
270        $this->_gphotoThumbnail = $value;
271        return $this;
272    }
273
274    /**
275     * Get the value for this element's gphoto:quotacurrent attribute.
276     *
277     * @see setGphotoQuotaCurrent
278     * @return string The requested attribute.
279     */
280    public function getGphotoQuotaCurrent()
281    {
282        return $this->_gphotoQuotaCurrent;
283    }
284
285    /**
286     * Set the value for this element's gphoto:quotacurrent attribute.
287     *
288     * @param string $value The desired value for this attribute.
289     * @return Zend_Gdata_Photos_Extension_QuotaCurrent The element being modified.
290     */
291    public function setGphotoQuotaCurrent($value)
292    {
293        $this->_gphotoQuotaCurrent = $value;
294        return $this;
295    }
296
297    /**
298     * Get the value for this element's gphoto:quotalimit attribute.
299     *
300     * @see setGphotoQuotaLimit
301     * @return string The requested attribute.
302     */
303    public function getGphotoQuotaLimit()
304    {
305        return $this->_gphotoQuotaLimit;
306    }
307
308    /**
309     * Set the value for this element's gphoto:quotalimit attribute.
310     *
311     * @param string $value The desired value for this attribute.
312     * @return Zend_Gdata_Photos_Extension_QuotaLimit The element being modified.
313     */
314    public function setGphotoQuotaLimit($value)
315    {
316        $this->_gphotoQuotaLimit = $value;
317        return $this;
318    }
319
320    /**
321     * Get the value for this element's gphoto:maxPhotosPerAlbum attribute.
322     *
323     * @see setGphotoMaxPhotosPerAlbum
324     * @return string The requested attribute.
325     */
326    public function getGphotoMaxPhotosPerAlbum()
327    {
328        return $this->_gphotoMaxPhotosPerAlbum;
329    }
330
331    /**
332     * Set the value for this element's gphoto:maxPhotosPerAlbum attribute.
333     *
334     * @param string $value The desired value for this attribute.
335     * @return Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum The element being modified.
336     */
337    public function setGphotoMaxPhotosPerAlbum($value)
338    {
339        $this->_gphotoMaxPhotosPerAlbum = $value;
340        return $this;
341    }
342
343    /**
344     * Get the value for this element's gphoto:user attribute.
345     *
346     * @see setGphotoUser
347     * @return string The requested attribute.
348     */
349    public function getGphotoUser()
350    {
351        return $this->_gphotoUser;
352    }
353
354    /**
355     * Set the value for this element's gphoto:user attribute.
356     *
357     * @param string $value The desired value for this attribute.
358     * @return Zend_Gdata_Photos_Extension_User The element being modified.
359     */
360    public function setGphotoUser($value)
361    {
362        $this->_gphotoUser = $value;
363        return $this;
364    }
365
366}
Note: See TracBrowser for help on using the repository browser.