Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ protected function createRecurrences(ilCalendarEntry $app): ilICalWriter
$str_writer = new ilICalWriter();
foreach (ilCalendarRecurrences::_getRecurrences($app->getEntryId()) as $rec) {
foreach (ilCalendarRecurrenceExclusions::getExclusionDates($app->getEntryId()) as $excl) {
$str_writer->addLine($excl->toICal());
$str_writer->addLine($excl->toICal($this->il_user->getTimeZone()));
}
$recurrence_ical = $rec->toICal($this->il_user->getId());
if (strlen($recurrence_ical)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ public function toICal(int $a_user_id): string
if ($entry->isFullday()) {
$ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd'));
} else {
$his = $entry->getStart()->get(IL_CAL_FKT_DATE, 'His');
$ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd') . 'T' . $his);
$user = new ilObjUser($a_user_id);
$tz = $user->getTimeZone();
$local_time = $entry->getStart()->get(IL_CAL_FKT_DATE, 'H:i:s', $tz);
$until_date = $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Y-m-d');
$until_dt = new ilDateTime($until_date . ' ' . $local_time, IL_CAL_DATETIME, $tz);
$ical .= ';UNTIL=' . $until_dt->get(IL_CAL_FKT_DATE, 'Ymd', ilTimeZone::UTC) .
'T' . $until_dt->get(IL_CAL_FKT_DATE, 'His', ilTimeZone::UTC) . 'Z';
}
}
if ($this->getBYMONTH()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,21 @@ public function setDate(?ilDate $dt = null): void
$this->exclusion = $dt;
}

public function toICal(): string
public function toICal(string $a_tz = ''): string
{
$entry = new ilCalendarEntry($this->getEntryId());
$start = $entry->getStart();

if ($entry->isFullday()) {
return 'EXDATE;VALUE=DATE:' . $this->getDate()->get(IL_CAL_FKT_DATE, 'Ymd');
} else {
$tz = $a_tz ?: ilTimeZone::UTC;
$local_time = $start->get(IL_CAL_FKT_DATE, 'H:i:s', $tz);
$excl_date = $this->getDate()->get(IL_CAL_FKT_DATE, 'Y-m-d');
$excl_dt = new ilDateTime($excl_date . ' ' . $local_time, IL_CAL_DATETIME, $tz);
return 'EXDATE:' .
$this->getDate()->get(IL_CAL_FKT_DATE, 'Ymd', ilTimeZone::UTC) .
'T' . $start->get(IL_CAL_FKT_DATE, 'His', ilTimeZone::UTC) . 'Z';
$excl_dt->get(IL_CAL_FKT_DATE, 'Ymd', ilTimeZone::UTC) .
'T' . $excl_dt->get(IL_CAL_FKT_DATE, 'His', ilTimeZone::UTC) . 'Z';
}
}

Expand Down