From 04d90f53d383083a0b6583251659ce57c1dd6241 Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Mon, 20 Jul 2026 16:40:57 +0200 Subject: [PATCH] adapt stundeplanlib expandObjectInformation when called by getEventsEmployee with an event called extendStundenplanData, which allows extensions like digi anw to plant their own data object inside the stundenplan events in order to conditionally render something like currently in the lehreinheiten calendarEvent.js renderer -> parameterized link to anw extension in order to avoid duplicating functionality across widgets when there is already one doing it very well; --- application/libraries/StundenplanLib.php | 19 +++++++++-- .../Cis/Renderer/Lehreinheit/calendarEvent.js | 33 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/application/libraries/StundenplanLib.php b/application/libraries/StundenplanLib.php index a7bec61ec..2c21ac72b 100644 --- a/application/libraries/StundenplanLib.php +++ b/application/libraries/StundenplanLib.php @@ -7,6 +7,7 @@ use \DateTime as DateTime; use \DateTimeZone as DateTimeZone; use \DateInterval as DateInterval; use \DatePeriod as DatePeriod; +use CI3_Events as Events; class StundenplanLib { @@ -141,7 +142,7 @@ class StundenplanLib return $stundenplan_data; $stundenplan_data = getData($stundenplan_data) ?? []; - $function_error = $this->expandObjectInformation($stundenplan_data); + $function_error = $this->expandObjectInformation($stundenplan_data, true); if ($function_error) return $function_error; @@ -286,7 +287,7 @@ class StundenplanLib return success($lektoren); } - public function expandObjectInformation($data) + public function expandObjectInformation($data, $callExtensionsEvent = false) { $this->_ci =& get_instance(); @@ -375,6 +376,20 @@ class StundenplanLib $item->lektor = $lektor_obj_array; } + + // info retrieved from extensions might not be necessary for some stundenplan use cases so the event + // will be gated behind this flag + + if($callExtensionsEvent) { + Events::trigger( + 'extendStundenplanData', + function & () use (&$data) + { + return $data; + } + ); + } + } public function fetchFerienTageEvents($start_date, $end_date, $studiengang_kz) diff --git a/public/js/components/Cis/Renderer/Lehreinheit/calendarEvent.js b/public/js/components/Cis/Renderer/Lehreinheit/calendarEvent.js index 652b29645..8bbaa5d0f 100644 --- a/public/js/components/Cis/Renderer/Lehreinheit/calendarEvent.js +++ b/public/js/components/Cis/Renderer/Lehreinheit/calendarEvent.js @@ -66,6 +66,24 @@ export default { return "d-none d-xl-grid"; } }, + // link into the FHC-Core-Anwesenheiten tool + // digi_anw_data is attached per event by the extension's `extendStundenplanData` listener + anwLink() { + const d = this.event && this.event.digi_anw_data; + if (!d || !d.stg_kz || !d.lv_id || !d.sem_kurzbz) + return null; + const base = FHC_JS_DATA_STORAGE_OBJECT.app_root + + FHC_JS_DATA_STORAGE_OBJECT.ci_router + + '/extensions/FHC-Core-Anwesenheiten/'; + return base + + `?stg_kz=${encodeURIComponent(d.stg_kz)}` + + `&sem=${encodeURIComponent(d.sem ?? '')}` + + `&lvid=${encodeURIComponent(d.lv_id)}` + + `&sem_kurzbz=${encodeURIComponent(d.sem_kurzbz)}`; + }, + anwLinkTitle() { + return this.$p.t('global/digitalesAnwManagement'); + }, }, template: /*html*/`
+ + + `, }