diff --git a/Controller/CourseController.php b/Controller/CourseController.php new file mode 100644 index 0000000..8d2a6f2 --- /dev/null +++ b/Controller/CourseController.php @@ -0,0 +1,35 @@ +db = new CourseModel(); + $this->view = $view; + } + + public function showCoursePage(){ + $id = $_GET["courseId"] ?? null; + if(!$id){ + header('Location: index.php'); + exit; + } + + $kurs = $this->db->getCourseById($id); + if(!$kurs){ + new \Blog\Library\ErrorMsg("Kurs nicht gefunden"); + } + + $this->view->setVars([ + "kurs" => $kurs + ]); + + } + + +} \ No newline at end of file diff --git a/Model/CourseModel.php b/Model/CourseModel.php new file mode 100644 index 0000000..79cde89 --- /dev/null +++ b/Model/CourseModel.php @@ -0,0 +1,22 @@ +linkDB(); + $sql = "SELECT k.*, o.stadt, o.strasse, o.plz + FROM kurs k + JOIN ort o ON k.ort_id = o.id + WHERE k.id = :id"; + $sth = $pdo->prepare($sql); + $sth->execute([':id' => $id]); + $result = $sth->fetch(\PDO::FETCH_ASSOC); + return $result ?? null; + } +} \ No newline at end of file diff --git a/Views/Course/showCourse.phtml b/Views/Course/showCourse.phtml new file mode 100644 index 0000000..27802a6 --- /dev/null +++ b/Views/Course/showCourse.phtml @@ -0,0 +1,20 @@ + + +
+
+
+

+

Bewertung:

+

Preis:

+

Kursleiter:

+

Adresse: ,

+

+ ‹ Zurück zur Kursübersicht + +
+
+
+ + \ No newline at end of file diff --git a/Views/Welcome/showWelcome.phtml b/Views/Welcome/showWelcome.phtml index 5df5196..b867129 100644 --- a/Views/Welcome/showWelcome.phtml +++ b/Views/Welcome/showWelcome.phtml @@ -99,23 +99,23 @@ $location = $_GET['location'] ?? ''; }); } - foreach ($filteredKurse as $kurs): ?> -
+ foreach ($filteredKurse as $kurs): ?> +
-
-
-
-
-
Kursleiter:
-
+
+
+
+
+
Kursleiter:
+
+
+
+
+
+
-
-
-
-
-
-
- +
+