2
0

EventEntry.php 12 KB

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