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()); ?>