EventStatus.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 Gdata
  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_Extension
  23. */
  24. require_once 'Zend/Gdata/Extension.php';
  25. /**
  26. * Represents the gd:eventStatus element
  27. *
  28. * @category Zend
  29. * @package Zend_Gdata
  30. * @subpackage Gdata
  31. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Gdata_Extension_EventStatus extends Zend_Gdata_Extension
  35. {
  36. protected $_rootElement = 'eventStatus';
  37. protected $_value = null;
  38. public function __construct($value = null)
  39. {
  40. parent::__construct();
  41. $this->_value = $value;
  42. }
  43. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  44. {
  45. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  46. if ($this->_value !== null) {
  47. $element->setAttribute('value', $this->_value);
  48. }
  49. return $element;
  50. }
  51. protected function takeAttributeFromDOM($attribute)
  52. {
  53. switch ($attribute->localName) {
  54. case 'value':
  55. $this->_value = $attribute->nodeValue;
  56. break;
  57. default:
  58. parent::takeAttributeFromDOM($attribute);
  59. }
  60. }
  61. /**
  62. * Get the value for this element's Value attribute.
  63. *
  64. * @return string The requested attribute.
  65. */
  66. public function getValue()
  67. {
  68. return $this->_value;
  69. }
  70. /**
  71. * Set the value for this element's Value attribute.
  72. *
  73. * @param string $value The desired value for this attribute.
  74. * @return Zend_Gdata_Extension_Visibility The element being modified.
  75. */
  76. public function setValue($value)
  77. {
  78. $this->_value = $value;
  79. return $this;
  80. }
  81. /**
  82. * Magic toString method allows using this directly via echo
  83. * Works best in PHP >= 4.2.0
  84. */
  85. public function __toString()
  86. {
  87. return $this->getValue();
  88. }
  89. }