diff options
| author | Horus | 2021-01-14 12:09:21 +0100 |
|---|---|---|
| committer | Horus | 2021-01-14 12:09:21 +0100 |
| commit | 983167172a7995acc86c6bd05ea4c268845f1ffe (patch) | |
| tree | 169054e132b19b21fdef1860f830d176c110d050 /inc/ical.php | |
| parent | 5269a15bcffe0a5084092fc61f445c0bee588baa (diff) | |
| download | zeitumstellung-983167172a7995acc86c6bd05ea4c268845f1ffe.tar.gz | |
Reimplement in vanilla PHP.
Diffstat (limited to 'inc/ical.php')
| -rw-r--r-- | inc/ical.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/inc/ical.php b/inc/ical.php new file mode 100644 index 0000000..7cc30e9 --- /dev/null +++ b/inc/ical.php @@ -0,0 +1,39 @@ +<?php +require_once __DIR__ . '/../vendor/autoload.php'; + +use Eluceo\iCal\Component\Calendar; +use Eluceo\iCal\Component\Event; + +function iCalFeed() { + + $vCalendar = new Calendar(APP_BASE); + $vCalendar->setName(APP_NAME); + $vCalendar->setTimezone('Europe/Berlin'); + + $tc = new Zeitumstellung(); + + for ( $i=0; $i<3; $i++ ) { + + $vEvent = new Event(); + $vEvent + ->setDtStart(new \DateTime($tc->dateText)) + ->setDtEnd(new \DateTime($tc->dateText)) + ->setNoTime(true) + ->setSummary('Zeitumstellung') + ->setUrl( APP_URL ) + ->setDescription($tc->description) + ->setDescriptionHTML($tc->descriptionHTML); + + $vCalendar->addComponent($vEvent); + + $tc = $tc->next(); + } + + header('Content-Type: text/calendar; charset=utf-8'); + + if ( '0' != $_REQUEST['download'] ) { + header('Content-Disposition: attachment; filename="zeitumstellung.ics"'); + } + + echo $vCalendar->render(); +} |
