diff options
author | Simon Rettberg | 2022-05-13 14:44:20 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-13 14:44:20 +0200 |
commit | fe405479f16ecce774341baefe44863dc89aeb48 (patch) | |
tree | 05c5a9b762be53c8c3ef3c4affaca374b04c755c /modules-available | |
parent | [eventlog] Cast numeric values to int explicitly, in case they are '' (diff) | |
download | slx-admin-fe405479f16ecce774341baefe44863dc89aeb48.tar.gz slx-admin-fe405479f16ecce774341baefe44863dc89aeb48.tar.xz slx-admin-fe405479f16ecce774341baefe44863dc89aeb48.zip |
[locationinfo] His: Remove lecture IDs from event names
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php | 9 | ||||
-rw-r--r-- | modules-available/locationinfo/inc/icalcoursebackend.inc.php | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php index 8bd18169..cccbef91 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php @@ -43,6 +43,15 @@ class CourseBackend_HisInOne extends ICalCourseBackend return $value; } + protected function toTitle(ICalEvent $event): string + { + $title = parent::toTitle($event); + // His in one seems to prefix *some* (but *not* all) of the lectures by their ID/("Nummer") + // No clue what that format is supposed to be, this regex is some guesswork after observing this for a while + $title = preg_replace('#^[0-9][0-9A-ZÄÖÜ]{3,9}-[A-Za-z0-9/_ÄÖÜäöüß.-]{4,20}\s+#u', '', $title); + return $title; + } + public function checkConnection() { if (!$this->isOK()) diff --git a/modules-available/locationinfo/inc/icalcoursebackend.inc.php b/modules-available/locationinfo/inc/icalcoursebackend.inc.php index fba0866c..c1791919 100644 --- a/modules-available/locationinfo/inc/icalcoursebackend.inc.php +++ b/modules-available/locationinfo/inc/icalcoursebackend.inc.php @@ -43,11 +43,11 @@ abstract class ICalCourseBackend extends CourseBackend } /** - * @param int $roomId room id + * @param string $roomId room id * @param callable $errorFunc * @return ICalEvent[]|null all events for this room in the range -7 days to +7 days, or NULL on error */ - protected function downloadIcal($roomId) + protected function downloadIcal(string $roomId) { if (!$this->isOK()) return null; @@ -118,9 +118,10 @@ abstract class ICalCourseBackend extends CourseBackend /** * Get a usable title from either SUMMARY or DESCRIPTION + * * @param ICalEvent $event */ - private function toTitle($event): string + protected function toTitle(ICalEvent $event): string { $title = $event->summary; if (empty($title)) { |