/** * @coversNothing */ public function testExample3() { $timeZone = new \DateTimeZone('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('123456'); $vEvent->setDtStart(new \DateTime('2012-12-31', $timeZone)); $vEvent->setDtEnd(new \DateTime('2012-12-31', $timeZone)); $vEvent->setNoTime(true); $vEvent->setIsPrivate(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); $lines = array('/BEGIN:VCALENDAR/', '/VERSION:2\\.0/', '/PRODID:www\\.example\\.com/', '/X-PUBLISHED-TTL:P1W/', '/BEGIN:VEVENT/', '/UID:123456/', '/DTSTART;TZID=Europe\\/Berlin;VALUE=DATE:20121231/', '/SEQUENCE:0/', '/TRANSP:OPAQUE/', '/DTEND;TZID=Europe\\/Berlin;VALUE=DATE:20121231/', '/SUMMARY:New Year’s Eve/', '/CLASS:PRIVATE/', '/RRULE:FREQ=YEARLY;INTERVAL=1/', '/X-MICROSOFT-CDO-ALLDAYEVENT:TRUE/', '/DTSTAMP:20\\d{6}T\\d{6}Z/', '/END:VEVENT/', '/END:VCALENDAR/'); foreach (explode("\n", $vCalendar->render()) as $key => $line) { $this->assertTrue(isset($lines[$key]), 'Too many lines... ' . $line); $this->assertRegExp($lines[$key], $line); } }
function calendar_to_ical($calendar) { $vCalendar = new \Eluceo\iCal\Component\Calendar('Calendar API V1'); $vCalendar->setName($calendar->summary); $vCalendar->setDescription($calendar->description); $vCalendar->setTimezone($calendar->timezone); return $vCalendar; }
/** * @param Organizer $vOrganizer * @return \Eluceo\iCal\Component\Calendar */ private function createCalendarWithOrganizer(\Eluceo\iCal\Property\Event\Organizer $vOrganizer) { $vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com'); $vEvent = new \Eluceo\iCal\Component\Event('123456'); $vEvent->setOrganizer($vOrganizer); $vCalendar->addComponent($vEvent); return $vCalendar; }
/** * Add a new calendar event. * * @param Request $request * * * @Route("/download", name="event_download") * @Method("GET") */ public function downloadAction() { $vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com'); $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart(new \DateTime('2012-12-24'))->setDtEnd(new \DateTime('2012-12-24'))->setNoTime(true)->setSummary('Christmas'); $vCalendar->addComponent($vEvent); $response = new Response(); $response->setContent($vCalendar->render())->setCharset('ISO-8859-1')->setStatusCode(Response::HTTP_OK); $response->headers->set('Content-Type', 'multipart/alternative'); $response->headers->set('Content-Disposition', 'attachment; filename="cal.ics"'); return $response; }
public function testDescriptionWithNewLines() { $input = "new string \n new line \n new line \n new string"; $vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com'); $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart(new \DateTime('2014-12-24')); $vEvent->setDtEnd(new \DateTime('2014-12-24')); $vEvent->setDescription($input); $vCalendar->addComponent($vEvent); $output = $vCalendar->render(); $this->assertContains($input, $output); }
public function write() { $vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com'); $erb = new EventRepositoryBuilder($this->siteContainer); // TODO up to one month old! foreach ($erb->fetchAll() as $event) { $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart($event->getStart())->setDtEnd($event->getEnd())->setSummary($event->getTitle())->setDescription($event->getDescription())->setUrl($this->twigHelper->getTwig()->getExtension('openacalendar_internallink')->internalLinkToDir('/event/' . $event->getSlug())); $vCalendar->addComponent($vEvent); } $this->outFolder->addFileContents('api1', 'events.ics', $vCalendar->render()); }
public function testFoldWithMultibyte() { $input = "x" . str_repeat("あいうえお", 5); $vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com'); $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart(new \DateTime('2012-12-24')); $vEvent->setDtEnd(new \DateTime('2012-12-24')); $vEvent->setDescription($input); $vCalendar->addEvent($vEvent); $output = $vCalendar->render(); $output = preg_replace('/\\r\\n /u', '', $output); $this->assertContains($input, $output); }
public function calendar($society_id) { $events = $this->eventsForSociety($society_id)['events']; $vCalendar = new \Eluceo\iCal\Component\Calendar('lowdown.netsoc.co'); foreach ($events as $event) { $vEvent = new \Eluceo\iCal\Component\Event(); $eventTime = new DateTime($event->time); $endTime = $eventTime; $endTime->add(new DateInterval('PT1H')); $eventSummary = $event->society()->first()->name . ' Society: ' . $event->title; $vEvent->setDtStart($eventTime)->setDtEnd($endTime)->setSummary($eventSummary); if ($event->location) { $vEvent->setLocation($event->location); } $vCalendar->addComponent($vEvent); } header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="cal.ics"'); echo $vCalendar->render(); }
/** * Renders an ical file for a specific group */ public function group(Group $group) { // 1. Create new calendar $vCalendar = new \Eluceo\iCal\Component\Calendar(config('app.url')); $vCalendar->setName(config('mobilizator.name') . ' : ' . $group->name); $vCalendar->setDescription(summary($group->body, 500)); // returns actions started the last 60 days $actions = $group->actions()->where('start', '>=', Carbon::now()->subDays(60))->get(); foreach ($actions as $action) { // 2. Create an event $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart($action->start); $vEvent->setDtEnd($action->stop); $vEvent->setSummary($action->name); $vEvent->setDescription(summary($action->body), 1000); $vEvent->setLocation($action->location); $vEvent->setUrl(action('ActionController@show', [$action->group->id, $action->id])); $vEvent->setUseUtc(false); //TODO fixme $vCalendar->addComponent($vEvent); } return response($vCalendar->render())->header('Content-Type', 'text/calendar; charset=utf-8')->header('Content-Disposition', 'attachment; filename="cal.ics"'); }
<?php // require files require_once '../src/Eluceo/iCal/Component.php'; require_once '../src/Eluceo/iCal/PropertyBag.php'; require_once '../src/Eluceo/iCal/Property.php'; require_once '../src/Eluceo/iCal/Component/Calendar.php'; require_once '../src/Eluceo/iCal/Component/Event.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->addEvent($vEvent); // 4. Set headers header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="cal.ics"'); // 5. Output echo $vCalendar->render();
<?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();
public function generateIcal() { // set default timezone (PHP 5.4) date_default_timezone_set('Europe/Berlin'); $ical_name = 'HSG Wesel - Gesamtspielplan'; $ical_calid = 'hsg_wesel_1516_total'; $ics_file_name = 'hsg_wesel_1516_total.ics'; $team_info = $this->getTeamInfo(); if (is_array($team_info)) { $ical_name = 'HSG Wesel - Saison 2015/16 - ' . $team_info['team']; $ical_calid = 'hsg_wesel_1516_' . $team_info['liga_id']; $ics_file_name = 'hsg_wesel_1516_' . $this->getTeam() . '.ics'; } else { switch ($this->art) { case '188': $ical_name = 'HSG Wesel - Saison 2015/16 - Spielplan Heim'; $ical_calid = 'hsg_wesel_1516_1330105011_heim'; $ics_file_name = 'hsg_wesel_1516_spielplan_heim' . '.ics'; break; case '199': $ical_name = 'HSG Wesel - Saison 2015/16 - Spielplan Auswärts'; $ical_calid = 'hsg_wesel_1516_1330105011_auswaerts'; $ics_file_name = 'hsg_wesel_1516_auswaerts' . '.ics'; break; } } // 1. Create new calendar $vCalendar = new \Eluceo\iCal\Component\Calendar('HSG Wesel SIS-Handball ICS-Generator'); $vCalendar->setName($ical_name); $vCalendar->setDescription('HSG Wesel / photominister.de'); $vCalendar->setCalId($ical_calid); $vCalendar->setMethod('PUBLISH'); // 2. Create an event // $this->framework->dump($this->art); if (count($this->xml->Spiel) > 0) { foreach ($this->xml->Spiel as $spiel) { $element = $this->getHash($spiel); $show_heim = substr($spiel->Heim, 0, 9) == 'HSG Wesel'; $show_gast = substr($spiel->Gast, 0, 9) == 'HSG Wesel'; switch ($this->art) { case '188': $cond = $show_heim; break; case '199': $cond = $show_gast; break; default: $cond = $show_heim || $show_gast; break; } if ($cond) { $description = $spiel->LigaName . '..... www.hsg-wesel.de ..... www.handballinwesel.de ..... www.facebook.com/hsgwesel'; $description = str_replace("\r\n", "\\n", $description); $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart(new \DateTime($spiel->SpielVon)); $vEvent->setDtEnd(new \DateTime($spiel->SpielBis)); $vEvent->setSummary($spiel->Heim . ' - ' . $spiel->Gast); $vEvent->setDescription($description); $vEvent->setLocation($spiel->HallenName . ', ' . $spiel->HallenStrasse . ', ' . $spiel->HallenOrt); $vEvent->setUseTimezone(TRUE); // 3. Add event to calendar $vCalendar->addComponent($vEvent); unset($vEvent); } } } // 4. Set headers header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="' . $ics_file_name . '"'); // 5. Output echo $vCalendar->render(); exit; }
public function ical($key) { switch ($key) { case 'public': $items = BookingItem::where('start_at', '>=', date('Y-m-d'))->where('booking.is_private', '=', false)->with('booking', 'ressource')->get(); $description = ''; break; default: $filter = true; if (preg_match('/^(.+)_(.+)$/', $key, $tokens)) { $key = $tokens[1]; if ($tokens[2] != 'all') { App::abort(404); return false; } $filter = false; } $owner = User::where('booking_key', '=', $key)->first(); if (!$owner) { App::abort(404); return false; } $description = $owner->fullname; $items = BookingItem::where('start_at', '>=', date('Y-m-d'))->join('booking', 'booking_item.booking_id', '=', 'booking.id')->join('users', 'booking.user_id', '=', 'users.id'); if ($filter) { $items = $items->where('users.booking_key', '=', $key); } $items = $items->with('booking', 'ressource')->get(); break; } $vCalendar = new \Eluceo\iCal\Component\Calendar(Request::server('SERVER_NAME')); $vCalendar->setDescription($description); $tz = new DateTimeZone(date_default_timezone_get()); foreach ($items as $booking_item) { $start = new \DateTime($booking_item->start_at); $start->setTimezone($tz); $end = new \DateTime($booking_item->start_at); $start->setTimezone($tz); $end->modify(sprintf('+%d minutes', $booking_item->duration)); $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart($start)->setDtEnd($end)->setUseTimezone(true)->setSummary(sprintf('%s (%s)', $booking_item->booking->title, $booking_item->ressource->name)); $vCalendar->addComponent($vEvent); } $response = Response::make($vCalendar->render()); $response->header('Content-Type', 'text/calendar; charset=utf-8'); $response->header('Content-Disposition', 'attachment; filename="cal.ics"'); return $response; }
* This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @version 0.1, June 20, 2012 * @link https://github.com/reinvented/levees * @author Peter Rukavina <*****@*****.**> * @copyright Copyright © 2015, Reinvented Inc. * @license hhttps://opensource.org/licenses/MIT MIT license */ // Required for iCalendar creation; you must install "eluceo — iCal" as above. require_once 'vendor/autoload.php'; // Set the default time zone. date_default_timezone_set("America/Halifax"); // Create a new iCalendar object. $vCalendar = new \Eluceo\iCal\Component\Calendar('ruk.ca/levee-2016'); // We're going to create four files; first we define them. $file['json+ld'] = "levees.json"; $file['geojson'] = "levees.geojson"; $file['html'] = "levees.html"; $file['ics'] = "levees.ics"; list($fp, $content) = openFiles($file); // Open the SQLite3 database that stores levee information. $db = new SQLite3('data/levees.sqlite'); // Initialize a counter that we can use for the GeoJSON marker-symbol property. $counter = 1; // Retrieve all the levees $results = $db->query('SELECT * FROM levees order by startDate, endDate, name'); while ($row = $results->fetchArray(SQLITE3_ASSOC)) { // Create JSON+LD for this levee. $content['json+ld'][] = makeJSONLD($row);
/** * sendCalendarReminder method * Notification about the reminder is sent only * when the record belonds to anyone. * @param Cake\Event $event from the afterSave * @param Cake\Datasource\EntityInterface $entity from the afterSave * @return array|bool $sent on whether the email was sent */ public function sendCalendarReminder(Event $event, EntityInterface $entity) { $sent = false; $currentUser = null; //get applications's timezone $timezone = Time::now()->format('e'); $dtz = new \DateTimeZone($timezone); $table = $event->subject(); //get attendees Table for the event if (method_exists($table, 'getConfig') && is_callable([$table, 'getConfig'])) { $config = $table->getConfig(); $remindersTo = $table->getTableAllowRemindersField(); } // skip if attendees Table is not defined if (empty($remindersTo)) { return $sent; } // Figure out which field is a reminder one $reminderField = $table->getReminderFields(); if (empty($reminderField) || !is_array($reminderField)) { return $sent; } $reminderField = $reminderField[0]; if (!is_array($reminderField) || empty($reminderField['name'])) { return $sent; } $reminderField = $reminderField['name']; // Skip sending email if reminder field is empty if (empty($entity->{$reminderField})) { return $sent; } $attendeesFields = $this->_getAttendeesFields($table, ['tables' => $remindersTo]); // skip if no attendees fields found if (empty($attendeesFields)) { return $sent; } // skip if none of the required fields was modified $requiredFields = array_merge((array) $reminderField, $attendeesFields); if (!$this->_requiredFieldsModified($entity, $requiredFields)) { return $sent; } /* * Figure out the subject of the email * * This should happen AFTER the `$table->getConfig()` call, * in case the display field of the table is changed from the * configuration. * * Use singular of the table name and the value of the entity's display field. * For example: "Call: Payment remind" or "Lead: Qobo Ltd". */ $fhf = new FieldHandlerFactory(); $emailSubjectValue = $fhf->renderValue($table, $table->displayField(), $entity->{$table->displayField()}, ['renderAs' => 'plain']); $eventSubject = $emailSubjectValue ?: 'reminder'; $emailSubject = Inflector::singularize($table->alias()) . ": " . $eventSubject; $emailContent = Inflector::singularize($table->alias()) . " information was "; // If the record is being updated, prefix the above subject with "(Updated) ". if (!$entity->isNew()) { $emailSubject = '(Updated) ' . $emailSubject; $emailContent .= "updated"; } else { $emailContent .= "created"; } $emails = $this->_getAttendees($table, $entity, $attendeesFields); if (empty($emails)) { return $sent; } if (method_exists($table, 'getCurrentUser') && is_callable([$table, 'getCurrentUser'])) { $currentUser = $table->getCurrentUser(); $emailContent .= " by " . $currentUser['email']; } // append changelog if entity is not new if (!$entity->isNew()) { $emailContent .= "\n\n" . $this->_getChangelog($entity); } foreach ($emails as $email) { $vCalendar = new \Eluceo\iCal\Component\Calendar('//EN//'); $vAttendees = $this->_getEventAttendees($emails); $vEvent = $this->_getCalendarEvent($entity, ['dtz' => $dtz, 'organizer' => $email, 'subject' => $emailSubject, 'attendees' => $vAttendees, 'field' => $reminderField, 'timezone' => $timezone]); $vEvent->setAttendees($vAttendees); $vCalendar->addComponent($vEvent); $headers = "Content-Type: text/calendar; charset=utf-8"; $headers .= 'Content-Disposition: attachment; filename="event.ics"'; $emailer = new Email('default'); $emailer->to($email)->setHeaders([$headers])->subject($emailSubject)->attachments(['event.ics' => ['contentDisposition' => true, 'mimetype' => 'text/calendar', 'data' => $vCalendar->render()]]); $sent = $emailer->send($emailContent); } return $sent; }
/** * */ public function exportIcalAction() { require_once Mage::getBaseDir() . '/lib/iCal/Eluceo/iCal/Component.php'; require_once Mage::getBaseDir() . '/lib/iCal/Eluceo/iCal/PropertyBag.php'; require_once Mage::getBaseDir() . '/lib/iCal/Eluceo/iCal/Property.php'; require_once Mage::getBaseDir() . '/lib/iCal/Eluceo/iCal/Component/Calendar.php'; require_once Mage::getBaseDir() . '/lib/iCal/Eluceo/iCal/Component/Event.php'; //date_default_timezone_set('Europe/Berlin'); $vCalendar = new \Eluceo\iCal\Component\Calendar(Mage::app()->getStore()->getName()); $coll = Mage::getModel('payperrentals/reservationorders')->getCollection()->groupByOrderId(); if (urldecode($this->getRequest()->getParam('store'))) { $coll->getSelect()->joinLeft(array('so' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')), 'main_table.order_id = ' . 'so.entity_id', array('so.store_id as store_id')); $coll->getSelect()->where('so.store_id=?', $this->getRequest()->getParam('store')); } foreach ($coll as $item) { $_order = Mage::getModel('sales/order')->load($item->getOrderId()); $_address = $_order->getShippingAddress(); $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart(new \DateTime($item->getStartDate())); $vEvent->setDtEnd(new \DateTime($item->getEndDate())); $vEvent->setDescription($_order->getCustomerFirstname() . ' ' . $_order->getCustomerLastname()); $_addressString = ''; if ($_address instanceof Mage_Sales_Model_Order_Address) { $_addressString .= implode(' ', $_address->getStreet()) . ', ' . $_address->getPostcode() . ', ' . $_address->getCity(); } $vEvent->setLocation($_order->getCustomerFirstname() . ' ' . $_order->getCustomerLastname() . ($_addressString != '' ? ', ' . $_addressString : '')); //$vEvent->setNoTime(true); $vEvent->setSummary($item->getOrderId()); //$vEvent->setUseTimezone(true); $vCalendar->addEvent($vEvent); } header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="cal.ics"'); echo $vCalendar->render(); }
$courseid = required_param('id', PARAM_INT); $download = optional_param('download', '', PARAM_ALPHA); //obtain the course record $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); //require that a user is logged in an has access to this course require_login($course); //determine access levels $isteacher = has_capability('block/snap:viewstudentprogress', context_course::instance($COURSE->id)); //------------------------------------------------------------ // ICAL DOWNLOAD OPTION //------------------------------------------------------------ if ($download == 'ical' && $course->startdate && $course->enablecompletion) { //load the iCalendar class require_once __DIR__ . '/classes/iCal/autoload.php'; //create new calendar $ical = new \Eluceo\iCal\Component\Calendar('Moodle Snap - Course Schedule (' . $_SERVER['HTTP_HOST'] . ')'); $ical->setName($course->shortname); $ical->setDescription($course->fullname); //pull the information for all the modules $modinfo = get_fast_modinfo($course); foreach ($modinfo->cms as $mod) { //if completion is not enabled, then skip it if (!$mod->completion || !$mod->completionexpected) { continue; } //if hidden then skip it if (!$mod->visible) { continue; } $dt = new DateTime(); $dt->setTimestamp($mod->completionexpected);
public function calendar($user_id) { $user_id = Crypt::decrypt($user_id); $soc_ids = DB::table('subscriptions')->where('user_id', $user_id)->lists('society_id'); $events = Event::where('time', '>', date('Y-m-d H:i:s'))->whereIn('society_id', $soc_ids)->get(); $vCalendar = new \Eluceo\iCal\Component\Calendar('lowdown.netsoc.co'); foreach ($events as $event) { $vEvent = new \Eluceo\iCal\Component\Event(); $eventTime = new DateTime($event->time); $endTime = $eventTime; $endTime->add(new DateInterval('PT1H')); $eventSummary = $event->society()->first()->name . ' Society: ' . $event->title; $vEvent->setDtStart($eventTime)->setDtEnd($endTime)->setSummary($eventSummary); if ($event->location) { $vEvent->setLocation($event->location); } $vCalendar->addComponent($vEvent); } header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="cal.ics"'); echo $vCalendar->render(); }
<?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');