Standardmethoden für Standort und News.Events erweitert

This commit is contained in:
2025-06-23 11:10:46 +02:00
parent 6e3e3708b2
commit 1964cadd8c
10 changed files with 278 additions and 3 deletions

View File

@@ -14,6 +14,21 @@ class EventController {
$this->view = $view;
}
public function showEvents() {
$events = $this->eventModel->getEvents();
$this->view->setVars([
"events" => $events
]);
}
public function getEvent() {
$ausstellungid = $_GET['ausstellungid'];
$event = $this->eventModel->getEvent($ausstellungid);
$this->view->setVars([
"event" => $event
]);
}
public function updateEvent() {
$event = array(
"ausstellungid" => $_POST['ausstellungid'],

View File

@@ -0,0 +1,43 @@
<?php
namespace Blog\Controller;
use Blog\Model\NewsModel;
class NewsController {
protected $view;
protected $newsModel;
public function __construct($view) {
$this->newsModel = new NewsModel();
$this->view = $view;
}
public function showNews() {
$news = $this->newsModel->getNews();
$this->view->setVars([
"news" => $news
]);
}
public function createNews() {
$news = [
"name" => $_POST['name'],
"beschreibung" => $_POST['beschreibung'],
"datum" => $_POST['datum']
];
$this->newsModel->createNews($news);
$this->view->setVars([
"name" => $_POST['name']
]);
}
public function deleteNews() {
$newsId = $_POST['newsid'];
$this->newsModel->deleteNews($newsId);
$this->view->setVars([
"deleted" => $newsId
]);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Blog\Controller;
use Blog\Model\StandortModel;
class StandortController {
protected $view;
protected $standortModel;
public function __construct($view) {
$this->standortModel = new StandortModel();
$this->view = $view;
}
public function showStandorte() {
$this -> standortModel -> getStandorte();
$this->view->setVars([
"standorte" => $this->standortModel->getStandorte()
]);
}
}