From c19f0a7b00b0270610033ffbd5a23d966df3b598 Mon Sep 17 00:00:00 2001 From: Ivymaster Date: Tue, 4 Aug 2026 11:23:48 +0200 Subject: [PATCH] Add note tag title from old tempus, in new html previes --- application/libraries/KalenderLib.php | 8 ++-- application/libraries/LvPlanHTMLDetailLib.php | 20 ++++++---- application/libraries/LvPlanHTMLLib.php | 40 ++++++++++++++++++- 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/application/libraries/KalenderLib.php b/application/libraries/KalenderLib.php index a435911da..ff013e0ff 100644 --- a/application/libraries/KalenderLib.php +++ b/application/libraries/KalenderLib.php @@ -110,7 +110,8 @@ class KalenderLib tbl_lehreinheitgruppe.verband as le_verband, tbl_lehreinheitgruppe.gruppe as le_gruppe, le_gruppe.direktinskription as le_direktinskription, - + tag_data_agg.tags as tags, + resource_data_agg.resources as resources '); @@ -195,7 +196,8 @@ class KalenderLib nt.style, n.erledigt AS done, nt.prioritaet AS prioritaet, - nz.eindeutige_kalender_gruppen_id + nz.eindeutige_kalender_gruppen_id, + n.insertvon AS insertvon FROM public.tbl_notizzuordnung AS nz JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz " . $whereTags . " @@ -298,8 +300,8 @@ class KalenderLib 'beschreibung' => isset($row->beschreibung) ? $row->beschreibung : '', 'topic' => [], 'collisions' => false, - 'has_assigned_resources' => isset($row->has_assigned_resources) ? $row->has_assigned_resources : false, 'updateamum' => isset($row->updateamum) ? $row->updateamum : null, + 'has_assigned_resources' => !empty($parsedResources), 'resources' => is_array($parsedResources) ? $parsedResources : [], 'tags' => isset($row->tags) ? $row->tags : [], ]; diff --git a/application/libraries/LvPlanHTMLDetailLib.php b/application/libraries/LvPlanHTMLDetailLib.php index 2b7ff4be3..b67e80d12 100644 --- a/application/libraries/LvPlanHTMLDetailLib.php +++ b/application/libraries/LvPlanHTMLDetailLib.php @@ -308,7 +308,7 @@ class LvPlanHTMLDetailLib $html .= $this->cell($this->renderSubjectValues($event, 'bezeichnung')); $html .= $this->cell($this->renderTeachingGroups($event, false)); $html .= $this->cell($this->renderTeachingGroups($event, true)); - $html .= $this->cell($this->renderDescription($event)); + $html .= $this->cell($this->renderOldTempusNoticeTagNote($event)); $html .= ''; } @@ -627,17 +627,21 @@ class LvPlanHTMLDetailLib return $result; } - private function renderDescription($event) + private function renderOldTempusNoticeTagNote($event) { - $values = array(); - foreach (array('titel', 'beschreibung') as $property) + if (empty($event->tags)) return null; + + $parsedTags = $event->tags; + if (!is_array($event->tags)) + $parsedTags = json_decode($event->tags, true); + + foreach ($parsedTags as $tag) { - $value = trim($this->getScalar($event, $property)); - if ($value !== '') - $values[] = $this->renderText($value); + if (isset($tag['typ_kurzbz']) && $tag['typ_kurzbz'] === 'hinweis' && isset($tag['insertvon']) && $tag['insertvon'] === 'oldToNewTempusMigration') + return $tag['notiz'] ?? null; } - return implode('
', array_unique($values)); + return null; } private function renderText($value) diff --git a/application/libraries/LvPlanHTMLLib.php b/application/libraries/LvPlanHTMLLib.php index 058bffbb9..7ab28edd5 100644 --- a/application/libraries/LvPlanHTMLLib.php +++ b/application/libraries/LvPlanHTMLLib.php @@ -9,6 +9,8 @@ class LvPlanHTMLLib const DETAIL_WINDOW_NAME = 'Details'; const DETAIL_WINDOW_OPTIONS = 'height=320,width=550,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes'; + CONST NOTICE_TAG_ICON = '📝'; + private $ci; public function __construct() @@ -191,6 +193,12 @@ class LvPlanHTMLLib if ($title === '') $title = $this->getScalar($event, 'lehrfach_bez'); + $infoTag = $this->getOldTempusNoticeTag($event); + if (!empty($infoTag)) + { + $title .= ' ' . self::NOTICE_TAG_ICON; + } + $normalized[] = array( 'start' => $start, 'end' => $end, @@ -207,7 +215,8 @@ class LvPlanHTMLLib 'participants' => $this->getParticipants($event), 'groups' => $this->getGroups($event), 'note' => $this->getEventNote($event, $isReservation), - 'color' => $this->getColor($event) + 'color' => $this->getColor($event), + 'infoTagTitle' => !empty($infoTag) && isset($infoTag['notiz']) ? $infoTag['notiz'] : '', ); } @@ -473,7 +482,17 @@ class LvPlanHTMLLib : ''; $html = '
'; $detailUrl = $this->buildDetailUrl($event, $type, $filters, $hourNumber); - $html .= 'escape($event['note']); + $infoTagTitle = isset($event['infoTagTitle']) && $event['infoTagTitle'] !== '' + ? $event['infoTagTitle'] + : null; + if ($infoTagTitle !== null) + { + $linkTitle = $this->escape($infoTagTitle); + } + + $html .= 'div{display:inline-block;vertical-align:top;min-width:180px;margin:0 3px 3px 0;padding:3px}' .'@media print{.outside>div{break-inside:avoid}}'; } + + private function getOldTempusNoticeTag($event) + { + if (empty($event->tags)) return null; + + $parsedTags = $event->tags; + if (!is_array($event->tags)) + $parsedTags = json_decode($event->tags, true); + + foreach ($parsedTags as $tag) + { + if (isset($tag['typ_kurzbz']) && $tag['typ_kurzbz'] === 'hinweis' && isset($tag['insertvon']) && $tag['insertvon'] === 'oldToNewTempusMigration') + return $tag; + } + + return null; + } }