From ec08e7a74aa5051a12908e1a845cbeeecf10634e Mon Sep 17 00:00:00 2001 From: pbbfa23abi Date: Mon, 16 Jun 2025 12:31:49 +0200 Subject: [PATCH 1/2] admin controller --- Controller/AdminController.php | 56 ++++++++++++++++++++++++++++++++++ Model/AdminModel.php | 12 ++++++++ Views/Admin/showForm.phtml | 30 ++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 Controller/AdminController.php create mode 100644 Model/AdminModel.php create mode 100644 Views/Admin/showForm.phtml diff --git a/Controller/AdminController.php b/Controller/AdminController.php new file mode 100644 index 0000000..81ee77f --- /dev/null +++ b/Controller/AdminController.php @@ -0,0 +1,56 @@ + "Name*", "preis" => "Preis*", "dauer" => "Dauer*", "rabatt" => "Rabatt", "kategorie" => "Kategorie", "beschreibung" => "Beschreibung"); + + + public function __construct($view) + { + $this->db = new AdminModel(); + $this->view = $view; + } + + public function showForm() + { + $this->view->setVars([ + 'labels' => $this->labels, + 'validData' => $this->validData, + 'errors' => $this->errors + ]); + } + + public function showConfirmation() + { + + } + + public function validateForm(){ + foreach ($this->labels as $index => $value) { + if (!isset($_POST[$index]) || empty($_POST[$index])) { + $this->errors[$index] = "Bitte " . $value . " angeben"; + } else { + $this->validData[$index] = $_POST[$index]; + } + } + + if (count($this->errors) > 0) { + $this->view->setDoMethodName("showContactForm"); + $this->showContactForm(); + } else { + if ($this->db->writeContactData($this->validData)) { + $this->view->setDoMethodName("showConfirmation"); + $this->showConfirmation(); + } + } + } +} +?> \ No newline at end of file diff --git a/Model/AdminModel.php b/Model/AdminModel.php new file mode 100644 index 0000000..402913d --- /dev/null +++ b/Model/AdminModel.php @@ -0,0 +1,12 @@ + + + + +

Neuer Kurs

+
+ + $value) { + echo ''; + if ($index == "beschreibung") { + echo "
"; + } else { + echo '
'; + } + if (isset($errors[$index])) { + echo '
'; + } +} + +?> + + + +
+ + \ No newline at end of file From 837e666af9bb764945773fa69c241f6252280705 Mon Sep 17 00:00:00 2001 From: pbbfa23abi Date: Mon, 16 Jun 2025 12:56:41 +0200 Subject: [PATCH 2/2] icons + button zum AdminPanel --- CSS/Element/button.css | 17 +++++++++++++++++ Views/header.phtml | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CSS/Element/button.css b/CSS/Element/button.css index 13914dd..8df442c 100644 --- a/CSS/Element/button.css +++ b/CSS/Element/button.css @@ -6,4 +6,21 @@ font-size: var(--font-size-text); border-radius: 3px; text-decoration: none; +} + +.btn-user { + border-radius: 9999px; + color: var(--brand-primary); + background-color: var(--brand-white); + display: flex; + flex-direction: row; + justify-content: center; + justify-items: center; + align-items: center; + width: fit-content; + aspect-ratio: 1/1; +} + +.btn-user > span { + font-size: 28px; } \ No newline at end of file diff --git a/Views/header.phtml b/Views/header.phtml index 91d5b90..a1ddec0 100644 --- a/Views/header.phtml +++ b/Views/header.phtml @@ -8,6 +8,8 @@ + @@ -17,6 +19,7 @@
@@ -26,7 +29,6 @@
  • Projekte
  • Workshops
  • Kontakt
  • -