[44] | 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 Gdata
|
---|
| 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_Extension
|
---|
| 25 | */
|
---|
| 26 | require_once 'Zend/Gdata/Extension.php';
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * @see Zend_Gdata_Extension_EntryLink
|
---|
| 30 | */
|
---|
| 31 | require_once 'Zend/Gdata/Extension/EntryLink.php';
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * Data model class to represent a location (gd:where element)
|
---|
| 35 | *
|
---|
| 36 | * @category Zend
|
---|
| 37 | * @package Zend_Gdata
|
---|
| 38 | * @subpackage Gdata
|
---|
| 39 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 40 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 41 | */
|
---|
| 42 | class Zend_Gdata_Extension_Where extends Zend_Gdata_Extension
|
---|
| 43 | {
|
---|
| 44 |
|
---|
| 45 | protected $_rootElement = 'where';
|
---|
| 46 | protected $_label = null;
|
---|
| 47 | protected $_rel = null;
|
---|
| 48 | protected $_valueString = null;
|
---|
| 49 | protected $_entryLink = null;
|
---|
| 50 |
|
---|
| 51 | public function __construct($valueString = null, $label = null, $rel = null, $entryLink = null)
|
---|
| 52 | {
|
---|
| 53 | parent::__construct();
|
---|
| 54 | $this->_valueString = $valueString;
|
---|
| 55 | $this->_label = $label;
|
---|
| 56 | $this->_rel = $rel;
|
---|
| 57 | $this->_entryLink = $entryLink;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 61 | {
|
---|
| 62 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 63 | if ($this->_label !== null) {
|
---|
| 64 | $element->setAttribute('label', $this->_label);
|
---|
| 65 | }
|
---|
| 66 | if ($this->_rel !== null) {
|
---|
| 67 | $element->setAttribute('rel', $this->_rel);
|
---|
| 68 | }
|
---|
| 69 | if ($this->_valueString !== null) {
|
---|
| 70 | $element->setAttribute('valueString', $this->_valueString);
|
---|
| 71 | }
|
---|
| 72 | if ($this->entryLink !== null) {
|
---|
| 73 | $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
|
---|
| 74 | }
|
---|
| 75 | return $element;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | protected function takeAttributeFromDOM($attribute)
|
---|
| 79 | {
|
---|
| 80 | switch ($attribute->localName) {
|
---|
| 81 | case 'label':
|
---|
| 82 | $this->_label = $attribute->nodeValue;
|
---|
| 83 | break;
|
---|
| 84 | case 'rel':
|
---|
| 85 | $this->_rel = $attribute->nodeValue;
|
---|
| 86 | break;
|
---|
| 87 | case 'valueString':
|
---|
| 88 | $this->_valueString = $attribute->nodeValue;
|
---|
| 89 | break;
|
---|
| 90 | default:
|
---|
| 91 | parent::takeAttributeFromDOM($attribute);
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | /**
|
---|
| 96 | * Creates individual Entry objects of the appropriate type and
|
---|
| 97 | * stores them in the $_entry array 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 | switch ($absoluteNodeName) {
|
---|
| 105 | case $this->lookupNamespace('gd') . ':' . 'entryLink':
|
---|
| 106 | $entryLink = new Zend_Gdata_Extension_EntryLink();
|
---|
| 107 | $entryLink->transferFromDOM($child);
|
---|
| 108 | $this->_entryLink = $entryLink;
|
---|
| 109 | break;
|
---|
| 110 | default:
|
---|
| 111 | parent::takeChildFromDOM($child);
|
---|
| 112 | break;
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | public function __toString()
|
---|
| 117 | {
|
---|
| 118 | if ($this->_valueString != null) {
|
---|
| 119 | return $this->_valueString;
|
---|
| 120 | }
|
---|
| 121 | else {
|
---|
| 122 | return parent::__toString();
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | public function getLabel()
|
---|
| 127 | {
|
---|
| 128 | return $this->_label;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | public function setLabel($value)
|
---|
| 132 | {
|
---|
| 133 | $this->_label = $value;
|
---|
| 134 | return $this;
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | public function getRel()
|
---|
| 138 | {
|
---|
| 139 | return $this->_rel;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | public function setRel($value)
|
---|
| 143 | {
|
---|
| 144 | $this->_rel = $value;
|
---|
| 145 | return $this;
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | public function getValueString()
|
---|
| 149 | {
|
---|
| 150 | return $this->_valueString;
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | public function setValueString($value)
|
---|
| 154 | {
|
---|
| 155 | $this->_valueString = $value;
|
---|
| 156 | return $this;
|
---|
| 157 | }
|
---|
| 158 |
|
---|
| 159 | public function getEntryLink()
|
---|
| 160 | {
|
---|
| 161 | return $this->_entryLink;
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | public function setEntryLink($value)
|
---|
| 165 | {
|
---|
| 166 | $this->_entryLink = $value;
|
---|
| 167 | return $this;
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | }
|
---|