2
0

OriginalEvent.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Gdata_Extension
  24. */
  25. require_once 'Zend/Gdata/Extension.php';
  26. /**
  27. * @see Zend_Gdata_Feed
  28. */
  29. require_once 'Zend/Gdata/Feed.php';
  30. /**
  31. * @see Zend_Gdata_When
  32. */
  33. require_once 'Zend/Gdata/Extension/When.php';
  34. /**
  35. * Represents the gd:originalEvent element
  36. *
  37. * @category Zend
  38. * @package Zend_Gdata
  39. * @subpackage Gdata
  40. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  41. * @license http://framework.zend.com/license/new-bsd New BSD License
  42. */
  43. class Zend_Gdata_Extension_OriginalEvent extends Zend_Gdata_Extension
  44. {
  45. protected $_rootElement = 'originalEvent';
  46. protected $_id = null;
  47. protected $_href = null;
  48. protected $_when = null;
  49. public function __construct($id = null, $href = null, $when = null)
  50. {
  51. parent::__construct();
  52. $this->_id = $id;
  53. $this->_href = $href;
  54. $this->_when = $when;
  55. }
  56. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  57. {
  58. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  59. if ($this->_id !== null) {
  60. $element->setAttribute('id', $this->_id);
  61. }
  62. if ($this->_href !== null) {
  63. $element->setAttribute('href', $this->_href);
  64. }
  65. if ($this->_when !== null) {
  66. $element->appendChild($this->_when->getDOM($element->ownerDocument));
  67. }
  68. return $element;
  69. }
  70. protected function takeAttributeFromDOM($attribute)
  71. {
  72. switch ($attribute->localName) {
  73. case 'id':
  74. $this->_id = $attribute->nodeValue;
  75. break;
  76. case 'href':
  77. $this->_href = $attribute->nodeValue;
  78. break;
  79. default:
  80. parent::takeAttributeFromDOM($attribute);
  81. }
  82. }
  83. protected function takeChildFromDOM($child)
  84. {
  85. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  86. switch ($absoluteNodeName) {
  87. case $this->lookupNamespace('gd') . ':' . 'when';
  88. $when = new Zend_Gdata_Extension_When();
  89. $when->transferFromDOM($child);
  90. $this->_when = $when;
  91. break;
  92. default:
  93. parent::takeChildFromDOM($child);
  94. break;
  95. }
  96. }
  97. public function getId()
  98. {
  99. return $this->_id;
  100. }
  101. public function setId($value)
  102. {
  103. $this->_id = $value;
  104. return $this;
  105. }
  106. public function getHref()
  107. {
  108. return $this->_href;
  109. }
  110. public function setHref($value)
  111. {
  112. $this->_href = $value;
  113. return $this;
  114. }
  115. public function getWhen()
  116. {
  117. return $this->_when;
  118. }
  119. public function setWhen($value)
  120. {
  121. $this->_when = $value;
  122. return $this;
  123. }
  124. }