using utc tz in coodle completed survey ics calendar invite

This commit is contained in:
adisposkofh
2026-07-20 13:32:04 +02:00
parent 686bfe3d22
commit e7fde9bace
2 changed files with 17 additions and 24 deletions
@@ -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);
@@ -132,13 +132,7 @@ export default {
<div class="d-flex flex-column gap-3">
<div class="d-flex flex-column gap-2">
<span>
{{ "Here you can combine different external schedules to create your personal FreeBusy URL, which is used by Coodle." }}
</span>
<span>
{{ "FreeBusy supports effective scheduling by displaying your appointments (without any details such as titles or content) to avoid timing conflicts." }}
</span>
<span>
{{ "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." }}
</span>
</div>
<div class="overflow-x-auto">