API Anpassungen
* Abwesenenheiten für Kalender implementiert
This commit is contained in:
@@ -10,6 +10,7 @@ class CalendarApicontroller extends mfBaseApicontroller
|
||||
$this->addRoute("/calendar/calendarUserSubscriptions", "getcalendarUserSubscriptions", "GET");
|
||||
$this->addRoute("/calendar/calendarUserSubscriptions", "updatecalendarUserSubscriptions", "POST");
|
||||
$this->addRoute("/calendar/calendarUsers", "getcalendarUsers", "GET");
|
||||
$this->addRoute("/calendar/calendarAbsence", "getCalendarAbsence", "GET");
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +44,50 @@ class CalendarApicontroller extends mfBaseApicontroller
|
||||
die();
|
||||
}
|
||||
|
||||
protected function getCalendarAbsence()
|
||||
{ $db = FronkDB::singleton();
|
||||
$sql = "SELECT `Timerecording`.`id`, `Timerecording`.`start` start_time, `Timerecording`.`end` end_time,`Calendar`.`microsoft_id`,`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'";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
|
||||
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']),
|
||||
'microsoft_id' => array('microsoft_id' => $data['microsoft_id']),
|
||||
'description' => array('description' => "")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
$json['success'] = true;
|
||||
$json['data'] = $rows;
|
||||
$json['status'] = "success";
|
||||
$result = json_encode($json);
|
||||
echo $result;
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
protected function getcalendarUserSubscriptions()
|
||||
{
|
||||
if ($_GET['onlymsuser']) {
|
||||
|
||||
Reference in New Issue
Block a user