Merge branch 'frontendBackendFinal' of https://git.bib.de/PBBFA23CSE/Bib-Arts into frontendBackendFinal

This commit is contained in:
2025-07-08 10:29:03 +02:00
7 changed files with 137 additions and 24 deletions

View File

@@ -3,6 +3,7 @@
namespace Blog\Controller;
use Blog\Model\EventModel;
use Blog\Model\StandortModel;
class EventController {
@@ -61,4 +62,40 @@ class EventController {
$this->model->deleteEvent($id);
$this->view->setVars(['id' => $id]);
}
public function showUpdateEvent() {
$id = $_GET['event_id'] ?? null;
if (!$id) {
// handle error, e.g., redirect or show error message
$this->view->setVars(['error' => 'Keine Event-ID angegeben.']);
return;
}
$event = $this->model->getEvent($id);
if (!$event) {
$this->view->setVars(['error' => 'Event nicht gefunden.']);
return;
}
// Map DB fields to view fields if needed
$eventView = [
'id' => $event['event_id'],
'name' => $event['name'],
'start_date' => $event['start_date'],
'end_date' => $event['end_date'],
'location_id' => $event['location_id'],
'description' => $event['description'],
'max_tickets' => $event['max_tickets'],
'ticket_price' => $event['ticket_price'],
];
// Fetch location name (city)
$standortModel = new StandortModel();
$location = $standortModel->getStandort($event['location_id']);
$eventView['location_name'] = $location['city'] ?? '';
$this->view->setVars(['event' => $eventView]);
}
public function showCreateEvent() {
$standortModel = new \Blog\Model\StandortModel();
$locations = $standortModel->getStandorte();
$this->view->setVars(['locations' => $locations]);
}
}