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_Photos_Extension_Weight
32 require_once 'Zend/Gdata/Photos/Extension/Weight.php';
35 * @see Zend_Gdata_App_Extension_Category
37 require_once 'Zend/Gdata/App/Extension/Category.php';
40 * Data model class for a Tag Entry.
42 * To transfer user entries to and from the servers, including
43 * creating new entries, refer to the service class,
46 * This class represents <atom:entry> in the Google Data protocol.
51 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
52 * @license http://framework.zend.com/license/new-bsd New BSD License
54 class Zend_Gdata_Photos_TagEntry extends Zend_Gdata_Entry
57 protected $_entryClassName = 'Zend_Gdata_Photos_TagEntry';
59 protected $_gphotoWeight = null;
62 * Create a new instance.
64 * @param DOMElement $element (optional) DOMElement from which this
65 * object should be constructed.
67 public function __construct($element = null)
69 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
70 parent::__construct($element);
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));
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.
83 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
84 * @return DOMElement The DOMElement representing this element and all
87 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
89 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
90 if ($this->_gphotoWeight !== null) {
91 $element->appendChild($this->_gphotoWeight->getDOM($element->ownerDocument));
97 * Creates individual Entry objects of the appropriate type and
98 * stores them as members of this entry based upon DOM data.
100 * @param DOMNode $child The DOMNode to process
102 protected function takeChildFromDOM($child)
104 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
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;
113 parent::takeChildFromDOM($child);
119 * Get the value for this element's gphoto:weight attribute.
121 * @see setGphotoWeight
122 * @return string The requested attribute.
124 public function getGphotoWeight()
126 return $this->_gphotoWeight;
130 * Set the value for this element's gphoto:weight attribute.
132 * @param string $value The desired value for this attribute.
133 * @return Zend_Gdata_Photos_Extension_Weight The element being modified.
135 public function setGphotoWeight($value)
137 $this->_gphotoWeight = $value;