summaryrefslogtreecommitdiff
path: root/vendor/eluceo/ical/examples/example2.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-10-25 16:22:10 -0700
committerFrederic Guillot <fred@kanboard.net>2017-10-25 16:22:10 -0700
commit9e2b2a32fd0e967ad3184e9a5d091a29953acb91 (patch)
tree00822e24aa1110c73ca455a8d096ef296c008cbc /vendor/eluceo/ical/examples/example2.php
parentc507c5416251c505cb3e088a03c6664bed73c812 (diff)
Include composer dependencies in repo
Diffstat (limited to 'vendor/eluceo/ical/examples/example2.php')
-rw-r--r--vendor/eluceo/ical/examples/example2.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/eluceo/ical/examples/example2.php b/vendor/eluceo/ical/examples/example2.php
new file mode 100644
index 00000000..bafcf033
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example2.php
@@ -0,0 +1,31 @@
+<?php
+
+// use composer autoloader
+require_once __DIR__ . '/../vendor/autoload.php';
+
+// set default timezone (PHP 5.4)
+date_default_timezone_set('Europe/Berlin');
+
+// 1. Create new calendar
+$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
+
+// 2. Create an event
+$vEvent = new \Eluceo\iCal\Component\Event();
+$vEvent->setDtStart(new \DateTime('2012-12-24'));
+$vEvent->setDtEnd(new \DateTime('2012-12-24'));
+$vEvent->setNoTime(true);
+$vEvent->setSummary('Summary with some german "umlauten" and a backslash \\: Kinder mögen Äpfel pflücken.');
+$vEvent->setCategories(['holidays']);
+
+// Adding Timezone (optional)
+$vEvent->setUseTimezone(true);
+
+// 3. Add event to calendar
+$vCalendar->addComponent($vEvent);
+
+// 4. Set headers
+header('Content-Type: text/calendar; charset=utf-8');
+header('Content-Disposition: attachment; filename="cal.ics"');
+
+// 5. Output
+echo $vCalendar->render();