Bib-Arts/Controller/EventController.php

67 lines
1.8 KiB
PHP

<?php
namespace Blog\Controller;
use Blog\Model\EventModel;
class EventController {
protected $view;
protected $eventModel;
public function __construct($view) {
$this->eventModel = new EventModel();
$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'],
"standortid" => $_POST['standortid'],
"datum_von" => $_POST['datumVon'],
"datum_bis" => $_POST['datumBis'],
"name" => $_POST['name'],
"beschreibung" => $_POST['beschreibung'],
"max_tickets" => $_POST['max_tickets'],
"preis" => $_POST['preis'],
);
$this->eventModel->updateEvent($event);
$this->view->setVars([
"ausstellungid" => $_POST['ausstellungid'],
]);
}
public function createEvent() {
$event = array(
"standortid" => $_POST['standortid'],
"datum_von" => $_POST['datumVon'],
"datum_bis" => $_POST['datumBis'],
"name" => $_POST['name'],
"beschreibung" => $_POST['beschreibung'],
"max_tickets" => $_POST['max_tickets'],
"preis" => $_POST['preis'],
);
$this->eventModel->createEvent($event);
$this->view->setVars([
"name" => $_POST['name'],
]);
}
}