Add note tag title from old tempus, in new html previes

This commit is contained in:
Ivymaster
2026-08-04 11:23:48 +02:00
parent ef3b6461de
commit c19f0a7b00
3 changed files with 55 additions and 13 deletions
+5 -3
View File
@@ -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 : [],
];
+12 -8
View File
@@ -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 .= '</tr>';
}
@@ -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('<br>', array_unique($values));
return null;
}
private function renderText($value)
+38 -2
View File
@@ -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 = '<div align="center"'.$style.'>';
$detailUrl = $this->buildDetailUrl($event, $type, $filters, $hourNumber);
$html .= '<a class="stpl_detail" title="'.$this->escape($event['note']).'"';
$linkTitle = $this->escape($event['note']);
$infoTagTitle = isset($event['infoTagTitle']) && $event['infoTagTitle'] !== ''
? $event['infoTagTitle']
: null;
if ($infoTagTitle !== null)
{
$linkTitle = $this->escape($infoTagTitle);
}
$html .= '<a class="stpl_detail" title="'.$linkTitle.'"';
if ($detailUrl !== null)
{
$onclick = 'window.open('
@@ -825,4 +844,21 @@ class LvPlanHTMLLib
.'.outside{margin-top:10px}.outside>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;
}
}