2
0

Entry.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Geo
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_Entry
  23. */
  24. require_once 'Zend/Gdata/Entry.php';
  25. /**
  26. * @see Zend_Gdata_Geo
  27. */
  28. require_once 'Zend/Gdata/Geo.php';
  29. /**
  30. * @see Zend_Gdata_Geo_Extension_GeoRssWhere
  31. */
  32. require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php';
  33. /**
  34. * An Atom entry containing Geograpic data.
  35. *
  36. * @category Zend
  37. * @package Zend_Gdata
  38. * @subpackage Geo
  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_Geo_Entry extends Zend_Gdata_Entry
  43. {
  44. protected $_entryClassName = 'Zend_Gdata_Geo_Entry';
  45. protected $_where = null;
  46. public function __construct($element = null)
  47. {
  48. $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces);
  49. parent::__construct($element);
  50. }
  51. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  52. {
  53. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  54. if ($this->_where != null) {
  55. $element->appendChild($this->_where->getDOM($element->ownerDocument));
  56. }
  57. return $element;
  58. }
  59. protected function takeChildFromDOM($child)
  60. {
  61. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  62. switch ($absoluteNodeName) {
  63. case $this->lookupNamespace('georss') . ':' . 'where':
  64. $where = new Zend_Gdata_Geo_Extension_GeoRssWhere();
  65. $where->transferFromDOM($child);
  66. $this->_where = $where;
  67. break;
  68. default:
  69. parent::takeChildFromDOM($child);
  70. break;
  71. }
  72. }
  73. public function getWhere()
  74. {
  75. return $this->_where;
  76. }
  77. public function setWhere($value)
  78. {
  79. $this->_where = $value;
  80. return $this;
  81. }
  82. }