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