1: <?php
2: 3: 4: 5: 6: 7: 8:
9: class Kronolith_View_ExportEvent
10: {
11: 12: 13:
14: public function __construct(Kronolith_Event $event)
15: {
16: if (!$event) {
17: echo '<h3>' . _("Event not found") . '</h3>';
18: exit;
19: }
20: if (is_string($event)) {
21: echo '<h3>' . $event . '</h3>';
22: exit;
23: }
24:
25: $iCal = new Horde_Icalendar('2.0');
26:
27: if ($event->calendarType == 'internal') {
28: try {
29: $share = $GLOBALS['kronolith_shares']->getShare($event->calendar);
30: $iCal->setAttribute('X-WR-CALNAME', $share->get('name'));
31: } catch (Exception $e) {
32: }
33: }
34:
35: $iCal->addComponent($event->toiCalendar($iCal));
36: $content = $iCal->exportvCalendar();
37:
38: $GLOBALS['browser']->downloadHeaders(
39: $event->getTitle() . '.ics',
40: 'text/calendar; charset=UTF-8',
41: true, strlen($content));
42: echo $content;
43: exit;
44: }
45:
46: }
47: