From 9e2b2a32fd0e967ad3184e9a5d091a29953acb91 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 25 Oct 2017 16:22:10 -0700 Subject: Include composer dependencies in repo --- vendor/eluceo/ical/examples/example5.php | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 vendor/eluceo/ical/examples/example5.php (limited to 'vendor/eluceo/ical/examples/example5.php') 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 @@ +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(); -- cgit v1.2.3