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

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 4.3 KB
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: TagEntry.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_Photos_Extension_Weight
31 */
32require_once 'Zend/Gdata/Photos/Extension/Weight.php';
33
34/**
35 * @see Zend_Gdata_App_Extension_Category
36 */
37require_once 'Zend/Gdata/App/Extension/Category.php';
38
39/**
40 * Data model class for a Tag Entry.
41 *
42 * To transfer user entries to and from the servers, including
43 * creating new entries, refer to the service class,
44 * Zend_Gdata_Photos.
45 *
46 * This class represents <atom:entry> in the Google Data protocol.
47 *
48 * @category   Zend
49 * @package    Zend_Gdata
50 * @subpackage Photos
51 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
52 * @license    http://framework.zend.com/license/new-bsd     New BSD License
53 */
54class Zend_Gdata_Photos_TagEntry extends Zend_Gdata_Entry
55{
56
57    protected $_entryClassName = 'Zend_Gdata_Photos_TagEntry';
58
59    protected $_gphotoWeight = null;
60
61    /**
62     * Create a new instance.
63     *
64     * @param DOMElement $element (optional) DOMElement from which this
65     *          object should be constructed.
66     */
67    public function __construct($element = null)
68    {
69        $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
70        parent::__construct($element);
71
72        $category = new Zend_Gdata_App_Extension_Category(
73            'http://schemas.google.com/photos/2007#tag',
74            'http://schemas.google.com/g/2005#kind');
75        $this->setCategory(array($category));
76    }
77
78    /**
79     * Retrieves a DOMElement which corresponds to this element and all
80     * child properties.  This is used to build an entry back into a DOM
81     * and eventually XML text for application storage/persistence.
82     *
83     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
84     * @return DOMElement The DOMElement representing this element and all
85     *          child properties.
86     */
87    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
88    {
89        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
90        if ($this->_gphotoWeight !== null) {
91            $element->appendChild($this->_gphotoWeight->getDOM($element->ownerDocument));
92        }
93        return $element;
94    }
95
96    /**
97     * Creates individual Entry objects of the appropriate type and
98     * stores them as members of this entry based upon DOM data.
99     *
100     * @param DOMNode $child The DOMNode to process
101     */
102    protected function takeChildFromDOM($child)
103    {
104        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
105
106        switch ($absoluteNodeName) {
107            case $this->lookupNamespace('gphoto') . ':' . 'weight';
108                $weight = new Zend_Gdata_Photos_Extension_Weight();
109                $weight->transferFromDOM($child);
110                $this->_gphotoWeight = $weight;
111                break;
112            default:
113                parent::takeChildFromDOM($child);
114                break;
115        }
116    }
117
118    /**
119     * Get the value for this element's gphoto:weight attribute.
120     *
121     * @see setGphotoWeight
122     * @return string The requested attribute.
123     */
124    public function getGphotoWeight()
125    {
126        return $this->_gphotoWeight;
127    }
128
129    /**
130     * Set the value for this element's gphoto:weight attribute.
131     *
132     * @param string $value The desired value for this attribute.
133     * @return Zend_Gdata_Photos_Extension_Weight The element being modified.
134     */
135    public function setGphotoWeight($value)
136    {
137        $this->_gphotoWeight = $value;
138        return $this;
139    }
140}
Note: See TracBrowser for help on using the repository browser.