From e0a387ed9f5b8047dd050e66990e4972d9aecf85 Mon Sep 17 00:00:00 2001
From: Matthias Grief
Date: Fri, 13 Dec 2024 23:17:37 +0100
Subject: [PATCH] =?UTF-8?q?Fehler=20beim=20Speichern=20von=20Erkl=C3=A4rte?=
=?UTF-8?q?xten=20behoben?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
webseite/classes/TopicData.php | 14 +++++++++++---
webseite/search.php | 2 +-
webseite/topic.php | 2 +-
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/webseite/classes/TopicData.php b/webseite/classes/TopicData.php
index 7112744..ba32690 100644
--- a/webseite/classes/TopicData.php
+++ b/webseite/classes/TopicData.php
@@ -47,7 +47,7 @@ class TopicData
/**
* @var string Der gesamte Erklärungstext zum Thema, enthält fertiges HTML und LATEX Formelsyntax für MathJax https://docs.mathjax.org/en/latest/basic/mathematics.html
*/
- public string $article;
+ private string $article;
/**
* @var array Alle zugehörigen Formelaufgaben als Task
@@ -200,7 +200,7 @@ class TopicData
if (!isset($article)) {
$article = "Kein Erklärtext vorhanden";
}
- $result->article = str_replace('$TOPICPATH', Config::getTopicDirectory($subjectId, $topicId) . "images", $article);
+ $result->article = $article;
$taskJson = Util::readFileContent(Config::getTopicDirectory($subjectId, $topicId) . "tasks.json");
$result->tasks = array();
@@ -241,7 +241,6 @@ class TopicData
$data["icon"] = $this->icon;
$data["description"] = $this->description;
$data["relatedTopics"] = $this->relatedTopics;
- $data["files"] = $this->files;
$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
if (!$json) {
@@ -508,6 +507,15 @@ class TopicData
$this->files = $files;
}
+ /**
+ * Gibt anders als getArticle() Bildpfade richtig aus
+ * @return string HTML Quelltext für den Erklärtext
+ */
+ public function getFinishedArticle(): string
+ {
+ return str_replace('$TOPICPATH', Config::getTopicDirectory($this->subjectId, $this->id) . "images", $this->article);
+ }
+
public function getArticle(): string
{
return $this->article;
diff --git a/webseite/search.php b/webseite/search.php
index 6f09154..021967e 100644
--- a/webseite/search.php
+++ b/webseite/search.php
@@ -23,7 +23,7 @@ foreach ($subjects as $subject) {
strpos(strtolower($subject->displayName), $query) !== false ||
strpos(strtolower($topic->displayName), $query) !== false ||
strpos(strtolower($topic->description), $query) !== false ||
- strpos(strtolower($topic->article), $query) !== false
+ strpos(strtolower($topic->getFinishedArticle()), $query) !== false
) {
$results[] = [
'type' => 'topic',
diff --git a/webseite/topic.php b/webseite/topic.php
index 84ded0e..5e8c2b7 100644
--- a/webseite/topic.php
+++ b/webseite/topic.php
@@ -89,7 +89,7 @@ if (!isset($topicData)) {
description); ?>
- article); ?>
+ getFinishedArticle()); ?>