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_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * @see Zend_Gdata_Extension_EntryLink
32 require_once 'Zend/Gdata/Extension/EntryLink.php';
35 * Data model class to represent a location (gd:where element)
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Extension_Where extends Zend_Gdata_Extension
46 protected $_rootElement = 'where';
47 protected $_label = null;
48 protected $_rel = null;
49 protected $_valueString = null;
50 protected $_entryLink = null;
52 public function __construct($valueString = null, $label = null, $rel = null, $entryLink = null)
54 parent::__construct();
55 $this->_valueString = $valueString;
56 $this->_label = $label;
58 $this->_entryLink = $entryLink;
61 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
63 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
64 if ($this->_label !== null) {
65 $element->setAttribute('label', $this->_label);
67 if ($this->_rel !== null) {
68 $element->setAttribute('rel', $this->_rel);
70 if ($this->_valueString !== null) {
71 $element->setAttribute('valueString', $this->_valueString);
73 if ($this->entryLink !== null) {
74 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
79 protected function takeAttributeFromDOM($attribute)
81 switch ($attribute->localName) {
83 $this->_label = $attribute->nodeValue;
86 $this->_rel = $attribute->nodeValue;
89 $this->_valueString = $attribute->nodeValue;
92 parent::takeAttributeFromDOM($attribute);
97 * Creates individual Entry objects of the appropriate type and
98 * stores them in the $_entry array based upon DOM data.
100 * @param DOMNode $child The DOMNode to process
102 protected function takeChildFromDOM($child)
104 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
105 switch ($absoluteNodeName) {
106 case $this->lookupNamespace('gd') . ':' . 'entryLink':
107 $entryLink = new Zend_Gdata_Extension_EntryLink();
108 $entryLink->transferFromDOM($child);
109 $this->_entryLink = $entryLink;
112 parent::takeChildFromDOM($child);
117 public function __toString()
119 if ($this->_valueString != null) {
120 return $this->_valueString;
123 return parent::__toString();
127 public function getLabel()
129 return $this->_label;
132 public function setLabel($value)
134 $this->_label = $value;
138 public function getRel()
143 public function setRel($value)
145 $this->_rel = $value;
149 public function getValueString()
151 return $this->_valueString;
154 public function setValueString($value)
156 $this->_valueString = $value;
160 public function getEntryLink()
162 return $this->_entryLink;
165 public function setEntryLink($value)
167 $this->_entryLink = $value;