EventEntry.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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_Entry
  24. */
  25. require_once 'Zend/Gdata/Entry.php';
  26. /**
  27. * @see Zend_Gdata_App_Extension
  28. */
  29. require_once 'Zend/Gdata/App/Extension.php';
  30. /**
  31. * @see Zend_Gdata_Extension_Where
  32. */
  33. require_once 'Zend/Gdata/Extension/Where.php';
  34. /**
  35. * @see Zend_Gdata_Extension_When
  36. */
  37. require_once 'Zend/Gdata/Extension/When.php';
  38. /**
  39. * @see Zend_Gdata_Extension_Who
  40. */
  41. require_once 'Zend/Gdata/Extension/Who.php';
  42. /**
  43. * @see Zend_Gdata_Extension_Recurrence
  44. */
  45. require_once 'Zend/Gdata/Extension/Recurrence.php';
  46. /**
  47. * @see Zend_Gdata_Extension_EventStatus
  48. */
  49. require_once 'Zend/Gdata/Extension/EventStatus.php';
  50. /**
  51. * @see Zend_Gdata_Extension_Comments
  52. */
  53. require_once 'Zend/Gdata/Extension/Comments.php';
  54. /**
  55. * @see Zend_Gdata_Extension_Transparency
  56. */
  57. require_once 'Zend/Gdata/Extension/Transparency.php';
  58. /**
  59. * @see Zend_Gdata_Extension_Visibility
  60. */
  61. require_once 'Zend/Gdata/Extension/Visibility.php';
  62. /**
  63. * @see Zend_Gdata_Extension_ExtendedProperty
  64. */
  65. require_once 'Zend/Gdata/Extension/ExtendedProperty.php';
  66. /**
  67. * @see Zend_Gdata_Extension_OriginalEvent
  68. */
  69. require_once 'Zend/Gdata/Extension/OriginalEvent.php';
  70. /**
  71. * @see Zend_Gdata_Extension_EntryLink
  72. */
  73. require_once 'Zend/Gdata/Extension/EntryLink.php';
  74. /**
  75. * Data model for the Gdata Event "Kind". Google Calendar has a separate
  76. * EventEntry class which extends this.
  77. *
  78. * @category Zend
  79. * @package Zend_Gdata
  80. * @subpackage Gdata
  81. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  82. * @license http://framework.zend.com/license/new-bsd New BSD License
  83. */
  84. class Zend_Gdata_Kind_EventEntry extends Zend_Gdata_Entry
  85. {
  86. protected $_who = array();
  87. protected $_when = array();
  88. protected $_where = array();
  89. protected $_recurrence = null;
  90. protected $_eventStatus = null;
  91. protected $_comments = null;
  92. protected $_transparency = null;
  93. protected $_visibility = null;
  94. protected $_recurrenceException = array();
  95. protected $_extendedProperty = array();
  96. protected $_originalEvent = null;
  97. protected $_entryLink = null;
  98. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  99. {
  100. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  101. if ($this->_who != null) {
  102. foreach ($this->_who as $who) {
  103. $element->appendChild($who->getDOM($element->ownerDocument));
  104. }
  105. }
  106. if ($this->_when != null) {
  107. foreach ($this->_when as $when) {
  108. $element->appendChild($when->getDOM($element->ownerDocument));
  109. }
  110. }
  111. if ($this->_where != null) {
  112. foreach ($this->_where as $where) {
  113. $element->appendChild($where->getDOM($element->ownerDocument));
  114. }
  115. }
  116. if ($this->_recurrenceException != null) {
  117. foreach ($this->_recurrenceException as $recurrenceException) {
  118. $element->appendChild($recurrenceException->getDOM($element->ownerDocument));
  119. }
  120. }
  121. if ($this->_extendedProperty != null) {
  122. foreach ($this->_extendedProperty as $extProp) {
  123. $element->appendChild($extProp->getDOM($element->ownerDocument));
  124. }
  125. }
  126. if ($this->_recurrence != null) {
  127. $element->appendChild($this->_recurrence->getDOM($element->ownerDocument));
  128. }
  129. if ($this->_eventStatus != null) {
  130. $element->appendChild($this->_eventStatus->getDOM($element->ownerDocument));
  131. }
  132. if ($this->_comments != null) {
  133. $element->appendChild($this->_comments->getDOM($element->ownerDocument));
  134. }
  135. if ($this->_transparency != null) {
  136. $element->appendChild($this->_transparency->getDOM($element->ownerDocument));
  137. }
  138. if ($this->_visibility != null) {
  139. $element->appendChild($this->_visibility->getDOM($element->ownerDocument));
  140. }
  141. if ($this->_originalEvent != null) {
  142. $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
  143. }
  144. if ($this->_entryLink != null) {
  145. $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
  146. }
  147. return $element;
  148. }
  149. protected function takeChildFromDOM($child)
  150. {
  151. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  152. switch ($absoluteNodeName) {
  153. case $this->lookupNamespace('gd') . ':' . 'where';
  154. $where = new Zend_Gdata_Extension_Where();
  155. $where->transferFromDOM($child);
  156. $this->_where[] = $where;
  157. break;
  158. case $this->lookupNamespace('gd') . ':' . 'when';
  159. $when = new Zend_Gdata_Extension_When();
  160. $when->transferFromDOM($child);
  161. $this->_when[] = $when;
  162. break;
  163. case $this->lookupNamespace('gd') . ':' . 'who';
  164. $who = new Zend_Gdata_Extension_Who();
  165. $who ->transferFromDOM($child);
  166. $this->_who[] = $who;
  167. break;
  168. case $this->lookupNamespace('gd') . ':' . 'recurrence';
  169. $recurrence = new Zend_Gdata_Extension_Recurrence();
  170. $recurrence->transferFromDOM($child);
  171. $this->_recurrence = $recurrence;
  172. break;
  173. case $this->lookupNamespace('gd') . ':' . 'eventStatus';
  174. $eventStatus = new Zend_Gdata_Extension_EventStatus();
  175. $eventStatus->transferFromDOM($child);
  176. $this->_eventStatus = $eventStatus;
  177. break;
  178. case $this->lookupNamespace('gd') . ':' . 'comments';
  179. $comments = new Zend_Gdata_Extension_Comments();
  180. $comments->transferFromDOM($child);
  181. $this->_comments = $comments;
  182. break;
  183. case $this->lookupNamespace('gd') . ':' . 'transparency';
  184. $transparency = new Zend_Gdata_Extension_Transparency();
  185. $transparency ->transferFromDOM($child);
  186. $this->_transparency = $transparency;
  187. break;
  188. case $this->lookupNamespace('gd') . ':' . 'visibility';
  189. $visiblity = new Zend_Gdata_Extension_Visibility();
  190. $visiblity ->transferFromDOM($child);
  191. $this->_visibility = $visiblity;
  192. break;
  193. case $this->lookupNamespace('gd') . ':' . 'recurrenceException';
  194. require_once 'Zend/Gdata/Extension/RecurrenceException.php';
  195. $recurrenceException = new Zend_Gdata_Extension_RecurrenceException();
  196. $recurrenceException ->transferFromDOM($child);
  197. $this->_recurrenceException[] = $recurrenceException;
  198. break;
  199. case $this->lookupNamespace('gd') . ':' . 'originalEvent';
  200. $originalEvent = new Zend_Gdata_Extension_OriginalEvent();
  201. $originalEvent ->transferFromDOM($child);
  202. $this->_originalEvent = $originalEvent;
  203. break;
  204. case $this->lookupNamespace('gd') . ':' . 'extendedProperty';
  205. $extProp = new Zend_Gdata_Extension_ExtendedProperty();
  206. $extProp->transferFromDOM($child);
  207. $this->_extendedProperty[] = $extProp;
  208. break;
  209. case $this->lookupNamespace('gd') . ':' . 'entryLink':
  210. $entryLink = new Zend_Gdata_Extension_EntryLink();
  211. $entryLink->transferFromDOM($child);
  212. $this->_entryLink = $entryLink;
  213. break;
  214. default:
  215. parent::takeChildFromDOM($child);
  216. break;
  217. }
  218. }
  219. public function getWhen()
  220. {
  221. return $this->_when;
  222. }
  223. /**
  224. * @param array $value
  225. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  226. */
  227. public function setWhen($value)
  228. {
  229. $this->_when = $value;
  230. return $this;
  231. }
  232. public function getWhere()
  233. {
  234. return $this->_where;
  235. }
  236. /**
  237. * @param array $value
  238. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  239. */
  240. public function setWhere($value)
  241. {
  242. $this->_where = $value;
  243. return $this;
  244. }
  245. public function getWho()
  246. {
  247. return $this->_who;
  248. }
  249. /**
  250. * @param array $value
  251. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  252. */
  253. public function setWho($value)
  254. {
  255. $this->_who = $value;
  256. return $this;
  257. }
  258. public function getRecurrence()
  259. {
  260. return $this->_recurrence;
  261. }
  262. /**
  263. * @param array $value
  264. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  265. */
  266. public function setRecurrence($value)
  267. {
  268. $this->_recurrence = $value;
  269. return $this;
  270. }
  271. public function getEventStatus()
  272. {
  273. return $this->_eventStatus;
  274. }
  275. /**
  276. * @param array $value
  277. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  278. */
  279. public function setEventStatus($value)
  280. {
  281. $this->_eventStatus = $value;
  282. return $this;
  283. }
  284. public function getComments()
  285. {
  286. return $this->_comments;
  287. }
  288. /**
  289. * @param array $value
  290. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  291. */
  292. public function setComments($value)
  293. {
  294. $this->_comments = $value;
  295. return $this;
  296. }
  297. public function getTransparency()
  298. {
  299. return $this->_transparency;
  300. }
  301. /**
  302. * @param Zend_Gdata_Transparency $value
  303. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  304. */
  305. public function setTransparency($value)
  306. {
  307. $this->_transparency = $value;
  308. return $this;
  309. }
  310. public function getVisibility()
  311. {
  312. return $this->_visibility;
  313. }
  314. /**
  315. * @param Zend_Gdata_Visibility $value
  316. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  317. */
  318. public function setVisibility($value)
  319. {
  320. $this->_visibility = $value;
  321. return $this;
  322. }
  323. public function getRecurrenceExcption()
  324. {
  325. return $this->_recurrenceException;
  326. }
  327. /**
  328. * @param array $value
  329. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  330. */
  331. public function setRecurrenceException($value)
  332. {
  333. $this->_recurrenceException = $value;
  334. return $this;
  335. }
  336. public function getExtendedProperty()
  337. {
  338. return $this->_extendedProperty;
  339. }
  340. /**
  341. * @param array $value
  342. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  343. */
  344. public function setExtendedProperty($value)
  345. {
  346. $this->_extendedProperty = $value;
  347. return $this;
  348. }
  349. public function getOriginalEvent()
  350. {
  351. return $this->_originalEvent;
  352. }
  353. /**
  354. * @param Zend_Gdata_Extension_OriginalEvent $value
  355. * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface
  356. */
  357. public function setOriginalEvent($value)
  358. {
  359. $this->_originalEvent = $value;
  360. return $this;
  361. }
  362. /**
  363. * Get this entry's EntryLink element.
  364. *
  365. * @return Zend_Gdata_Extension_EntryLink The requested entry.
  366. */
  367. public function getEntryLink()
  368. {
  369. return $this->_entryLink;
  370. }
  371. /**
  372. * Set the child's EntryLink element.
  373. *
  374. * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
  375. * @return Zend_Gdata_Extension_Who The element being modified.
  376. */
  377. public function setEntryLink($value)
  378. {
  379. $this->_entryLink = $value;
  380. return $this;
  381. }
  382. }