Ändern der ID von bereits existierenden Fächern eingebaut
This commit is contained in:
@@ -243,6 +243,11 @@ class SubjectData
|
||||
|
||||
public function setId(string $id): void
|
||||
{
|
||||
rename(
|
||||
Config::getSubjectDirectory($this->getId()),
|
||||
Config::getSubjectDirectory($id)
|
||||
);
|
||||
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,10 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
if (empty($errors)) {
|
||||
$newSubject = false;
|
||||
if (isset($allSubjects[$_POST['id']])) {
|
||||
$newSubject = $allSubjects[$_POST['id']];
|
||||
if (isset($allSubjects[$_POST['oldSubjectId']])) {
|
||||
$newSubject = $allSubjects[$_POST['oldSubjectId']];
|
||||
|
||||
$newSubject->setId($_POST['id']);
|
||||
$newSubject->setDisplayName($_POST['displayName']);
|
||||
$newSubject->setDescription($_POST['description']);
|
||||
$newSubject->setColor($_POST['color']);
|
||||
@@ -129,6 +131,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"
|
||||
placeholder="z.B. mathe"
|
||||
value="<?php echo $defaultValues['id'] ?>">
|
||||
|
||||
<input type="hidden" name="oldSubjectId" value="<?php echo $defaultValues['id']; ?>">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user