course-seite vorbereitung

This commit is contained in:
2025-07-11 09:50:45 +02:00
parent 509c685d80
commit c8499aa9d5
4 changed files with 92 additions and 15 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace Blog\Controller;
use Blog\Model\CourseModel;
class CourseController{
private $view;
private $db;
public function __construct($view){
$this->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
]);
}
}