diff --git a/webseite/subjectEditor.php b/webseite/subjectEditor.php index 2c89f47..020bd33 100644 --- a/webseite/subjectEditor.php +++ b/webseite/subjectEditor.php @@ -18,7 +18,7 @@ $defaultValues['displayName'] = ""; $defaultValues['id'] = ""; $defaultValues['description'] = ""; $defaultValues['color'] = "#3b82f6"; -$defaultValues['icon'] = ""; +$defaultValues['icon'] = "fa-book"; $errors = array(); @@ -32,38 +32,38 @@ if (isset($_GET['subject'])) { $defaultValues['icon'] = $editingSubject->getIcon(); } -if($_SERVER['REQUEST_METHOD'] == 'POST') { +if ($_SERVER['REQUEST_METHOD'] == 'POST') { foreach ($defaultValues as $key => $value) { $defaultValues[$key] = $_POST[$key]; } - if(!isset($_POST['displayName']) || trim($_POST['displayName']) == "") { + if (!isset($_POST['displayName']) || trim($_POST['displayName']) == "") { $errors["displayName"] = "Bitte geben Sie einen Namen an."; } - if(!isset($_POST['id']) || trim($_POST['id']) == "") { + if (!isset($_POST['id']) || trim($_POST['id']) == "") { $errors["id"] = "Bitte geben Sie eine ID an."; } - if(!isset($_POST['description']) || trim($_POST['description']) == "") { + if (!isset($_POST['description']) || trim($_POST['description']) == "") { $errors["description"] = "Bitte geben Sie eine Beschreibung an."; } - if(!isset($_POST['color']) || trim($_POST['color']) == "") { + if (!isset($_POST['color']) || trim($_POST['color']) == "") { $errors["color"] = "Bitte geben Sie eine Farbe an."; } - if(!isset($_POST['icon']) || trim($_POST['icon']) == "") { + if (!isset($_POST['icon']) || trim($_POST['icon']) == "") { $errors["icon"] = "Bitte geben Sie ein Icon an."; } - if(!isset($_POST['submit']) || !($_POST['submit'] == "Speichern" || $_POST['submit'] == "Fach löschen")) { + if (!isset($_POST['submit']) || !($_POST['submit'] == "Speichern" || $_POST['submit'] == "Fach löschen")) { $errors["submit"] = "Ungültig abgeschickt!"; } - if(empty($errors)) { + if (empty($errors)) { $newSubject = false; - if(isset($allSubjects[$_POST['id']])) { + if (isset($allSubjects[$_POST['id']])) { $newSubject = $allSubjects[$_POST['id']]; $newSubject->setDisplayName($_POST['displayName']); $newSubject->setDescription($_POST['description']); @@ -73,10 +73,10 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') { $newSubject = SubjectData::createNew($_POST['id'], $_POST['displayName'], $_POST['description'], $_POST['color'], $_POST['icon'], array()); } - if(!$newSubject) { + if (!$newSubject) { $errors["error"] = "Fehler beim Speichern des Faches."; } else { - if($_POST['submit'] == "Fach löschen") { + if ($_POST['submit'] == "Fach löschen") { $newSubject->delete(); header("Location: " . "index.php"); } else { @@ -106,111 +106,107 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') { -
-
-
- - -
+ -
- - -
- -
- - -
- -
- - -
- -
- - -
- - - $error

"; - } - ?> +
+ + + + + +
+ +
- - -
- - - -
-