Merge branch 'spidev' into 'master'

Kalender

See merge request fronk/thetool!752
This commit is contained in:
Daniel Spitzer
2024-11-19 14:31:33 +00:00
5 changed files with 238 additions and 138 deletions
@@ -212,6 +212,8 @@ class CalendarController extends mfBaseController
$timerecordingemployees = TimerecordingEmployeeModel::getAll();
$standardCalendarColors = CalendarModel::$standardCalendarColors;
$specialCalendarColors = CalendarModel::$specialCalendarColors;
$this->layout()->set("timerecordingemployees", $timerecordingemployees);
$this->layout()->set("standardCalendarColors", $standardCalendarColors);
$this->layout()->set("specialCalendarColors", $specialCalendarColors);
+52 -1
View File
@@ -155,6 +155,7 @@ class CalendarModel
$visibleCalendars = $r->visibleCalendars;
if ($visibleCalendars) {
$where .= " AND calendar_id IN (" . implode(",", $visibleCalendars) . ")";
$whereTimeRecording = " AND `Calendar`.`go_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,recurrence FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
@@ -231,7 +232,7 @@ class CalendarModel
}
if ($calenderRights[$data['calendar_id']]) {
$rights = $calenderRights[$data['calendar_id']];
$CalendarUsers[$data['calendar_id']] = $data['calendar_name'];
$rows[] = array(
'id' => array('id' => $data['id']),
'cstart' => array('cstart' => $starttime),
@@ -257,9 +258,59 @@ class CalendarModel
'mname' => array('mname' => $data['mname']),
'isorganizer' => array('isorganizer' => $data['is_organizer']),
'busy' => array('busy' => $data['busy']),
'timerecording' => array('timerecording' => 0),
);
}
}
$db = FronkDB::singleton();
$sql = "SELECT `Timerecording`.`id`, `Timerecording`.`start` start_time, `Timerecording`.`end` end_time,`Calendar`.`go_calendar_id` calendar_id,`TimerecordingCategory`.`name`,`TimerecordingCategory`.`id` CategoryId,`Timerecording`.`create` ctime,`Timerecording`.`edit` mtime FROM `Timerecording`
INNER JOIN `TimerecordingCategory` ON `TimerecordingCategory`.`id`=`Timerecording`.`timerecordingCategory_id`
INNER JOIN `Calendar` ON `Calendar`.`user_id`=`Timerecording`.`user_id`
WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourday`!='7' AND `TimerecordingCategory`.`hourday`!='5' $whereTimeRecording";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_array($res)) {
if ($calendarColors[$data['calendar_id']]['bgcolor']) {
$bgcolor = $calendarColors[$data['calendar_id']]['bgcolor'];
$txtcolor = $calendarColors[$data['calendar_id']]['txtcolor'];
} else {
$bgcolor = $standardCalendarColors[$colorCounter];
$txtcolor = "#000";
$colorCounter++;
}
if ($data['CategoryId'] != 11) {
$starttime = date("Y-m-d", $data['start_time']);
$endtime = date("Y-m-d", $data['end_time']);
if ($starttime != $endtime) {
$endtime = $data['end_time'] + 86400;
$endtime = date("Y-m-d", $endtime);
}
} else {
$starttime = date("Y-m-d H:i", $data['start_time']);
$endtime = date("Y-m-d H:i", $data['end_time']);
}
$rows[] = array(
'id' => array('id' => "9999" . $data['id']),
'category' => array('category' => $data['name']),
'ccategory' => array('ccategory' => $data['name']),
'cstart' => array('cstart' => $starttime),
'cend' => array('cend' => $endtime),
'calendar_id' => array('calendar_id' => $data['calendar_id']),
'ctime' => array('ctime' => date("d.m.Y H:i", $data['ctime'])),
'cname' => array('cname' => $CalendarUsers[$data['calendar_id']]),
'mtime' => array('mtime' => date("d.m.Y H:i", $data['mtime'])),
'mname' => array('mname' => $CalendarUsers[$data['calendar_id']]),
'description' => array('description' => ""),
'bgColor' => array('bgColor' => $bgcolor),
'txtColor' => array('txtColor' => $txtcolor),
'timerecording' => array('timerecording' => 1),
'calendar_name' => array('calendar_name' => $CalendarUsers[$data['calendar_id']]),
);
}
}
$json['success'] = true;
$json['data'] = $rows;
} else {