summaryrefslogtreecommitdiff
path: root/vendor/eluceo/ical/examples
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/eluceo/ical/examples')
-rw-r--r--vendor/eluceo/ical/examples/example1.php30
-rw-r--r--vendor/eluceo/ical/examples/example2.php31
-rw-r--r--vendor/eluceo/ical/examples/example3.php36
-rw-r--r--vendor/eluceo/ical/examples/example4.php35
-rw-r--r--vendor/eluceo/ical/examples/example5.php66
-rw-r--r--vendor/eluceo/ical/examples/example6.php30
-rw-r--r--vendor/eluceo/ical/examples/example7.php33
7 files changed, 261 insertions, 0 deletions
diff --git a/vendor/eluceo/ical/examples/example1.php b/vendor/eluceo/ical/examples/example1.php
new file mode 100644
index 00000000..4d1d32c4
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example1.php
@@ -0,0 +1,30 @@
+<?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('Christmas');
+
+// 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();
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();
diff --git a/vendor/eluceo/ical/examples/example3.php b/vendor/eluceo/ical/examples/example3.php
new file mode 100644
index 00000000..290ff2dc
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example3.php
@@ -0,0 +1,36 @@
+<?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-31'));
+$vEvent->setDtEnd(new \DateTime('2012-12-31'));
+$vEvent->setNoTime(true);
+$vEvent->setSummary('New Year’s Eve');
+
+// Set recurrence rule
+$recurrenceRule = new \Eluceo\iCal\Property\Event\RecurrenceRule();
+$recurrenceRule->setFreq(\Eluceo\iCal\Property\Event\RecurrenceRule::FREQ_YEARLY);
+$recurrenceRule->setInterval(1);
+$vEvent->setRecurrenceRule($recurrenceRule);
+
+// 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();
diff --git a/vendor/eluceo/ical/examples/example4.php b/vendor/eluceo/ical/examples/example4.php
new file mode 100644
index 00000000..7b87144c
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example4.php
@@ -0,0 +1,35 @@
+<?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-11-11 13:00:00'));
+$vEvent->setDtEnd(new \DateTime('2012-11-11 14:30:00'));
+$vEvent->setSummary('Weekly lunch with Markus');
+
+// Set recurrence rule
+$recurrenceRule = new \Eluceo\iCal\Property\Event\RecurrenceRule();
+$recurrenceRule->setFreq(\Eluceo\iCal\Property\Event\RecurrenceRule::FREQ_WEEKLY);
+$recurrenceRule->setInterval(1);
+$vEvent->setRecurrenceRule($recurrenceRule);
+
+// 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();
diff --git a/vendor/eluceo/ical/examples/example5.php b/vendor/eluceo/ical/examples/example5.php
new file mode 100644
index 00000000..a7da6e27
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example5.php
@@ -0,0 +1,66 @@
+<?php
+
+/**
+ * example to show how to create an ICal calendar which
+ * provides a full timezone definition
+ */
+
+// use composer autoloader
+require_once __DIR__ . '/../vendor/autoload.php';
+
+// set default timezone (PHP 5.4)
+$tz = 'Europe/Berlin';
+$dtz = new \DateTimeZone($tz);
+date_default_timezone_set($tz);
+
+// 1. Create new calendar
+$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
+
+// 2. Create timezone rule object for Daylight Saving Time
+$vTimezoneRuleDst = new \Eluceo\iCal\Component\TimezoneRule(\Eluceo\iCal\Component\TimezoneRule::TYPE_DAYLIGHT);
+$vTimezoneRuleDst->setTzName('CEST');
+$vTimezoneRuleDst->setDtStart(new \DateTime('1981-03-29 02:00:00', $dtz));
+$vTimezoneRuleDst->setTzOffsetFrom('+0100');
+$vTimezoneRuleDst->setTzOffsetTo('+0200');
+$dstRecurrenceRule = new \Eluceo\iCal\Property\Event\RecurrenceRule();
+$dstRecurrenceRule->setFreq(\Eluceo\iCal\Property\Event\RecurrenceRule::FREQ_YEARLY);
+$dstRecurrenceRule->setByMonth(3);
+$dstRecurrenceRule->setByDay('-1SU');
+$vTimezoneRuleDst->setRecurrenceRule($dstRecurrenceRule);
+
+// 3. Create timezone rule object for Standard Time
+$vTimezoneRuleStd = new \Eluceo\iCal\Component\TimezoneRule(\Eluceo\iCal\Component\TimezoneRule::TYPE_STANDARD);
+$vTimezoneRuleStd->setTzName('CET');
+$vTimezoneRuleStd->setDtStart(new \DateTime('1996-10-27 03:00:00', $dtz));
+$vTimezoneRuleStd->setTzOffsetFrom('+0200');
+$vTimezoneRuleStd->setTzOffsetTo('+0100');
+$stdRecurrenceRule = new \Eluceo\iCal\Property\Event\RecurrenceRule();
+$stdRecurrenceRule->setFreq(\Eluceo\iCal\Property\Event\RecurrenceRule::FREQ_YEARLY);
+$stdRecurrenceRule->setByMonth(10);
+$stdRecurrenceRule->setByDay('-1SU');
+$vTimezoneRuleStd->setRecurrenceRule($stdRecurrenceRule);
+
+// 4. Create timezone definition and add rules
+$vTimezone = new \Eluceo\iCal\Component\Timezone($tz);
+$vTimezone->addComponent($vTimezoneRuleDst);
+$vTimezone->addComponent($vTimezoneRuleStd);
+$vCalendar->setTimezone($vTimezone);
+
+// 5. Create an event
+$vEvent = new \Eluceo\iCal\Component\Event();
+$vEvent->setDtStart(new \DateTime('2012-12-24', $dtz));
+$vEvent->setDtEnd(new \DateTime('2012-12-24', $dtz));
+$vEvent->setSummary('Summary with some german "umlauten" and a backslash \\: Kinder mögen Äpfel pflücken.');
+
+// 6. Adding Timezone
+$vEvent->setUseTimezone(true);
+
+// 7. Add event to calendar
+$vCalendar->addComponent($vEvent);
+
+// 8. Set headers
+header('Content-Type: text/calendar; charset=utf-8');
+header('Content-Disposition: attachment; filename="cal.ics"');
+
+// 9. Output
+echo $vCalendar->render();
diff --git a/vendor/eluceo/ical/examples/example6.php b/vendor/eluceo/ical/examples/example6.php
new file mode 100644
index 00000000..10400993
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example6.php
@@ -0,0 +1,30 @@
+<?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('Christmas');
+
+// add some location information for apple devices
+$vEvent->setLocation("Infinite Loop\nCupertino CA 95014", 'Infinite Loop', '37.332095,-122.030743');
+
+// 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();
diff --git a/vendor/eluceo/ical/examples/example7.php b/vendor/eluceo/ical/examples/example7.php
new file mode 100644
index 00000000..1f8013e7
--- /dev/null
+++ b/vendor/eluceo/ical/examples/example7.php
@@ -0,0 +1,33 @@
+<?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('Christmas');
+$vEvent->setDescription('Happy Christmas!');
+$vEvent->setDescriptionHTML('<b>Happy Christmas!</b>');
+
+
+// add some location information for apple devices
+$vEvent->setLocation("Infinite Loop\nCupertino CA 95014", 'Infinite Loop', '37.332095,-122.030743');
+
+// 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();