Update:
* Serientermine werden nun angezeigt
* Serientermine können nun angenommen/abgelehnt bzw. geändert werden.
* Serientermin Serienzeiten ändern ist noch offen
* Alle Js nun local im Calendar Ordner
This commit is contained in:
Daniel Spitzer
2024-11-18 13:08:20 +01:00
parent 413b730397
commit 962a5db94f
10 changed files with 3615 additions and 30 deletions
@@ -177,6 +177,8 @@ class CalendarApicontroller extends mfBaseApicontroller
$message[0]['attachments'] = $Calendarevent['data'][0]['attachments']['attachments'];
$message[0]['calendar_name'] = $Calendarevent['data'][0]['calendar_name']['calendar_name'];
$message[0]['isorganizer'] = $Calendarevent['data'][0]['isorganizer']['isorganizer'];
$message[0]['rrule'] = $Calendarevent['data'][0]['rrule']['rrule'];
$message[0]['duration'] = $Calendarevent['data'][0]['duration']['duration'];
$message[0]['mtime'] = $Calendarevent['data'][0]['mtime']['mtime'];
$message[0]['mname'] = $Calendarevent['data'][0]['mname']['mname'];
$message[0]['ctime'] = $Calendarevent['data'][0]['ctime']['ctime'];
+43 -4
View File
@@ -118,6 +118,7 @@ class CalendarModel
public static function getCalendarEvents($me, $id = 0, $r = 0)
{
$rrulefreq = array('daily' => 'DAILY', 'weekly' => 'WEEKLY', 'relativeMonthly' => 'MONTHLY', 'yearly' => 'YEARLY');
$calendar = self::search(array("user_id" => $me));
$standardCalendarColors = CalendarModel::$standardCalendarColors;
$calendarColors = json_decode($calendar[0]->colors, true);
@@ -155,12 +156,14 @@ class CalendarModel
if ($visibleCalendars) {
$where .= " AND calendar_id IN (" . implode(",", $visibleCalendars) . ")";
}
$sql = "SELECT `cal_events`.id, uuid, calendar_id, `cal_events`.user_id, start_time, end_time, timezone, all_day_event, `cal_events`.name,`cal_calendars`.name calendar_name, description, location, repeat_end_time, reminder, ctime,cname, mtime,mname, muser_id, busy, status, resource_event_id, private, rrule, `cal_events`.background, `cal_events`.files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,busy FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
$sql = "SELECT `cal_events`.id, uuid, calendar_id, `cal_events`.user_id, start_time, end_time, timezone, all_day_event, `cal_events`.name,`cal_calendars`.name calendar_name, description, location, repeat_end_time, reminder, ctime,cname, mtime,mname, muser_id, busy, status, resource_event_id, private, rrule, `cal_events`.background, `cal_events`.files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,busy,recurrence FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
$res = $dbcal->query($sql);
if ($dbcal->num_rows($res)) {
while ($data = $dbcal->fetch_array($res)) {
unset($byweekday);
$rrule = false;
if ($attachments[$data['uuid']]) {
$attachment = 1;
$attachmentLinks = json_encode($attachments[$data['uuid']]['attachments']);
@@ -184,6 +187,40 @@ class CalendarModel
$name = $data['name'];
}
if ($data['recurrence']) {
$recurrence = json_decode($data['recurrence'], true);
if ($rrulefreq[$recurrence['pattern']['type']]) {
unset ($byweekday);
$freq = $rrulefreq[$recurrence['pattern']['type']];
foreach ($recurrence['pattern']['daysOfWeek'] as $value) {
$byweekday[] = strtolower(substr($value, 0, 2));
}
$duration = ($data['end_time'] - $data['start_time']) * 1000;
$until = $recurrence['range']['endDate'];
if ($until == "0001-01-01") {
$until = strtotime("+3 year", $data['start_time']);
$until = date("Y-m-d", $until);
} else {
$until = date("Y-m-d", strtotime($recurrence['range']['endDate']) + 86400);
}
$rrule = [
'freq' => $freq,
'interval' => $recurrence['pattern']['interval'],
'byweekday' => $byweekday,
'dtstart' => date("Y-m-d\TH:i", $data['start_time']),
'until' => $until
];
if ($freq == "MONTHLY") {
$bystpos = array("first" => 1, "second" => 2, "third" => 3, "fourth" => 4, "last" => -1);
$rrule['bysetpos'] = $bystpos[$recurrence['pattern']['index']];
}
}
} else {
$rrule = false;
}
if ($calendarColors[$data['calendar_id']]['bgcolor']) {
$bgcolor = $calendarColors[$data['calendar_id']]['bgcolor'];
$txtcolor = $calendarColors[$data['calendar_id']]['txtcolor'];
@@ -207,6 +244,8 @@ class CalendarModel
'rights' => array('rights' => $rights, 'order' => $rights),
'location' => array('location' => $data['location']),
'busy' => array('busy' => $data['busy']),
'rrule' => array('rrule' => $rrule),
'duration' => array('duration' => $duration),
'event_type' => array('event_type' => $data['event_type']),
'description' => array('description' => ($data['description'])),
'attachment' => array('attachment' => $attachment),
@@ -347,8 +386,8 @@ class CalendarModel
}
}
if (!$data['accepted'] && $data['busy'] == 1) {
$data['accepted']['ok']=1;
$data['accepted']=json_encode($data['accepted']);
$data['accepted']['ok'] = 1;
$data['accepted'] = json_encode($data['accepted']);
}
$rows = array(
@@ -718,7 +757,7 @@ class CalendarModel
$data['create_timestamp'] = time();
$data['edit_timestamp'] = time();
$db->insert("tmp_cal_events_attachments", $data);
echo "insert_id: " . $db->insert_id;
// echo "insert_id: " . $db->insert_id;
return $db->insert_id;
}