Kalender Update

* Update Tagestermin sollten nun sauber funktionieren und vorgerendert werden
This commit is contained in:
Daniel Spitzer
2025-08-28 10:30:18 +02:00
parent 75e9ac6dbb
commit 8cd33dc97c
2 changed files with 105 additions and 51 deletions

View File

@@ -246,7 +246,8 @@ class CalendarModel
$attachment = 0;
$attachmentLinks = "";
}
if (in_array("Abwesenheit", $categories)) {
if (!empty($categories) && in_array("Abwesenheit", $categories)) {
continue;
}
if ($data['all_day_event'] == 1) {
@@ -275,8 +276,10 @@ class CalendarModel
if ($rrulefreq[$recurrence['pattern']['type']]) {
unset ($byweekday);
$freq = $rrulefreq[$recurrence['pattern']['type']];
foreach ($recurrence['pattern']['daysOfWeek'] as $value) {
$byweekday[] = strtolower(substr($value, 0, 2));
if (isset($recurrence['pattern']['daysOfWeek'])) {
foreach ($recurrence['pattern']['daysOfWeek'] as $value) {
$byweekday[] = strtolower(substr($value, 0, 2));
}
}
$duration = ($data['end_time'] - $data['start_time']) * 1000;
$until = $recurrence['range']['endDate'];
@@ -541,24 +544,26 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
}
$attendees = json_decode($data['attendees'], true);
$organizer = json_decode($data['organizer'], true);
foreach ($attendees as $key => $value) {
if ($key == "required" || $key == "optional") {
foreach ($value as $attendeekey => $attendee) {
$attendee['name'] = self::replace_unicode_sequences($attendee['name']);
if ($attendee['email'] == $organizer['email']) {
if ($attendees) {
foreach ($attendees as $key => $value) {
if ($key == "required" || $key == "optional") {
} elseif ($Allcalendar[$attendee['name']] && $Allcalendar[$attendee['name']] == $data['calendar_id']) {
foreach ($value as $attendeekey => $attendee) {
$attendee['name'] = self::replace_unicode_sequences($attendee['name']);
if ($attendee['email'] == $organizer['email']) {
} else if ($Allcalendar[$attendee['name']]) {
$AttendeeArray[] = $Allcalendar[$attendee['name']];
} else {
$AttendeeArray[] = $attendee['email'];
} elseif ($Allcalendar[$attendee['name']] && $Allcalendar[$attendee['name']] == $data['calendar_id']) {
} else if ($Allcalendar[$attendee['name']]) {
$AttendeeArray[] = $Allcalendar[$attendee['name']];
} else {
$AttendeeArray[] = $attendee['email'];
}
}
}
}
}
if (!$data['accepted'] && $data['busy'] == 1) {
$data['accepted']['ok'] = 1;
$data['accepted'] = json_encode($data['accepted']);
@@ -644,11 +649,19 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$title = ($r->title);
$start = ((($r->start - 7200000) / 1000));
$end = ((($r->end - 7200000) / 1000));
$originalend = $end;
if ($title) {
$start = strtotime($r->start);
$end = strtotime($r->end);
}
$allday = ($r->allday);
if ($allday) {
$start = $start + 7200;
$originalend = $end + 7200;
$end = $end + 7200 + 86400;
}
$reminder = ($r->reminder);
$newkey = ($r->newkey);
$id = ($r->id);
@@ -706,7 +719,11 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$updateArray['event_type'] = $type;
$calEventCategories = self::$eventCategories;
foreach ($calEventCategories as $key => $value) {
$arraykey = array_search($value, $categories);
if ($categories) {
$arraykey = array_search($value, $categories);
} else {
$arraykey = false;
}
if (!empty($arraykey || $arraykey === 0)) {
unset($categories[$arraykey]);
}
@@ -766,8 +783,10 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$toolattachments[$dataAttachment['id']] = 1;
}
}
foreach ($attachments as $key => $value) {
unset($toolattachments[$value]);
if ($attachments) {
foreach ($attachments as $key => $value) {
unset($toolattachments[$value]);
}
}
if (!empty($toolattachments)) {
foreach ($toolattachments as $key => $value) {
@@ -788,6 +807,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$updateArray['attachments'] = $attachments;
$updateArray['end_time'] = $originalend;
}
if ($attendees)
$updateArray['attendees'] = $attendees;
@@ -866,6 +886,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$title = ($r->title);
$start = strtotime($r->start);
$end = strtotime($r->end);
$originalend = $end;
$allday = ($r->allday);
$reminder = ($r->reminder);
$newkey = ($r->newkey);
@@ -890,6 +911,10 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
}
if (!$allday) {
$allday = 0;
} else {
$start = $start + 7200;
$originalend= $end + 7200;
$end = $end + 7200 + 86400;
}
if ($reminder == 'NULL') {
$reminder = NULL;
@@ -947,6 +972,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
if ($rrules) {
$dataarray['rrule'] = $rrules;
}
$dataarray['end_time'] = $originalend;
$json_data = json_encode($dataarray);
$data = [];