WIP teilnahme
This commit is contained in:
@@ -267,7 +267,7 @@ class UserController{
|
||||
|
||||
$currentUser = $this->db->getUserById($userId);
|
||||
if(!$currentUser){
|
||||
throw new \Exception("User nicht gefunden");
|
||||
new \Blog\Library\ErrorMsg("User nicht gefunden");
|
||||
}
|
||||
|
||||
$validData = [
|
||||
@@ -296,7 +296,7 @@ class UserController{
|
||||
|
||||
$currentUser = $this->db->getUserById($userId);
|
||||
if (!$currentUser) {
|
||||
throw new \Exception('User nicht gefunden');
|
||||
new \Blog\Library\ErrorMsg('User nicht gefunden');
|
||||
}
|
||||
|
||||
$submitted = [
|
||||
@@ -388,5 +388,20 @@ class UserController{
|
||||
|
||||
}
|
||||
|
||||
public function enroll() {
|
||||
$courseId = $_POST['id'] ?? null;
|
||||
$userId = $_SESSION['user_id'] ?? null;
|
||||
|
||||
if ($userId === null) {
|
||||
new \Blog\Library\ErrorMsg("Nicht eingeloggt.");
|
||||
}
|
||||
|
||||
if ($courseId === null) {
|
||||
new \Blog\Library\ErrorMsg("Kein Kurs ausgewählt");
|
||||
}
|
||||
|
||||
$this->db->enroll($courseId, $userId);
|
||||
|
||||
$this->view->setDoMethodName("showEnrollmentConfirmation");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user