diff --git a/Controller/CourseController.php b/Controller/CourseController.php index 8d2a6f2..976a098 100644 --- a/Controller/CourseController.php +++ b/Controller/CourseController.php @@ -13,7 +13,7 @@ class CourseController{ $this->view = $view; } - public function showCoursePage(){ + public function showCourse(){ $id = $_GET["courseId"] ?? null; if(!$id){ header('Location: index.php'); diff --git a/Model/CourseModel.php b/Model/CourseModel.php index 79cde89..ecb0a49 100644 --- a/Model/CourseModel.php +++ b/Model/CourseModel.php @@ -10,9 +10,11 @@ class CourseModel extends Database { public function getCourseById(string $id){ $pdo = $this->linkDB(); - $sql = "SELECT k.*, o.stadt, o.strasse, o.plz + $sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id, + o.stadt, o.strasse, o.plz, b.note, b.kommentar FROM kurs k JOIN ort o ON k.ort_id = o.id + LEFT JOIN bewertungen AS b ON b.kurs_id = k.id WHERE k.id = :id"; $sth = $pdo->prepare($sql); $sth->execute([':id' => $id]); diff --git a/Views/Course/showCourse.phtml b/Views/Course/showCourse.phtml index 27802a6..26c41dc 100644 --- a/Views/Course/showCourse.phtml +++ b/Views/Course/showCourse.phtml @@ -4,15 +4,15 @@ include dirname(__DIR__).'/header.phtml';
-
-

-

Bewertung:

+
+

+
+
+

Bewertung:

Preis:

-

Kursleiter:

Adresse: ,

- ‹ Zurück zur Kursübersicht - + ‹ Zurück zur Kursübersicht
diff --git a/Views/Welcome/showWelcome.phtml b/Views/Welcome/showWelcome.phtml index fef246b..f7c80df 100644 --- a/Views/Welcome/showWelcome.phtml +++ b/Views/Welcome/showWelcome.phtml @@ -35,11 +35,11 @@ $location = $_GET['location'] ?? '';
-
-
- getAllCourses(); +
+
+ getAllCourses(); $filteredKurse = array_filter($kurse, function($kurs) use ($rating, $location) { if ($rating && $kurs['note'] < $rating) return false; @@ -58,7 +58,6 @@ $location = $_GET['location'] ?? ''; $doc = new DOMDocument('1.0', 'UTF-8'); if (!empty($filteredKurse)) { - echo '
'; foreach ($filteredKurse as $kurs) { foreach ($filteredKurse as $kurs) { $id = htmlspecialchars($kurs['id']); @@ -69,6 +68,7 @@ $location = $_GET['location'] ?? ''; $kategorie = htmlspecialchars($kurs['kategorie'] ?? 'Keine Kategorie'); echo <<
@@ -92,7 +92,6 @@ $location = $_GET['location'] ?? ''; HTML; } } - echo '
'; } else { echo '

Keine Kurse gefunden.

'; } @@ -102,8 +101,6 @@ $location = $_GET['location'] ?? '';
- -