Tickets erweitert
This commit is contained in:
parent
1964cadd8c
commit
66ff531ba4
@ -11,8 +11,7 @@ class TicketController {
|
|||||||
protected $ticketModel;
|
protected $ticketModel;
|
||||||
protected $eventModel;
|
protected $eventModel;
|
||||||
|
|
||||||
public function __construct($view)
|
public function __construct($view) {
|
||||||
{
|
|
||||||
$this->ticketModel = new TicketModel();
|
$this->ticketModel = new TicketModel();
|
||||||
$this->eventModel = new EventModel();
|
$this->eventModel = new EventModel();
|
||||||
$this->view = $view;
|
$this->view = $view;
|
||||||
@ -35,8 +34,11 @@ class TicketController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function hasTicket($userId, $eventId, $gueltigkeitsdatum) {
|
public function hasTicket() {
|
||||||
|
$userId = $_GET["userId"];
|
||||||
|
$eventId = $_GET["eventId"];
|
||||||
|
$erg = $this->ticketModel->hasTicket($userId, $eventId);
|
||||||
|
echo json_encode($erg, JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -28,4 +28,24 @@ class TicketModel extends Database {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasTicket($userId, $eventId) {
|
||||||
|
$sql = "SELECT * FROM ticket WHERE userId = :userId AND eventId = :eventId";
|
||||||
|
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
$params = array(
|
||||||
|
":userId" => $userId,
|
||||||
|
":eventId" => $eventId,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sth = $pdo->prepare($sql);
|
||||||
|
$sth->execute($params);
|
||||||
|
return $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user