Anzeige von Displaynamen statt IDs eingefügt

This commit is contained in:
Matthias Grief
2024-11-17 19:01:14 +01:00
parent 8429bdec0f
commit b2119a2287
4 changed files with 17 additions and 7 deletions

View File

@@ -64,7 +64,7 @@ class SubjectData
continue;
}
$result[] = $subjectData;
$result[$subjectData->id] = $subjectData;
}
return $result;

View File

@@ -63,7 +63,7 @@ class TopicData
continue;
}
$result[] = $topicData;
$result[$topicData->id] = $topicData;
}
return $result;

View File

@@ -621,10 +621,15 @@ $topics = $subjectData->topics;
<h4>Verwandte Themen:</h4>
<ul>
<?php
foreach ($topicData->relatedTopics as $relatedTopic) {
foreach ($topicData->relatedTopics as $relatedTopicName) {
$relatedTopic = $subjectData->topics[$relatedTopicName];
if(!isset($relatedTopicName)) {
continue;
}
?>
<li><?php echo($relatedTopic); ?></li>
<li><?php echo($relatedTopic->displayName); ?></li>
<?php
}

View File

@@ -373,11 +373,16 @@ if(!isset($topicData)) {
<h3>Verwandte Themen</h3>
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem;">
<?php
foreach ($topicData->relatedTopics as $relatedTopic) {
foreach ($topicData->relatedTopics as $relatedTopicName) {
$relatedTopic = $subjectData->topics[$relatedTopicName];
if(!isset($relatedTopic)) {
continue;
}
?>
<a href='<?php echo("topic.php?subject=$subjectData->id&topic=$relatedTopic") ?>'>
<span class="topic-tag"><?php echo($relatedTopic); ?></span>
<a href='<?php echo("topic.php?subject=$subjectData->id&topic=$relatedTopic->id") ?>'>
<span class="topic-tag"><?php echo($relatedTopic->displayName); ?></span>
</a>
<?php