aboutsummaryrefslogtreecommitdiff
path: root/views/ical/export/entity.php
blob: eaa3b56d833beeabb244d01cea57c56746eda213 (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
<?php
/**
 * Elgg ICAL output of default object.
 *
 * @package Elgg
 * @subpackage Core
 *
 */

$entity = $vars['entity'];

if ($entity instanceof Notable &&
	$entity->getCalendarStartTime() &&
	$entity->getCalendarEndTime()) {

	$timestamp = date("Ymd\THis\Z", $entity->getTimeCreated());
	$start = date("Ymd\THis\Z", $entity->getCalendarStartTime());
	$end = date("Ymd\THis\Z", $entity->getCalendarEndTime());
	$summary = $entity->title;
	$modified = date("Ymd\THis\Z", $entity->getTimeUpdated());

	echo <<< ICAL
BEGIN:VEVENT
DTSTAMP:$timestamp
DTSTART:$start
DTEND:$end
SUMMARY:$summary
LAST-MODIFIED:$modified
END:VEVENT

ICAL;

}