mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
add clearing of unused classes in lvplan caldav export lib
This commit is contained in:
@@ -46,6 +46,8 @@ class KalenderLib
|
||||
tbl_kalender.von,
|
||||
tbl_kalender.bis,
|
||||
tbl_kalender_ort.ort_kurzbz,
|
||||
tbl_kalender_ort.ort_kurzbz as ko_ort_kurzbz,
|
||||
tbl_kalender_ort.location as ko_location,
|
||||
tbl_lehreinheit.lehreinheit_id,
|
||||
tbl_lehreinheit.lehrveranstaltung_id,
|
||||
tbl_lehreinheit.lehrfach_id,
|
||||
@@ -173,6 +175,8 @@ class KalenderLib
|
||||
'tooltip' => 'tip',
|
||||
'status_kurzbz' => $row->status_kurzbz,
|
||||
'ort_kurzbz' => isset($row->ort_kurzbz) ? $row->ort_kurzbz : '',
|
||||
'ko_ort_kurzbz' => isset($row->ko_ort_kurzbz) ? $row->ko_ort_kurzbz : '',
|
||||
'ko_location' => isset($row->ko_location) ? $row->ko_location : '',
|
||||
'lehrform' => isset($row->lehrform_kurzbz) ? $row->lehrform_kurzbz : '',
|
||||
'lehrfach' => isset($row->lehrfach_kurzbz) ? $row->lehrfach_kurzbz : '',
|
||||
'lehrfach_bez' => isset($row->lehrfach_bezeichnung) ? $row->lehrfach_bezeichnung : '',
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
require_once __DIR__.'/caldav/SabreDAVACLPrincipalBackend.php';
|
||||
require_once __DIR__.'/caldav/SabreDAVCalDAVBackend.php';
|
||||
require_once __DIR__.'/caldav/SabreDAVReadOnlyACL.php';
|
||||
require_once __DIR__.'/caldav/SabreDAVReadOnlyCalendarRoot.php';
|
||||
require_once __DIR__.'/caldav/SabreDAVReadOnlyCalendarHome.php';
|
||||
require_once __DIR__.'/caldav/SabreDAVReadOnlyCalendar.php';
|
||||
require_once __DIR__.'/caldav/SabreDAVReadOnlyCalendarObject.php';
|
||||
|
||||
/**
|
||||
* Loads the SabreDAV CalDAV classes for the LVPlan calendar endpoint.
|
||||
|
||||
@@ -9,6 +9,10 @@ class SabreDAVCalDAVBackend extends \Sabre\CalDAV\Backend\AbstractBackend
|
||||
|
||||
protected $CI;
|
||||
|
||||
CONST CALENDAR_NAME = 'LVPlan';
|
||||
CONST CAL_CATEGORY_STUNDENPLAN = 'Stundenplan';
|
||||
CONST CAL_CATEGORY_STUNDENPLAN_EXAM = 'StundenplanExam';
|
||||
CONST CAL_CATEGORY_STUNDENPLAN_ONLINE = 'StundenplanOnline';
|
||||
/**
|
||||
* Creates the backend
|
||||
*
|
||||
@@ -52,11 +56,11 @@ class SabreDAVCalDAVBackend extends \Sabre\CalDAV\Backend\AbstractBackend
|
||||
$calendars = array();
|
||||
$calendar = array(
|
||||
'id' => $user,
|
||||
'uri' => 'LVPlan-'.$user,
|
||||
'uri' => self::CALENDAR_NAME.'-'.$user,
|
||||
'principaluri' => 'principals/'.$user,
|
||||
'{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $this->buildCalendarCtag($user),
|
||||
'{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet(array('VEVENT')),
|
||||
'{DAV:}displayname' => 'LVPlan',
|
||||
'{DAV:}displayname' => self::CALENDAR_NAME,
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description comes here',
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'Europe/Vienna',
|
||||
'{http://apple.com/ns/ical/}calendar-order' => '1',
|
||||
@@ -226,10 +230,23 @@ class SabreDAVCalDAVBackend extends \Sabre\CalDAV\Backend\AbstractBackend
|
||||
$description = $item->lehrfach_bez . "\r\n";
|
||||
|
||||
if (isset($item->lektor) && is_array($item->lektor) && count($item->lektor) > 0) {
|
||||
$description .= "Lehrer: " . join(", ", array_map(function($teacher) { return $teacher["kurzbz"]; }, $item->lektor)) . "\r\n";
|
||||
$description .= "Lektor*in: " . join(", ", array_map(function($teacher) { return $teacher["kurzbz"]; }, $item->lektor)) . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$category = self::CAL_CATEGORY_STUNDENPLAN;
|
||||
if ($item->type === 'lehreinheit') {
|
||||
if ($item->lehrform === 'EXAM') {
|
||||
$category = self::CAL_CATEGORY_STUNDENPLAN_EXAM;
|
||||
} else if (!isset($item->ko_ort_kurzbz) || $item->ko_ort_kurzbz === '') {
|
||||
$category = self::CAL_CATEGORY_STUNDENPLAN_ONLINE;
|
||||
}
|
||||
} else if ($item->type === 'reservierung' && (!isset($item->ko_ort_kurzbz) || $item->ko_ort_kurzbz === '')) {
|
||||
$category = self::CAL_CATEGORY_STUNDENPLAN_ONLINE;
|
||||
}
|
||||
|
||||
|
||||
$parsedStartDate = $this->formatICalLocalDateTime($item->isostart);
|
||||
$parsedEndDate = $this->formatICalLocalDateTime($item->isoend);
|
||||
$lastModified = $this->formatICalUtcDateTime(isset($item->updateamum) ? $item->updateamum : null);
|
||||
@@ -244,7 +261,7 @@ class SabreDAVCalDAVBackend extends \Sabre\CalDAV\Backend\AbstractBackend
|
||||
.$this->buildICalTextLine('SUMMARY', $summary)
|
||||
.$this->buildICalTextLine('DESCRIPTION', $description)
|
||||
.$this->buildICalTextLine('LOCATION', isset($item->ort_kurzbz) ? $item->ort_kurzbz : '')
|
||||
.$this->buildICalTextLine('CATEGORIES', 'Stundenplans')
|
||||
.$this->buildICalTextLine('CATEGORIES', $category)
|
||||
.$this->buildICalLine('DTSTART', $parsedStartDate, array('TZID' => 'Europe/Vienna'))
|
||||
.$this->buildICalLine('DTEND', $parsedEndDate, array('TZID' => 'Europe/Vienna'));
|
||||
|
||||
@@ -271,7 +288,7 @@ class SabreDAVCalDAVBackend extends \Sabre\CalDAV\Backend\AbstractBackend
|
||||
}
|
||||
|
||||
sort($fragments, SORT_STRING);
|
||||
return 'LVPlan-'.$userUID.'-'.md5(implode('|', $fragments));
|
||||
return self::CALENDAR_NAME.'-'.$userUID.'-'.md5(implode('|', $fragments));
|
||||
}
|
||||
|
||||
protected function buildICalTextLine($name, $value, array $parameters = array())
|
||||
|
||||
Reference in New Issue
Block a user