35 lines
629 B
PHP
35 lines
629 B
PHP
<?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
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
} |