Teil 2 #94

Merged
mg8220s merged 121 commits from dev into main 2025-01-08 10:16:03 +01:00
3 changed files with 13 additions and 5 deletions
Showing only changes of commit e0a387ed9f - Show all commits

View File

@@ -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 * @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 * @var array Alle zugehörigen Formelaufgaben als Task
@@ -200,7 +200,7 @@ class TopicData
if (!isset($article)) { if (!isset($article)) {
$article = "Kein Erklärtext vorhanden"; $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"); $taskJson = Util::readFileContent(Config::getTopicDirectory($subjectId, $topicId) . "tasks.json");
$result->tasks = array(); $result->tasks = array();
@@ -241,7 +241,6 @@ class TopicData
$data["icon"] = $this->icon; $data["icon"] = $this->icon;
$data["description"] = $this->description; $data["description"] = $this->description;
$data["relatedTopics"] = $this->relatedTopics; $data["relatedTopics"] = $this->relatedTopics;
$data["files"] = $this->files;
$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); $json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
if (!$json) { if (!$json) {
@@ -508,6 +507,15 @@ class TopicData
$this->files = $files; $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 public function getArticle(): string
{ {
return $this->article; return $this->article;

View File

@@ -23,7 +23,7 @@ foreach ($subjects as $subject) {
strpos(strtolower($subject->displayName), $query) !== false || strpos(strtolower($subject->displayName), $query) !== false ||
strpos(strtolower($topic->displayName), $query) !== false || strpos(strtolower($topic->displayName), $query) !== false ||
strpos(strtolower($topic->description), $query) !== false || strpos(strtolower($topic->description), $query) !== false ||
strpos(strtolower($topic->article), $query) !== false strpos(strtolower($topic->getFinishedArticle()), $query) !== false
) { ) {
$results[] = [ $results[] = [
'type' => 'topic', 'type' => 'topic',

View File

@@ -89,7 +89,7 @@ if (!isset($topicData)) {
<?php echo($topicData->description); ?> <?php echo($topicData->description); ?>
</p> </p>
<p class="content-text article-section"> <p class="content-text article-section">
<?php echo($topicData->article); ?> <?php echo($topicData->getFinishedArticle()); ?>
</p> </p>
<div class="exercise-section bg-gray-100"> <div class="exercise-section bg-gray-100">