aboutsummaryrefslogtreecommitdiff
path: root/mod/event_calendar/views/ical/object/event_calendar.php
blob: 36d71a66c29948f4f87079a3cb37db3f8516d55b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php 
$event = $vars['entity'];
if ($event->organizer) {
	$organizer = "\nORGANIZER;CN={$event->organizer}\n";
} else {
	$organizer = '';
}

if ($event->description) {
	// make sure that we are using Unix line endings
	$description = str_replace("\r\n","\n",$event->description);
	$description = str_replace("\r","\n",$description);
	
	// now convert to icalendar format
	$description = str_replace("\n",'\n',$description);
	$description = wordwrap($description,75,"\r\n ",TRUE);
} else {
	$description = '';
}
?>
BEGIN:VEVENT
UID:<?php echo elgg_get_site_url().'event_calendar/view/'.$event->guid; ?>

URL:<?php echo elgg_get_site_url().'event_calendar/view/'.$event->guid; ?>

DTSTAMP:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated())?>

CREATED:<?php echo date("Ymd\THis\Z", $event->getTimeCreated())?>

LAST-MODIFIED:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated())  ?>

DTSTART;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->start_date);  ?>

DTEND;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->real_end_time);  ?>

SUMMARY:<?php echo $event->title;  ?>

DESCRIPTION:<?php echo $description;  ?>

LOCATION:<?php echo $event->venue;  ?><?php echo $organizer;  ?>

CATEGORIES:<?php implode(",",$event->tags);  ?>

END:VEVENT