diff --git a/CSS/Element/form.css b/CSS/Element/form.css index 79cdc70..29410dc 100644 --- a/CSS/Element/form.css +++ b/CSS/Element/form.css @@ -22,6 +22,7 @@ form input { flex-direction: column; row-gap: 2px; align-items: start; + width: 100%; } .input-short { @@ -32,7 +33,9 @@ form input { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; + width: 100%; max-width: 600px; + margin: auto; } .form-grid label { @@ -42,9 +45,13 @@ form input { } .form-grid textarea { - grid-column: span 2; - resize: vertical; min-height: 100px; + width: 100%; +} + +.form-grid input:last-child, div:nth-last-child(4) { + grid-column: 1 / -1; + column-span: 2; } input, textarea { diff --git a/CSS/style.css b/CSS/style.css index b2796a7..ae458ab 100644 --- a/CSS/style.css +++ b/CSS/style.css @@ -41,8 +41,7 @@ main { #wrapper { max-width: 90%; - margin: 0 auto; - color: white; + margin: 0 auto } .msg { diff --git a/Controller/AdminController.php b/Controller/AdminController.php index 8daa158..a8e81ae 100644 --- a/Controller/AdminController.php +++ b/Controller/AdminController.php @@ -10,7 +10,7 @@ class AdminController private $db; private $validData = array(); private $errors = array(); - private $labels = array("name" => "Name*", "preis" => "Preis*", "dauer" => "Dauer*", "rabatt" => "Rabatt", "kategorie" => "Kategorie", "beschreibung" => "Beschreibung"); + private $labels = array("name" => "Name*", "preis" => "€ Preis*", "dauer" => "Dauer* (Stunden)", "rabatt" => "Rabatt", "kategorie" => "Kategorie", "beschreibung" => "Beschreibung"); public function __construct($view) @@ -30,7 +30,7 @@ class AdminController public function showConfirmation() { - + echo "
Erfolgreich erstellt!
"; } public function validateForm(){ diff --git a/Model/AdminModel.php b/Model/AdminModel.php index 402913d..6177b99 100644 --- a/Model/AdminModel.php +++ b/Model/AdminModel.php @@ -6,7 +6,30 @@ use PDOException; class AdminModel extends Database { - public function writeContactData($values) + public function writeNewCourse($values) { + $guid = $this->createUUID(); + + $sql = "INSERT INTO kurs (`id`, `name`, `preis`, `dauer`, `rabatt`, `kategorie`, `beschreibung`) VALUES ( + :guid, :name, :preis, :dauer, :rabatt, :kategorie, :beschreibung);"; + + $pdo = $this->linkDB(); + + try { + $sth = $pdo->prepare($sql); + $sth->execute(array(":guid" => $guid, + ":name" => $values["name"], + ":preis" => $values["preis"], + ":dauer" => $values["dauer"], + ":rabatt" => $values["rabatt"], + ":kategorie" => $values["kategorie"], + ":beschreibung" => $values["beschreibung"], + )); + } catch (PDOException $e) { + new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e); + die; + } + + return true; } } \ No newline at end of file diff --git a/Views/Admin/showForm.phtml b/Views/Admin/showForm.phtml index 92f0079..2b7b1db 100644 --- a/Views/Admin/showForm.phtml +++ b/Views/Admin/showForm.phtml @@ -11,12 +11,8 @@ include dirname(__DIR__).'/header.phtml'; $index = 0; foreach ($labels as $key => $value) { - if ($key == "beschreibung") { - if($index % 2 != 0) echo ''; - } echo '