From e7fde9bace59bbee86f2dd487d3658c2fe6e8e26 Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Mon, 20 Jul 2026 13:32:04 +0200 Subject: [PATCH] using utc tz in coodle completed survey ics calendar invite --- .../api/frontend/v1/coodle/CoodleSurvey.php | 33 +++++++++---------- .../Cis/Coodle/Components/CoodleFreeBusy.js | 8 +---- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/application/controllers/api/frontend/v1/coodle/CoodleSurvey.php b/application/controllers/api/frontend/v1/coodle/CoodleSurvey.php index 4be99d0ab..b01ed079d 100644 --- a/application/controllers/api/frontend/v1/coodle/CoodleSurvey.php +++ b/application/controllers/api/frontend/v1/coodle/CoodleSurvey.php @@ -435,13 +435,11 @@ class CoodleSurvey extends FHCAPI_Controller if ($selectedTimeslot && $selectedRoomId) { $this->load->library('StundenplanLib'); - $tz = new DateTimeZone('Europe/Berlin'); - $reservationStart = DateTimeImmutable::createFromFormat( - 'Y-m-d H:i:s', - $selectedTimeslot->starts_at, - $tz - ); - $reservationEnd = $reservationStart->modify("+$survey->timeslot_duration minutes"); + + $localTimezone = new DateTimeZone('Europe/Vienna'); + $reservationStart = new DateTime($selectedTimeslot->starts_at, $localTimezone); + $reservationEnd = new DateTime($selectedTimeslot->starts_at, $localTimezone); + $reservationEnd = $reservationEnd->modify("+$survey->timeslot_duration minutes"); $this->stundenplanlib->addReservation( $reservationStart->format("c"), $reservationEnd->format("c"), @@ -459,15 +457,16 @@ class CoodleSurvey extends FHCAPI_Controller $authUserFullName = getData($this->PersonModel->getFullName(getAuthUID())); if ($selectedTimeslot) { - $tz = new DateTimeZone('Europe/Berlin'); - $timeslotStart = DateTimeImmutable::createFromFormat( - 'Y-m-d H:i:s', - $selectedTimeslot->starts_at, - $tz - ); - $timeslotEnd = $timeslotStart->modify("+$survey->timeslot_duration minutes"); + $localTimezone = new DateTimeZone('Europe/Vienna'); + $timeslotStart = new DateTime($selectedTimeslot->starts_at, $localTimezone); + $timeslotEnd = new DateTime($selectedTimeslot->starts_at, $localTimezone); + $timeslotEnd = $timeslotEnd->modify("+$survey->timeslot_duration minutes"); $formattedTimeslot = $timeslotStart->format("d.m.Y H:i") . "-" . $timeslotEnd->format("H:i"); + $utcTimezone = new DateTimeZone("UTC"); + $timeslotStart->setTimezone($utcTimezone); + $timeslotEnd->setTimezone($utcTimezone); + $calendarFilePath = tempnam(sys_get_temp_dir(), "coodle_"); $this->writeToIcsFile( $calendarFilePath, @@ -684,7 +683,7 @@ class CoodleSurvey extends FHCAPI_Controller return $groups; } - private function writeToIcsFile($calendarFilePath, $title, $start, $end, $location) + private function writeToIcsFile($calendarFilePath, $title, $startUTC, $endUTC, $location) { $calendarFile = fopen($calendarFilePath, "w"); fwrite($calendarFile, "BEGIN:VCALENDAR" . PHP_EOL); @@ -693,8 +692,8 @@ class CoodleSurvey extends FHCAPI_Controller fwrite($calendarFile, "PRDODID:" . CAMPUS_NAME . PHP_EOL); fwrite($calendarFile, "X-WR-TIMEZONE:Europe/Vienna" . PHP_EOL); fwrite($calendarFile, "BEGIN:VEVENT" . PHP_EOL); - fwrite($calendarFile, "DTSTART:" . $start->format("Ymd") . "T" . $start->format("His") . PHP_EOL); - fwrite($calendarFile, "DTEND:" . $end->format("Ymd") . "T" . $end->format("His") . PHP_EOL); + fwrite($calendarFile, "DTSTART:" . $startUTC->format("Ymd\THis\Z") . PHP_EOL); + fwrite($calendarFile, "DTEND:" . $endUTC->format("Ymd\THis\Z") . PHP_EOL); fwrite($calendarFile, "SUMMARY:" . $title . PHP_EOL); if ($location) { fwrite($calendarFile, "LOCATION:" . $location . PHP_EOL); diff --git a/public/js/components/Cis/Coodle/Components/CoodleFreeBusy.js b/public/js/components/Cis/Coodle/Components/CoodleFreeBusy.js index 3f2cff16e..e941dd629 100644 --- a/public/js/components/Cis/Coodle/Components/CoodleFreeBusy.js +++ b/public/js/components/Cis/Coodle/Components/CoodleFreeBusy.js @@ -132,13 +132,7 @@ export default {
- {{ "Here you can combine different external schedules to create your personal FreeBusy URL, which is used by Coodle." }} - - - {{ "FreeBusy supports effective scheduling by displaying your appointments (without any details such as titles or content) to avoid timing conflicts." }} - - - {{ "To effectively use FreeBusy, you must carefully enter and update your calendar data. Your base schedule and planned absences will be displayed by default, but you can add additional schedules (Google, SOGo, etc). To do so, you must locate and copy a sharing url from your calendar application marked as either 'ICS' or 'iCal', and ending with the suffix '.ics'. The calendar being shared must also be set to public." }} + {{ "FreeBusy supports effective scheduling by combining internal and external calendars, and displaying events (without identifying details such as title, description, or location) in Coodle to avoid timing conflicts. Your base timetable and planned absences will be displayed by default, but you can add additional schedules (e.g. Google Calendar). To do so, you must locate and copy a sharing url from your calendar application marked as either 'ICS' or 'iCal', usually ending with the suffix '.ics'. The calendar being shared must also be set to public. However, schedules of type 'SoGo' and 'Coodle' will autofill with default urls which will be processed internally." }}