Ändern von ID und Fach von existierenden Themen eingebaut
This commit is contained in:
@@ -487,6 +487,11 @@ class TopicData
|
|||||||
|
|
||||||
public function setId(string $id): void
|
public function setId(string $id): void
|
||||||
{
|
{
|
||||||
|
rename(
|
||||||
|
Config::getTopicDirectory($this->getSubjectId(), $this->getId()),
|
||||||
|
Config::getTopicDirectory($this->getSubjectId(), $id)
|
||||||
|
);
|
||||||
|
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,6 +502,11 @@ class TopicData
|
|||||||
|
|
||||||
public function setSubjectId(string $subjectId): void
|
public function setSubjectId(string $subjectId): void
|
||||||
{
|
{
|
||||||
|
rename(
|
||||||
|
Config::getTopicDirectory($this->getSubjectId(), $this->getId()),
|
||||||
|
Config::getTopicDirectory($subjectId, $this->getId())
|
||||||
|
);
|
||||||
|
|
||||||
$this->subjectId = $subjectId;
|
$this->subjectId = $subjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,9 +191,10 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||||||
$article = preg_replace("/^[ \r\n\t]*<p><p>/", "<p>", $article);
|
$article = preg_replace("/^[ \r\n\t]*<p><p>/", "<p>", $article);
|
||||||
$article = preg_replace("#</p></p>[ \r\n\t]*$#", "</p>", $article);
|
$article = preg_replace("#</p></p>[ \r\n\t]*$#", "</p>", $article);
|
||||||
|
|
||||||
if (isset($allSubjects[$_POST['subjectId']]->getTopics()[$_POST['id']])) {
|
if (isset($allSubjects[$_POST['oldSubjectId']]->getTopics()[$_POST['oldTopicId']])) {
|
||||||
$newTopic = $allSubjects[$_POST['subjectId']]->getTopics()[$_POST['id']];
|
$newTopic = $allSubjects[$_POST['oldSubjectId']]->getTopics()[$_POST['oldTopicId']];
|
||||||
|
|
||||||
|
$newTopic->setId($_POST['id']);
|
||||||
$newTopic->setDisplayName($_POST['displayName']);
|
$newTopic->setDisplayName($_POST['displayName']);
|
||||||
$newTopic->setSubjectId($_POST['subjectId']);
|
$newTopic->setSubjectId($_POST['subjectId']);
|
||||||
$newTopic->setDescription($_POST['description']);
|
$newTopic->setDescription($_POST['description']);
|
||||||
@@ -289,6 +290,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||||||
class="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-lg enabled:hover:border-gray-400"
|
class="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-lg enabled:hover:border-gray-400"
|
||||||
required
|
required
|
||||||
value="<?php echo $defaultValues['id']; ?>">
|
value="<?php echo $defaultValues['id']; ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="oldTopicId" value="<?php echo $defaultValues['id']; ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -312,6 +315,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||||||
<path d="M7 10l5 5 5-5H7z"/>
|
<path d="M7 10l5 5 5-5H7z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="oldSubjectId" value="<?php echo $defaultValues['subjectId']; ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user