[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 Geo
|
---|
| 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_Geo
|
---|
| 30 | */
|
---|
| 31 | require_once 'Zend/Gdata/Geo.php';
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * @see Zend_Gdata_Geo_Extension_GmlPoint
|
---|
| 35 | */
|
---|
| 36 | require_once 'Zend/Gdata/Geo/Extension/GmlPoint.php';
|
---|
| 37 |
|
---|
| 38 |
|
---|
| 39 | /**
|
---|
| 40 | * Represents the georss:where element used by the Gdata Geo extensions.
|
---|
| 41 | *
|
---|
| 42 | * @category Zend
|
---|
| 43 | * @package Zend_Gdata
|
---|
| 44 | * @subpackage Geo
|
---|
| 45 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 46 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 47 | */
|
---|
| 48 | class Zend_Gdata_Geo_Extension_GeoRssWhere extends Zend_Gdata_Extension
|
---|
| 49 | {
|
---|
| 50 |
|
---|
| 51 | protected $_rootNamespace = 'georss';
|
---|
| 52 | protected $_rootElement = 'where';
|
---|
| 53 |
|
---|
| 54 | /**
|
---|
| 55 | * The point location for this geo element
|
---|
| 56 | *
|
---|
| 57 | * @var Zend_Gdata_Geo_Extension_GmlPoint
|
---|
| 58 | */
|
---|
| 59 | protected $_point = null;
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * Create a new instance.
|
---|
| 63 | *
|
---|
| 64 | * @param Zend_Gdata_Geo_Extension_GmlPoint $point (optional) Point to which
|
---|
| 65 | * object should be initialized.
|
---|
| 66 | */
|
---|
| 67 | public function __construct($point = null)
|
---|
| 68 | {
|
---|
| 69 | $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces);
|
---|
| 70 | parent::__construct();
|
---|
| 71 | $this->setPoint($point);
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | /**
|
---|
| 75 | * Retrieves a DOMElement which corresponds to this element and all
|
---|
| 76 | * child properties. This is used to build an entry back into a DOM
|
---|
| 77 | * and eventually XML text for application storage/persistence.
|
---|
| 78 | *
|
---|
| 79 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
| 80 | * @return DOMElement The DOMElement representing this element and all
|
---|
| 81 | * child properties.
|
---|
| 82 | */
|
---|
| 83 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 84 | {
|
---|
| 85 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 86 | if ($this->_point !== null) {
|
---|
| 87 | $element->appendChild($this->_point->getDOM($element->ownerDocument));
|
---|
| 88 | }
|
---|
| 89 | return $element;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | /**
|
---|
| 93 | * Creates individual Entry objects of the appropriate type and
|
---|
| 94 | * stores them as members of this entry based upon DOM data.
|
---|
| 95 | *
|
---|
| 96 | * @param DOMNode $child The DOMNode to process
|
---|
| 97 | */
|
---|
| 98 | protected function takeChildFromDOM($child)
|
---|
| 99 | {
|
---|
| 100 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
| 101 |
|
---|
| 102 | switch ($absoluteNodeName) {
|
---|
| 103 | case $this->lookupNamespace('gml') . ':' . 'Point';
|
---|
| 104 | $point = new Zend_Gdata_Geo_Extension_GmlPoint();
|
---|
| 105 | $point->transferFromDOM($child);
|
---|
| 106 | $this->_point = $point;
|
---|
| 107 | break;
|
---|
| 108 | }
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | /**
|
---|
| 112 | * Get the value for this element's point attribute.
|
---|
| 113 | *
|
---|
| 114 | * @see setPoint
|
---|
| 115 | * @return Zend_Gdata_Geo_Extension_GmlPoint The requested attribute.
|
---|
| 116 | */
|
---|
| 117 | public function getPoint()
|
---|
| 118 | {
|
---|
| 119 | return $this->_point;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | /**
|
---|
| 123 | * Set the value for this element's point attribute.
|
---|
| 124 | *
|
---|
| 125 | * @param Zend_Gdata_Geo_Extension_GmlPoint $value The desired value for this attribute.
|
---|
| 126 | * @return Zend_Gdata_Geo_Extension_GeoRssWhere Provides a fluent interface
|
---|
| 127 | */
|
---|
| 128 | public function setPoint($value)
|
---|
| 129 | {
|
---|
| 130 | $this->_point = $value;
|
---|
| 131 | return $this;
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | }
|
---|