8 Commits

38 changed files with 1055 additions and 765 deletions

View File

@@ -4,9 +4,22 @@ body {
font-size: 15px; font-size: 15px;
margin: 0; margin: 0;
padding: 0; padding: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
width: 100vw;
max-width: 100vw;
overflow-x: hidden;
} }
#wrapper { #wrapper {
flex: 1 0 auto;
min-height: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
margin-bottom: 20px;
width: 100vw;
max-width: 100vw;
} }
a { a {
@@ -16,6 +29,11 @@ a {
#navigation { #navigation {
display: flex; display: flex;
justify-content: center; justify-content: center;
position: sticky;
top: 0;
z-index: 1000;
background: #BAC8D4;
width: 100vw;
} }
.link-container { .link-container {
display: grid; display: grid;
@@ -38,17 +56,19 @@ a {
background-size: contain; background-size: contain;
} }
#footer { #footer {
position: absolute; position: relative;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100vw;
height: 240px; height: 180px;
background-color: #BAC8D4; background-color: #BAC8D4;
display: flex;
display: grid; flex-direction: column;
grid-template-columns: 6% 5% 43% 32% 14%;
grid-template-rows: 45% 10% 45%;
align-items: center; align-items: center;
justify-content: center;
flex-shrink: 0;
z-index: 999;
padding: 10px 0;
} }
.container-zahlungsmittel { .container-zahlungsmittel {
@@ -61,11 +81,16 @@ a {
} }
.inhalt { .inhalt {
flex: 1 1 auto;
display: flex; display: flex;
height: 10px;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100vw;
min-height: 0;
min-width: 0;
margin: 0;
padding: 0 2vw;
box-sizing: border-box;
} }
.zahlungsmittel-img { .zahlungsmittel-img {
@@ -102,141 +127,251 @@ a {
padding-right: 30px; padding-right: 30px;
} }
.container-welcome-inhalt { .container-welcome-inhalt {
grid-template-columns: 39% 61%;
display: grid; display: grid;
width: 110em; grid-template-columns: 1fr 1fr;
min-height: 80%; width: 100%;
max-width: 900px;
min-height: 200px;
border-radius: 10px; border-radius: 10px;
} background: white;
box-shadow: 0 2px 16px rgba(0,0,0,0.08);
.beispiel-austellung1-img { justify-items: center;
height: 480px;
width: 670px;
background-image: url("../images/beispiel-austellung1.png");
background-position: center;
background-size: contain;
justify-self: right;
border-radius: 10px;
}
.beispiel-austellung2-img {
background-image: url("../images/beispiel-austellung2.png");
background-position: center;
background-size: contain;
justify-self: right;
border-radius: 10px;
}
/* Login Page Styles */
.login-page-bg {
min-height: 100vh;
display: flex;
align-items: center; align-items: center;
justify-content: center; box-sizing: border-box;
background: linear-gradient(135deg, #DFF0F2 60%, #BAC8D4 100%); padding: 10px 0;
}
.beispiel-austellung1-img, .beispiel-austellung2-img {
height: 200px;
width: 90vw;
max-width: 320px;
background-position: center;
background-size: contain;
border-radius: 10px;
} }
.login-container { .login-container {
background: #fff; position: absolute;
box-shadow: 0 4px 24px rgba(0,0,0,0.10); top: 200px;
border-radius: 16px; background-color: #BAC8D4;
padding: 40px 32px 32px 32px; width: 900px;
width: 100%; height: 450px;
max-width: 400px; border-radius: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center;
box-sizing: border-box;
} }
.login-title { .tickets-container {
margin-bottom: 24px; position: absolute;
color: #4d4d4d; top: 200px;
font-size: 2rem; background-color: #BAC8D4;
font-weight: 600; width: 900px;
letter-spacing: 1px; height: 450px;
} border-radius: 10px;
.login-form {
width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 18px; align-items: center;
} justify-content: center;
box-sizing: border-box;
.login-field {
display: flex;
flex-direction: column;
gap: 6px;
}
.login-field label {
font-weight: 500;
color: #4d4d4d;
}
.login-field input {
padding: 10px 12px;
border: 1px solid #BAC8D4;
border-radius: 6px;
font-size: 1rem;
background: #F7FAFC;
transition: border 0.2s;
}
.login-field input:focus {
border: 1.5px solid #09add0;
outline: none;
}
.login-btn {
margin-top: 10px;
padding: 12px 0;
background: #09add0;
color: #fff;
border: none;
border-radius: 6px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
.login-btn:hover {
background: #007b9e;
}
.login-error {
background: #ffe0e0;
color: #b30000;
border: 1px solid #ffb3b3;
border-radius: 6px;
padding: 10px 16px;
margin-bottom: 18px;
width: 100%;
text-align: center;
}
.login-success {
background: #e0ffe6;
color: #006633;
border: 1px solid #b3ffd1;
border-radius: 6px;
padding: 10px 16px;
margin-bottom: 18px;
width: 100%;
text-align: center;
}
.login-link {
display: inline-block;
margin-top: 10px;
color: #09add0;
font-weight: 500;
text-decoration: underline;
} }
@media (max-width: 600px) { @media (max-width: 600px) {
body {
font-size: 14px;
width: 100vw;
max-width: 100vw;
overflow-x: hidden;
}
#wrapper {
width: 100vw;
max-width: 100vw;
}
#navigation {
width: 100vw;
min-width: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
}
.link-container {
width: 100vw;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
row-gap: 8px;
border-radius: 0;
padding: 0 4px;
}
.links {
font-size: 18px;
justify-content: center;
align-items: center;
padding: 6px 0;
text-align: center;
width: 100%;
}
#logo {
width: 120px;
height: 40px;
margin: 0 auto 8px auto;
display: flex;
justify-content: center;
align-items: center;
}
.container-welcome-inhalt {
grid-template-columns: 1fr;
width: 100vw;
max-width: 100vw;
min-height: 0;
padding: 8px 0;
}
.beispiel-austellung1-img, .beispiel-austellung2-img {
width: 90vw;
max-width: 98vw;
height: 120px;
margin-bottom: 10px;
}
.inhalt {
width: 100vw;
min-width: 0;
max-width: 100vw;
padding: 0 2vw;
box-sizing: border-box;
flex-direction: column;
align-items: stretch;
}
#footer {
width: 100vw;
height: auto;
min-height: 120px;
padding: 10px 0 10px 0;
font-size: 13px;
}
.container-zahlungsmittel {
width: 100vw;
text-align: center;
padding: 0;
}
.header-zahlungsarten {
font-size: 1.1em;
padding-right: 0;
text-align: center;
}
.zahlungsmittel-img {
width: 90vw;
max-width: 200px;
height: 30px;
margin: 0 auto;
}
.line {
width: 95vw;
}
.link-impressum, .link-datenschutz, .link-nutzungsbedingungen {
display: block;
padding: 2px 0;
text-align: center;
}
.text-bib {
display: block;
text-align: center;
padding: 0;
}
.desktop-only {
display: none !important;
}
.mobile-only {
display: block !important;
}
.login-container { .login-container {
padding: 24px 8px; position: static;
max-width: 95vw; width: 95vw;
max-width: 400px;
height: auto;
margin: 24px auto;
padding: 16px 8px;
box-sizing: border-box;
}
.tickets-container {
position: static;
width: 95vw;
max-width: 400px;
height: auto;
margin: 24px auto;
padding: 16px 8px;
box-sizing: border-box;
}
.login-container h1 {
font-size: 1.5em;
text-align: center;
}
.tickets-container h1 {
font-size: 1.5em;
text-align: center;
}
.login-container form,
.login-container label,
.login-container input {
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.login-container button,
.login-container a {
width: 100%;
max-width: 100%;
margin-top: 8px;
text-align: center;
box-sizing: border-box;
}
#nav-toggle-btn {
display: block;
background: none;
border: none;
font-size: 2em;
cursor: pointer;
margin: 0 auto 8px auto;
transition: transform 0.2s;
}
.nav-links {
display: none;
flex-direction: column;
align-items: center;
width: 100%;
transition: max-height 0.3s ease;
overflow: hidden;
}
.nav-links.open {
display: flex;
}
#nav-toggle-btn.open {
transform: rotate(180deg);
}
}
@media (min-width: 601px) {
.mobile-only {
display: none !important;
}
.desktop-only {
display: block !important;
}
#nav-toggle-btn {
display: none;
}
.nav-links {
display: flex !important;
flex-direction: row;
align-items: center;
width: auto;
gap: 32px;
}
.nav-links .links {
margin: 0 12px;
} }
} }

View File

@@ -0,0 +1,53 @@
<?php
namespace Blog\Controller;
use Blog\Model\ContactModel;
class ContactController
{
protected $view;
private $db;
private $validData = array();
private $errors = array();
private $labels = array("name" => "Name", "email" => "E-Mail-Adresse", "content" => "Nachricht");
public function __construct($view) {
$this->db = new ContactModel();
$this->view = $view;
}
public function showContactForm() {
$this->view->setVars([
'labels' => $this->labels,
'validData' => $this->validData,
'errors' => $this->errors
]);
}
public function showConfirmation() {
}
public function validateForm() {
foreach ($this->labels as $index => $value) {
if (!isset($_POST[$index]) || empty($_POST[$index])) {
$this->errors[$index] = "Bitte " . $value . " angeben";
} else {
$this->validData[$index] = $_POST[$index];
}
}
if (count($this->errors) > 0) {
$this->view->setDoMethodName("showContactForm");
$this->showContactForm();
} else {
if ($this->db->writeContactData($this->validData)) {
$this->view->setDoMethodName("showConfirmation");
$this->showConfirmation();
}
}
}
}
?>

View File

@@ -23,13 +23,13 @@ class EventController {
public function createEvent() { public function createEvent() {
$data = [ $data = [
'location_id' => $_POST['location_id'] ?? null,
'start_date' => $_POST['start_date'] ?? null,
'end_date' => $_POST['end_date'] ?? null,
'name' => $_POST['name'] ?? null, 'name' => $_POST['name'] ?? null,
'description' => $_POST['description'] ?? null, 'beschreibung' => $_POST['beschreibung'] ?? null,
'standortid' => $_POST['standortid'] ?? null,
'datum_von' => $_POST['datum_von'] ?? null,
'datum_bis' => $_POST['datum_bis'] ?? null,
'max_tickets' => $_POST['max_tickets'] ?? null, 'max_tickets' => $_POST['max_tickets'] ?? null,
'ticket_price' => $_POST['ticket_price'] ?? null 'preis' => $_POST['preis'] ?? null
]; ];
$this->model->createEvent($data); $this->model->createEvent($data);
@@ -38,21 +38,21 @@ class EventController {
} }
public function editEventForm() { public function editEventForm() {
$id = $_GET['event_id']; $id = $_GET['ausstellungid'];
$event = $this->model->getEvent($id); $event = $this->model->getEvent($id);
$this->view->setVars(['event' => $event]); $this->view->setVars(['event' => $event]);
} }
public function updateEvent($id, $data) { public function updateEvent($id, $data) {
$id = $_POST['event_id']; $id = $_POST['ausstellungid'];
$data = [ $data = [
'location_id' => $_POST['location_id'] ?? null, 'standortid' => $_POST['standortid'] ?? null,
'start_date' => $_POST['start_date'] ?? null, 'datum_von' => $_POST['datum_von'] ?? null,
'end_date' => $_POST['end_date'] ?? null, 'datum_bis' => $_POST['datum_bis'] ?? null,
'name' => $_POST['name'] ?? null, 'name' => $_POST['name'] ?? null,
'description' => $_POST['description'] ?? null, 'beschreibung' => $_POST['beschreibung'] ?? null,
'max_tickets' => $_POST['max_tickets'] ?? null, 'max_tickets' => $_POST['max_tickets'] ?? null,
'ticket_price' => $_POST['ticket_price'] ?? null 'preis' => $_POST['preis'] ?? null
]; ];
$this->model->updateEvent($id, $data); $this->model->updateEvent($id, $data);
} }

View File

@@ -0,0 +1,57 @@
<?php
namespace Blog\Controller;
use Blog\Model\GutscheinModel;
class GutscheinController {
private $model;
private $view;
public function __construct($view) {
$this->model = new GutscheinModel();
$this->view = $view;
}
public function showGutscheine() {
$gutscheine = $this->model->getGutscheine();
$this->view->setVars(['gutscheine' => $gutscheine]);
}
public function createGutschein() {
$data = [
'code' => $_POST['code'] ?? null,
'rabatt' => $_POST['rabatt'] ?? null,
'eventid' => $_POST['eventid'] ?? null,
'gültigkeit' => $_POST['gültigkeit'] ?? null
];
$erg = $this->model->createGutschein($data);
$this->view->setVars(['gutschein' => $erg]);
exit;
}
public function editGutscheinForm() {
$id = $_GET['gutscheinid'];
if ($id) {
$gutschein = $this->model->getGutschein($id);
$this->view->setVars(['gutschein' => $gutschein]);
}
}
public function updateGutschein() {
$id = $_POST['gutscheinid'];
$data = [
'code' => $_POST['code'] ?? null,
'rabatt' => $_POST['rabatt'] ?? null,
'eventid' => $_POST['eventid'] ?? null,
'gültigkeit' => $_POST['gültigkeit'] ?? null
];
$this->model->updateGutschein($id, $data);
}
public function deleteGutschein() {
$id = $_GET['gutscheinid'] ?? null;
$this->model->deleteGutschein($id);
}
}

View File

@@ -1,61 +0,0 @@
<?php
namespace Blog\Controller;
use Blog\Model\LocationModel;
class LocationController {
private $model;
private $view;
public function __construct($view) {
$this->model = new LocationModel();
$this->view = $view;
}
public function showLocations() {
$locations = $this->model->getLocations();
$this->view->setVars(['locations' => $locations]);
}
public function createLocation() {
$data = [
'street' => $_POST['street'],
'house_number' => $_POST['house_number'],
'postal_code' => $_POST['postal_code'],
'city' => $_POST['city'],
'country' => $_POST['country'],
'phone' => $_POST['phone'],
'email' => $_POST['email']
];
$result = $this->model->createLocation($data);
$this->view->setVars(['location' => $result]);
}
public function editLocationForm() {
$id = $_GET['location_id'];
$location = $this->model->getLocation($id);
$this->view->setVars(['location' => $location]);
}
public function updateLocation() {
$data = [
'street' => $_POST['street'],
'house_number' => $_POST['house_number'],
'postal_code' => $_POST['postal_code'],
'city' => $_POST['city'],
'country' => $_POST['country'],
'phone' => $_POST['phone'],
'email' => $_POST['email']
];
$location_id = $_POST['location_id'];
$result = $this->model->updateLocation($location_id, $data);
$this->view->setVars(['location' => $result]);
}
public function deleteLocation() {
$id = $_GET['location_id'] ?? null;
$this->model->deleteLocation($id);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Blog\Controller;
class ProfileController {
function showProfile()
{
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Blog\Controller;
class RegisterController {
function showRegisterPage()
{
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace Blog\Controller;
use Blog\Model\StandortModel;
class StandortController {
private $model;
private $view;
public function __construct($view) {
$this->model = new StandortModel();
$this->view = $view;
}
public function showStandorte() {
$standorte = $this->model->getStandorte();
$this->view->setVars(['standorte' => $standorte]);
}
public function createStandort() {
$data = [
'straße' => $_POST['straße'],
'hausnr' => $_POST['hausnr'],
'postleitzahl' => $_POST['postleitzahl'],
'ort' => $_POST['ort'],
'land' => $_POST['land'],
'tel' => $_POST['tel'],
'email' => $_POST['email']
];
$erg = $this->model->createStandort($data);
$this->view->setVars(['standort' => $erg]);
}
public function editStandortForm() {
$id = $_GET['standortid'];
$standort = $this->model->getStandort($id);
$this->view->setVars(['standort' => $standort]);
}
public function updateStandort() {
$id = $_POST['standortid'];
$data = [
'straße' => $_POST['straße'],
'hausnr' => $_POST['hausnr'],
'postleitzahl' => $_POST['postleitzahl'],
'ort' => $_POST['ort'],
'land' => $_POST['land'],
'tel' => $_POST['tel'],
'email' => $_POST['email']
];
$erg = $this->model->updateStandort($id, $data);
$this->view->setVars(['standort' => $erg]);
}
public function deleteStandort() {
$id = $_GET['standortid'] ?? null;
$this->model->deleteStandort($id);
}
}

View File

@@ -21,13 +21,13 @@ class TicketController {
public function buyTicket() { public function buyTicket() {
$data = [ $data = [
'user_id' => $_POST['user_id'] ?? null, 'userid' => $_POST['userid'],
'event_id' => $_POST['event_id'] ?? null, 'eventid' => $_POST['eventid'],
'price' => $_POST['price'] ?? null 'kaufdatum' => date('Y-m-d'),
'gültigkeitsdatum' => $_POST['gültigkeitsdatum']
]; ];
$erg = $this->ticketModel->buyTicket($data);
$result = $this->ticketModel->createTicket($data); $this->view->setVars(['ticket' => $erg]);
$this->view->setVars(['ticket' => $result]);
} }
public function deleteTicket() { public function deleteTicket() {

View File

@@ -0,0 +1,10 @@
<?php
namespace Blog\Controller;
class TicketsController {
function showTickets()
{
}
}

View File

@@ -1,57 +0,0 @@
<?php
namespace Blog\Controller;
use Blog\Model\VoucherModel;
class VoucherController {
private $model;
private $view;
public function __construct($view) {
$this->model = new VoucherModel();
$this->view = $view;
}
public function showVouchers() {
$vouchers = $this->model->getVouchers();
$this->view->setVars(['vouchers' => $vouchers]);
}
public function createVoucher() {
$data = [
'code' => $_POST['code'] ?? null,
'discount' => $_POST['discount'] ?? null,
'event_id' => $_POST['event_id'] ?? null,
'valid_until' => $_POST['valid_until'] ?? null
];
$result = $this->model->createVoucher($data);
$this->view->setVars(['voucher' => $result]);
exit;
}
public function editVoucherForm() {
$id = $_GET['voucher_id'];
if ($id) {
$voucher = $this->model->getVoucher($id);
$this->view->setVars(['voucher' => $voucher]);
}
}
public function updateVoucher() {
$id = $_POST['voucher_id'];
$data = [
'code' => $_POST['code'] ?? null,
'discount' => $_POST['discount'] ?? null,
'event_id' => $_POST['event_id'] ?? null,
'valid_until' => $_POST['valid_until'] ?? null
];
$this->model->updateVoucher($id, $data);
}
public function deleteVoucher() {
$id = $_GET['voucher_id'] ?? null;
$this->model->deleteVoucher($id);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Blog\Controller;
class WelcomeController
{
function showWelcome() {
}
function showProjects() {
}
function showTutorials() {
}
}

View File

@@ -8,11 +8,11 @@ class EventModel extends Database {
public function getEvents() { public function getEvents() {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM event ORDER BY start_date ASC;"; $sql = "SELECT * FROM ausstellung ORDER BY datum_von DESC;";
try { try {
$stmt = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$stmt->execute(); $sth->execute();
return $stmt->fetchAll(\PDO::FETCH_ASSOC); return $sth->fetchAll(\PDO::FETCH_ASSOC);
} catch (PDOException $e) { } catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Events.", $e); new \Blog\Library\ErrorMsg("Fehler beim Lesen der Events.", $e);
die; die;
@@ -21,12 +21,11 @@ class EventModel extends Database {
public function getEvent($id) { public function getEvent($id) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM event WHERE event_id = :event_id;"; $sql = "SELECT * FROM ausstellung WHERE ausstellungid = :id;";
$params = [":event_id" => $id];
try { try {
$stmt = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$stmt->execute($params); $sth->execute([":id" => $id]);
return $stmt->fetch(\PDO::FETCH_ASSOC); return $sth->fetch(\PDO::FETCH_ASSOC);
} catch (PDOException $e) { } catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen des Events.", $e); new \Blog\Library\ErrorMsg("Fehler beim Lesen des Events.", $e);
die; die;
@@ -35,29 +34,20 @@ class EventModel extends Database {
public function updateEvent($id, $data) { public function updateEvent($id, $data) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "UPDATE event SET $sql = "UPDATE ausstellung SET standortid = :standortid, datum_von = :datum_von, datum_bis = :datum_bis, name = :name, beschreibung = :beschreibung, max_tickets = :max_tickets, preis = :preis WHERE ausstellungid = :id;";
name = :name,
description = :description,
location_id = :location_id,
start_date = :start_date,
end_date = :end_date,
max_tickets = :max_tickets,
ticket_price = :ticket_price
WHERE event_id = :event_id;";
$params = [ $params = [
":standortid" => $data['standortid'],
":datum_von" => $data['datum_von'],
":datum_bis" => $data['datum_bis'],
":name" => $data['name'], ":name" => $data['name'],
":description" => $data['description'], ":beschreibung" => $data['beschreibung'],
":location_id" => $data['location_id'],
":start_date" => $data['start_date'],
":end_date" => $data['end_date'],
":max_tickets" => $data['max_tickets'], ":max_tickets" => $data['max_tickets'],
":ticket_price" => $data['ticket_price'], ":preis" => $data['preis'],
":event_id" => $id ":id" => $id
]; ];
try { try {
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute($params); $sth->execute($params);
return $sth;
} catch (PDOException $e) { } catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren des Events.", $e); new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren des Events.", $e);
die; die;
@@ -66,35 +56,32 @@ class EventModel extends Database {
public function createEvent($data) { public function createEvent($data) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "INSERT INTO event (name, description, location_id, start_date, end_date, max_tickets, ticket_price) $sql = "INSERT INTO ausstellung (standortid, datum_von, datum_bis, name, beschreibung, max_tickets, preis) VALUES (:standortid, :datum_von, :datum_bis, :name, :beschreibung, :max_tickets, :preis);";
VALUES (:name, :description, :location_id, :start_date, :end_date, :max_tickets, :ticket_price);";
$params = [ $params = [
":standortid" => $data['standortid'],
":datum_von" => $data['datum_von'],
":datum_bis" => $data['datum_bis'],
":name" => $data['name'], ":name" => $data['name'],
":description" => $data['description'], ":beschreibung" => $data['beschreibung'],
":location_id" => $data['location_id'],
":start_date" => $data['start_date'],
":end_date" => $data['end_date'],
":max_tickets" => $data['max_tickets'], ":max_tickets" => $data['max_tickets'],
":ticket_price" => $data['ticket_price'] ":preis" => $data['preis']
]; ];
try { try {
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute($params); $sth->execute($params);
return $sth; return $sth;
} catch (PDOException $e) { } catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Schreiben des Events.", $e); new \Blog\Library\ErrorMsg("Fehler beim Erstellen des Events.", $e);
die; die;
} }
} }
public function deleteEvent($id) { public function deleteEvent($id) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "DELETE FROM event WHERE event_id = :event_id;"; $sql = "DELETE FROM ausstellung WHERE ausstellungid = :id;";
$params = [":event_id" => $id];
try { try {
$stmt = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$stmt->execute($params); $sth->execute([":id" => $id]);
return $stmt->rowCount();
} catch (PDOException $e) { } catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Löschen des Events.", $e); new \Blog\Library\ErrorMsg("Fehler beim Löschen des Events.", $e);
die; die;

86
Model/GutscheinModel.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
namespace Blog\Model;
use PDOException;
class GutscheinModel extends Database {
public function getGutscheine() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM gutschein ORDER BY gültigkeit DESC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
return $sth->fetchAll(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Gutscheine.", $e);
die;
}
}
public function getGutschein($id) {
$pdo = $this->linkDB();
$sql = "SELECT * FROM gutschein WHERE gutscheinid = :id;";
$params = [":id" => $id];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
return $sth->fetch(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen des Gutscheins.", $e);
die;
}
}
public function createGutschein($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO gutschein (code, rabatt, eventid, gültigkeit) VALUES (:code, :rabatt, :eventid, :gültigkeit);";
$params = [
":code" => $data['code'],
":rabatt" => $data['rabatt'],
":eventid" => $data['eventid'],
":gültigkeit" => $data['gültigkeit']
];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
return $sth;
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Erstellen des Gutscheins.", $e);
die;
}
}
public function updateGutschein($id, $data) {
$pdo = $this->linkDB();
$sql = "UPDATE gutschein SET code = :code, rabatt = :rabatt, eventid = :eventid, gültigkeit = :gültigkeit WHERE gutscheinid = :id;";
$params = [
":code" => $data['code'],
":rabatt" => $data['rabatt'],
":eventid" => $data['eventid'],
":gültigkeit" => $data['gültigkeit'],
":id" => $id
];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren des Gutscheins.", $e);
die;
}
}
public function deleteGutschein($id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM gutschein WHERE gutscheinid = :id;";
$params = [":id" => $id];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Löschen des Gutscheins.", $e);
die;
}
}
}

View File

@@ -3,58 +3,83 @@
namespace Blog\Model; namespace Blog\Model;
use PDOException; use PDOException;
use PDO;
class NewsModel extends Database { class NewsModel extends Database {
public function getNewsById($id) { public function getNewsById($newsId) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM news WHERE news_id = :news_id;"; $sql = "SELECT * FROM news WHERE newsid = :newsid;";
$stmt = $pdo->prepare($sql); $params = [":newsid" => $newsId];
$params = [':news_id' => $id]; try {
$stmt->execute($params); $sth = $pdo->prepare($sql);
return $stmt->fetch(PDO::FETCH_ASSOC); $sth->execute($params);
return $sth->fetch(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der News.", $e);
die;
}
} }
public function updateNews($id, $data) { public function updateNews($newsId, $news) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "UPDATE news SET name = :name, description = :description, date = :date WHERE news_id = :news_id;"; $sql = "UPDATE news SET name = :name, beschreibung = :beschreibung, datum = :datum WHERE newsid = :newsid;";
$stmt = $pdo->prepare($sql);
$params = [ $params = [
':name' => $data['name'], ":name" => $news['titel'],
':description' => $data['description'], ":beschreibung" => $news['inhalt'],
':date' => $data['date'], ":datum" => $news['datum'],
':news_id' => $id ":newsid" => $newsId
]; ];
return $stmt->execute($params); try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
return $sth;
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren der News.", $e);
die;
}
} }
public function getNews() { public function getNews() {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM news ORDER BY date DESC;"; $sql = "SELECT * FROM news ORDER BY datum DESC;";
$stmt = $pdo->prepare($sql); try {
$stmt->execute(); $sth = $pdo->prepare($sql);
return $stmt->fetchAll(PDO::FETCH_ASSOC); $sth->execute();
return $sth->fetchAll(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der News.", $e);
die;
}
} }
public function createNews($data) { public function createNews($news) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "INSERT INTO news (name, description, date) VALUES (:name, :description, :date);"; $sql = "INSERT INTO news (name, beschreibung, datum) VALUES (:name, :beschreibung, :datum);";
$stmt = $pdo->prepare($sql);
$params = [ $params = [
':name' => $data['name'], ":name" => $news['titel'],
':description' => $data['description'], ":beschreibung" => $news['inhalt'],
':date' => $data['date'] ":datum" => $news['datum']
]; ];
$stmt->execute($params); try {
return $pdo->lastInsertId(); $sth = $pdo->prepare($sql);
$sth->execute($params);
return $sth;
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der News.", $e);
die;
}
} }
public function deleteNews($id) { public function deleteNews($newsId) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "DELETE FROM news WHERE news_id = :news_id;"; $sql = "DELETE FROM news WHERE newsid = :newsid;";
$stmt = $pdo->prepare($sql); $params = [":newsid" => $newsId];
$params = [':news_id' => $id]; try {
return $stmt->execute($params); $sth = $pdo->prepare($sql);
$sth->execute($params);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Löschen der News.", $e);
die;
}
} }
} }

View File

@@ -2,14 +2,13 @@
namespace Blog\Model; namespace Blog\Model;
use PDO;
use PDOException; use PDOException;
class LocationModel extends Database { class StandortModel extends Database {
public function getLocations() { public function getStandorte() {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM location ORDER BY location_id ASC;"; $sql = "SELECT * FROM Standort ORDER BY standortid ASC;";
try { try {
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute(); $sth->execute();
@@ -20,10 +19,10 @@ class LocationModel extends Database {
} }
} }
public function getLocation($id) { public function getStandort($standortid) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM location WHERE location_id = :location_id;"; $sql = "SELECT * FROM Standort WHERE standortid = :standortid;";
$params = [":location_id" => $id]; $params = [":standortid" => $standortid];
try { try {
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute($params); $sth->execute($params);
@@ -34,17 +33,17 @@ class LocationModel extends Database {
} }
} }
public function createLocation($data) { public function createStandort($data) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "INSERT INTO location (street, house_number, postal_code, city, country, phone, email) $sql = "INSERT INTO Standort (straße, hausnr, postleitzahl, ort, land, tel, email)
VALUES (:street, :house_number, :postal_code, :city, :country, :phone, :email);"; VALUES (:straße, :hausnr, :postleitzahl, :ort, :land, :tel, :email);";
$params = [ $params = [
":street" => $data['street'], ":straße" => $data['straße'],
":house_number" => $data['house_number'], ":hausnr" => $data['hausnr'],
":postal_code" => $data['postal_code'], ":postleitzahl" => $data['postleitzahl'],
":city" => $data['city'], ":ort" => $data['ort'],
":country" => $data['country'], ":land" => $data['land'],
":phone" => $data['phone'], ":tel" => $data['tel'],
":email" => $data['email'] ":email" => $data['email']
]; ];
try { try {
@@ -57,26 +56,26 @@ class LocationModel extends Database {
} }
} }
public function updateLocation($id, $data) { public function updateStandort($standortid, $data) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "UPDATE location SET $sql = "UPDATE Standort SET
street = :street, straße = :straße,
house_number = :house_number, hausnr = :hausnr,
postal_code = :postal_code, postleitzahl = :postleitzahl,
city = :city, ort = :ort,
country = :country, land = :land,
phone = :phone, tel = :tel,
email = :email email = :email
WHERE location_id = :location_id;"; WHERE standortid = :standortid;";
$params = [ $params = [
":street" => $data['street'], ":straße" => $data['straße'],
":house_number" => $data['house_number'], ":hausnr" => $data['hausnr'],
":postal_code" => $data['postal_code'], ":postleitzahl" => $data['postleitzahl'],
":city" => $data['city'], ":ort" => $data['ort'],
":country" => $data['country'], ":land" => $data['land'],
":phone" => $data['phone'], ":tel" => $data['tel'],
":email" => $data['email'], ":email" => $data['email'],
":location_id" => $id ":standortid" => $standortid
]; ];
try { try {
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
@@ -88,10 +87,10 @@ class LocationModel extends Database {
} }
} }
public function deleteLocation($id) { public function deleteStandort($standortid) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "DELETE FROM location WHERE location_id = :location_id;"; $sql = "DELETE FROM Standort WHERE standortid = :standortid;";
$params = [":location_id" => $id]; $params = [":standortid" => $standortid];
try { try {
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->execute($params); $sth->execute($params);

View File

@@ -3,72 +3,70 @@
namespace Blog\Model; namespace Blog\Model;
use PDOException; use PDOException;
use PDO;
class TicketModel extends Database { class TicketModel extends Database {
public function getTickets() { public function getTickets() {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT * FROM ticket ORDER BY ticket_id ASC;"; $sql = "SELECT * FROM Ticket ORDER BY ticketid ASC;";
$stmt = $pdo->prepare($sql); try {
$stmt->execute(); $sth = $pdo->prepare($sql);
return $stmt->fetchAll(PDO::FETCH_ASSOC); $sth->execute();
return $sth->fetchAll(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Tickets.", $e);
die;
}
} }
public function buyTicket($data) { public function buyTicket($data) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "INSERT INTO ticket (user_id, event_id, purchase_date, valid_until) $sql = "INSERT INTO Ticket (userid, eventid, kaufdatum, gültigkeitsdatum)
VALUES (:user_id, :event_id, :purchase_date, :valid_until)"; VALUES (:userid, :eventid, :kaufdatum, :gültigkeitsdatum);";
$stmt = $pdo->prepare($sql);
$params = [ $params = [
':user_id' => $data['user_id'], ":userid" => $data['userid'],
':event_id' => $data['event_id'], ":eventid" => $data['eventid'],
':purchase_date' => $data['purchase_date'], ":kaufdatum" => $data['kaufdatum'],
':valid_until' => $data['valid_until'] ":gültigkeitsdatum" => $data['gültigkeitsdatum']
]; ];
$stmt->execute($params); try {
return $pdo->lastInsertId(); $sth = $pdo->prepare($sql);
$sth->execute($params);
return $pdo->lastInsertId();
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Kauf des Tickets.", $e);
die;
}
} }
public function checkTicketExists($userid, $ausstellungid) { public function hasTicket($userid, $eventid) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT COUNT(*) as count FROM ticket WHERE user_id = :user_id AND event_id = :event_id;"; $sql = "SELECT COUNT(*) as count FROM Ticket WHERE userid = :userid AND eventid = :eventid;";
$stmt = $pdo->prepare($sql);
$params = [':user_id' => $userid, ':event_id' => $ausstellungid];
$stmt->execute($params);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
return $result['count'] > 0;
}
public function deleteTicket($id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM ticket WHERE ticket_id = :ticket_id;";
$stmt = $pdo->prepare($sql);
$params = [':ticket_id' => $id];
return $stmt->execute($params);
}
public function createTicket($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO ticket (event_id, user_id, price) VALUES (:event_id, :user_id, :price);";
$stmt = $pdo->prepare($sql);
$params = [ $params = [
':event_id' => $data['event_id'], ":userid" => $userid,
':user_id' => $data['user_id'], ":eventid" => $eventid
':price' => $data['price']
]; ];
return $stmt->execute($params); try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
return $sth->fetch(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler bei der Ticketprüfung.", $e);
die;
}
} }
public function getTicketsByUser($userId) { public function deleteTicket($ticketid) {
$pdo = $this->linkDB(); $pdo = $this->linkDB();
$sql = "SELECT t.*, e.name as event_name, e.start_date, e.end_date $sql = "DELETE FROM Ticket WHERE ticketid = :ticketid;";
FROM ticket t $params = [":ticketid" => $ticketid];
JOIN event e ON t.event_id = e.event_id try {
WHERE t.user_id = :user_id;"; $sth = $pdo->prepare($sql);
$stmt = $pdo->prepare($sql); $sth->execute($params);
$params = [':user_id' => $userId]; return $sth->rowCount();
$stmt->execute($params); } catch (PDOException $e) {
return $stmt->fetchAll(PDO::FETCH_ASSOC); new \Blog\Library\ErrorMsg("Fehler beim Löschen des Tickets.", $e);
die;
}
} }
} }

View File

@@ -1,62 +0,0 @@
<?php
namespace Blog\Model;
use PDO;
use PDOException;
class VoucherModel extends Database {
public function getVouchers() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM voucher ORDER BY valid_until DESC;";
$stmt = $pdo->prepare($sql);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
public function getVoucher($id) {
$pdo = $this->linkDB();
$sql = "SELECT * FROM voucher WHERE voucher_id = :id;";
$stmt = $pdo->prepare($sql);
$params = [':id' => $id];
$stmt->execute($params);
return $stmt->fetch(PDO::FETCH_ASSOC);
}
public function createVoucher($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO voucher (code, discount, event_id, valid_until) VALUES (:code, :discount, :event_id, :valid_until);";
$stmt = $pdo->prepare($sql);
$params = [
':code' => $data['code'],
':discount' => $data['discount'],
':event_id' => $data['event_id'],
':valid_until' => $data['valid_until']
];
$stmt->execute($params);
return $pdo->lastInsertId();
}
public function updateVoucher($id, $data) {
$pdo = $this->linkDB();
$sql = "UPDATE voucher SET code = :code, discount = :discount, event_id = :event_id, valid_until = :valid_until WHERE voucher_id = :id;";
$stmt = $pdo->prepare($sql);
$params = [
':code' => $data['code'],
':discount' => $data['discount'],
':event_id' => $data['event_id'],
':valid_until' => $data['valid_until'],
':id' => $id
];
return $stmt->execute($params);
}
public function deleteVoucher($id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM voucher WHERE voucher_id = :id;";
$stmt = $pdo->prepare($sql);
$params = [':id' => $id];
return $stmt->execute($params);
}
}

View File

@@ -1,28 +1,20 @@
<?php
include dirname(__DIR__) . '/header.phtml';
?>
<div class="inhalt"> <div class="inhalt">
<div class="login-container"> <div class="login-container">
<h1>Anmelden</h1> <h1>Anmelden</h1>
<form class="form-horizontal" action="index.php" method="post"> <form class="form-horizontal" action="#" method="post">
<input type="hidden" name="controller" value="Auth"> <label>
<input type="hidden" name="do" value="login"> <input class="input-email" type="text" placeholder="E-Mail">
<label for="email">E-Mail</label> </label>
<input class="input-email" type="email" name="email" id="email" placeholder="E-Mail" required>
<label for="password">Passwort</label>
<input class="input-passwort" type="password" name="password" id="password" placeholder="Passwort" required>
<button class="button-loggin" type="submit">Login</button>
</form> </form>
<div style="text-align:center; margin-top: 1.5em;"> <form class="form-horizontal" action="#" method="post">
<a class="link-passwort-vergessen">Passwort vergessen?</a> <label>
<br> <input class="input-passwort" type="text" placeholder="Passwort">
<a class="link-konto-erstellen" href="?controller=Auth&do=showRegistrationForm">Konto erstellen</a> </label>
</div> </form>
<button class="button-loggin">Login</button>
<a class="link-passwort-vergessen" href="?controller=Login&do=showPasswortVergessen">Passwort vergessen?</a>
<a class="link-konto-erstellen" href="?controller=Register&do=showRegisterPage">Konto erstellen</a>
</div> </div>
</div> </div>
<?php
include dirname(__DIR__) . '/footer.phtml';
?>

View File

View File

@@ -1,55 +0,0 @@
<?php
include dirname(__DIR__) . '/header.phtml';
?>
<div class="inhalt">
<div class="login-container">
<h1>Registrieren</h1>
<form class="form-horizontal" action="index.php" method="post">
<input type="hidden" name="controller" value="Auth">
<input type="hidden" name="do" value="register">
<label>
<input class="input-vorname" type="text" name="vorname" placeholder="Vorname">
</label>
<label>
<input class="input-nachname" type="text" name="nachname" placeholder="Nachname">
</label>
<label>
<input class="input-email" type="text" name="email" placeholder="E-Mail">
</label>
<label>
<input class="input-passwort" type="password" name="password" placeholder="Passwort">
</label>
<label>
<input class="input-passwort-repeat" type="password" name="password_repeat" placeholder="Passwort wiederholen">
</label>
<label>
<input class="input-strasse" type="text" name="strasse" placeholder="Straße">
</label>
<label>
<input class="input-hausnr" type="text" name="hausnr" placeholder="Hausnr.">
</label>
<label>
<input class="input-postleitzahl" type="text" name="plz" placeholder="Postleitzahl">
</label>
<label>
<input class="input-ort" type="text" name="ort" placeholder="Ort">
</label>
<label>
<input class="input-land" type="text" name="land" placeholder="Land">
</label>
<label>
<input class="input-tel" type="text" name="tel" placeholder="Telefonnr.">
</label>
<button class="button-register" type="submit">Registrieren</button>
</form>
<div style="text-align:center; margin-top: 1.5em;">
<a href="?controller=Auth&do=showLoginForm" class="login-link">Bereits registriert? Hier einloggen</a>
</div>
</div>
</div>
<?php
include dirname(__DIR__) . '/footer.phtml';
?>

View File

@@ -3,10 +3,10 @@ include dirname(__DIR__).'/header.phtml';
?> ?>
<div class="msg"> <div class="msg">
<p>Das Event "<?php echo $event['name']?>" wurde erfolgreich erstellt!</p> <p>Das Event "<?php echo $name?>" wurde erfolgreich erstellt!</p>
<a href="?controller=Event&do=showEvents">Weiter</a> <a href="?controller=Event&do=showEvents">Weiter</a>
</div> </div>
<?php
include dirname(__DIR__).'/footer.phtml';
?> <?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -7,6 +7,6 @@ include dirname(__DIR__).'/header.phtml';
<a href="?controller=Event&do=showEvents">Weiter</a> <a href="?controller=Event&do=showEvents">Weiter</a>
</div> </div>
<?php
include dirname(__DIR__).'/footer.phtml';
?> <?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -1,7 +1,7 @@
<?php <?php include dirname(__DIR__) . '/header.phtml'; ?>
include dirname(__DIR__).'/header.phtml';
?> <h2>Alle Ausstellungen</h2>
<h2>Alle Events</h2>
<?php if (!empty($events)): ?> <?php if (!empty($events)): ?>
<table> <table>
<thead> <thead>
@@ -17,17 +17,16 @@ include dirname(__DIR__).'/header.phtml';
<?php foreach ($events as $event): ?> <?php foreach ($events as $event): ?>
<tr> <tr>
<td><?php echo htmlspecialchars($event['name']); ?></td> <td><?php echo htmlspecialchars($event['name']); ?></td>
<td><?php echo nl2br(htmlspecialchars($event['description'])); ?></td> <td><?php echo nl2br(htmlspecialchars($event['beschreibung'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($event['start_date'])); ?></td> <td><?php echo date('d.m.Y', strtotime($event['datum_von'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($event['end_date'])); ?></td> <td><?php echo date('d.m.Y', strtotime($event['datum_bis'])); ?></td>
<td><?php echo (int) $event['max_tickets']; ?></td> <td><?php echo (int) $event['max_tickets']; ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<?php else: ?> <?php else: ?>
<p>Derzeit sind keine Events verfügbar.</p> <p>Derzeit sind keine Ausstellungen verfügbar.</p>
<?php endif; ?> <?php endif; ?>
<?php
include dirname(__DIR__).'/footer.phtml'; <?php include dirname(__DIR__) . '/footer.phtml'; ?>
?>

View File

@@ -3,10 +3,10 @@ include dirname(__DIR__).'/header.phtml';
?> ?>
<div class="msg"> <div class="msg">
<p>Das Event mit der ID "<?php echo $event_id?>" wurde erfolgreich bearbeitet!</p> <p>Das Event mit der ID "<?php echo $ausstellungid?>" wurde erfolgreich bearbeitet!</p>
<a href="?controller=Event&do=showEvents">Weiter</a> <a href="?controller=Event&do=showEvents">Weiter</a>
</div> </div>
<?php
include dirname(__DIR__).'/footer.phtml';
?> <?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -0,0 +1 @@
echo "create gutschein"

View File

@@ -0,0 +1,35 @@
<?php include dirname(__DIR__) . '/header.phtml'; ?>
<h2>Alle Gutscheine</h2>
<a href="?controller=Gutschein&do=createGutscheinForm">Neuen Gutschein anlegen</a>
<?php if (!empty($gutscheine)): ?>
<table border="1" cellpadding="8" cellspacing="0">
<thead>
<tr>
<th>Code</th>
<th>Rabatt (%)</th>
<th>Event-ID</th>
<th>Gültig bis</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($gutscheine as $g): ?>
<tr>
<td><?php echo htmlspecialchars($g['code']); ?></td>
<td><?php echo (int)$g['rabatt']; ?></td>
<td><?php echo (int)$g['eventid']; ?></td>
<td><?php echo htmlspecialchars($g['gültigkeit']); ?></td>
<td>
<a href="?controller=Gutschein&action=editGutscheinForm&id=<?php echo $g['gutscheinid']; ?>">Bearbeiten</a> |
<a href="?controller=Gutschein&action=deleteGutschein&id=<?php echo $g['gutscheinid']; ?>" onclick="return confirm('Wirklich löschen?');">Löschen</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>Keine Gutscheine vorhanden.</p>
<?php endif; ?>
<?php include dirname(__DIR__) . '/footer.phtml'; ?>

View File

@@ -1,12 +1,12 @@
<?php <?php include dirname(__DIR__) . '/header.phtml'; ?>
include dirname(__DIR__).'/header.phtml';
?> <h2>Alle News</h2>
<h2>Alle News</h2>
<?php if (!empty($news)): ?> <?php if (!empty($news)): ?>
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Titel</th> <th>Name</th>
<th>Beschreibung</th> <th>Beschreibung</th>
<th>Datum</th> <th>Datum</th>
</tr> </tr>
@@ -15,8 +15,8 @@ include dirname(__DIR__).'/header.phtml';
<?php foreach ($news as $item): ?> <?php foreach ($news as $item): ?>
<tr> <tr>
<td><?php echo htmlspecialchars($item['name']); ?></td> <td><?php echo htmlspecialchars($item['name']); ?></td>
<td><?php echo nl2br(htmlspecialchars($item['description'])); ?></td> <td><?php echo nl2br(htmlspecialchars($item['beschreibung'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($item['date'])); ?></td> <td><?php echo date('d.m.Y', strtotime($item['datum'])); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@@ -24,6 +24,5 @@ include dirname(__DIR__).'/header.phtml';
<?php else: ?> <?php else: ?>
<p>Derzeit sind keine News verfügbar.</p> <p>Derzeit sind keine News verfügbar.</p>
<?php endif; ?> <?php endif; ?>
<?php
include dirname(__DIR__).'/footer.phtml'; <?php include dirname(__DIR__) . '/footer.phtml'; ?>
?>

View File

View File

@@ -0,0 +1,64 @@
<div class="inhalt">
<div class="login-container">
<h1>Registrieren</h1>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-vorname" type="text" placeholder="Vorname">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-nachname" type="text" placeholder="Nachname">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-email" type="text" placeholder="E-Mail">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-passwort" type="text" placeholder="Passwort">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-passwort-repeat" type="text" placeholder="Passwort wiederholen">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-strasse" type="text" placeholder="Straße">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-hausnr" type="text" placeholder="Hausnr.">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-postleitzahl" type="text" placeholder="Postleitzahl">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-ort" type="text" placeholder="Ort">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-land" type="text" placeholder="Land">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-tel" type="text" placeholder="Telefonnr.">
</label>
</form>
<button class="button-register">Registrieren</button>
<a class="link-konto-erstellen" href="?controller=Login&do=showLoginPage">Login</a>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<?php <?php include dirname(__DIR__) . '/header.phtml'; ?>
include dirname(__DIR__).'/header.phtml';
?> <h2>Unsere Standorte</h2>
<h2>Unsere Standorte</h2>
<?php if (!empty($standorte)): ?> <?php if (!empty($standorte)): ?>
<table border="1" cellpadding="8" cellspacing="0"> <table border="1" cellpadding="8" cellspacing="0">
<thead> <thead>
@@ -18,9 +18,9 @@ include dirname(__DIR__).'/header.phtml';
<tbody> <tbody>
<?php foreach ($standorte as $standort): ?> <?php foreach ($standorte as $standort): ?>
<tr> <tr>
<td><?php echo htmlspecialchars($standort['strasse']); ?></td> <td><?php echo htmlspecialchars($standort['straße']); ?></td>
<td><?php echo htmlspecialchars($standort['hausnr']); ?></td> <td><?php echo htmlspecialchars($standort['hausnr']); ?></td>
<td><?php echo htmlspecialchars($standort['plz']); ?></td> <td><?php echo htmlspecialchars($standort['postleitzahl']); ?></td>
<td><?php echo htmlspecialchars($standort['ort']); ?></td> <td><?php echo htmlspecialchars($standort['ort']); ?></td>
<td><?php echo htmlspecialchars($standort['land']); ?></td> <td><?php echo htmlspecialchars($standort['land']); ?></td>
<td><?php echo htmlspecialchars($standort['tel']); ?></td> <td><?php echo htmlspecialchars($standort['tel']); ?></td>
@@ -32,6 +32,5 @@ include dirname(__DIR__).'/header.phtml';
<?php else: ?> <?php else: ?>
<p>Keine Standorte gefunden.</p> <p>Keine Standorte gefunden.</p>
<?php endif; ?> <?php endif; ?>
<?php
include dirname(__DIR__).'/footer.phtml'; <?php include dirname(__DIR__) . '/footer.phtml'; ?>
?>

View File

@@ -7,6 +7,6 @@ include dirname(__DIR__).'/header.phtml';
<a href="?controller=Welcome&do=showWelcome">Weiter</a> <a href="?controller=Welcome&do=showWelcome">Weiter</a>
</div> </div>
<?php
include dirname(__DIR__).'/footer.phtml';
?> <?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -0,0 +1,8 @@
<div class="inhalt">
<div class="tickets-container">
<h1>Tickets</h1>
<div class="tickets-container-inhalt">
</div>
</div>
</div>

View File

@@ -1,7 +0,0 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<!-- Gutschein-Erstellungsformular oder Inhalt hier einfügen -->
<?php
include dirname(__DIR__).'/footer.phtml';
?>

View File

@@ -1,37 +0,0 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<h2>Alle Gutscheine</h2>
<a href="?controller=Voucher&do=createVoucherForm">Neuen Gutschein anlegen</a>
<?php if (!empty($vouchers)): ?>
<table border="1" cellpadding="8" cellspacing="0">
<thead>
<tr>
<th>Code</th>
<th>Rabatt (%)</th>
<th>Event-ID</th>
<th>Gültig bis</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($vouchers as $v): ?>
<tr>
<td><?php echo htmlspecialchars($v['code']); ?></td>
<td><?php echo (int)$v['discount']; ?></td>
<td><?php echo (int)$v['event_id']; ?></td>
<td><?php echo htmlspecialchars($v['valid_until']); ?></td>
<td>
<a href="?controller=Voucher&do=editVoucherForm&id=<?php echo $v['voucher_id']; ?>">Bearbeiten</a> |
<a href="?controller=Voucher&do=deleteVoucher&id=<?php echo $v['voucher_id']; ?>" onclick="return confirm('Wirklich löschen?');">Löschen</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>Keine Gutscheine vorhanden.</p>
<?php endif; ?>
<?php
include dirname(__DIR__).'/footer.phtml';
?>

View File

@@ -1,30 +1,36 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="HTML-5">
<head> <head>
<title>Bib Arts</title> <title>VR Contact</title>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/bibarts/CSS/style.css" rel="stylesheet" type="text/css" /> <link href="CSS/style.css" rel="stylesheet" type="text/css" />
</head> </head>
<body> <body>
<div id="wrapper"> <nav id="navigation">
<nav id="navigation"> <div class="link-container">
<div class="link-container"> <div id="logo" ><a class="link-logo" href="#"></a></div>
<div id="logo" ><a class="link-logo" href="#"></a></div> <button id="nav-toggle-btn" aria-label="Menü ein-/ausklappen">&#9660;</button>
<a id="link-ausstellungen" class="links" href="?controller=Event&do=showEvents">Ausstellungen</a> <div class="nav-links">
<a id="link-tickets" class="links" href="#">Tickets</a> <a id="link-tickets" class="links" href="?controller=Tickets&do=showTickets">Tickets</a>
<a id="link-news" class="links" href="/bibarts/?controller=News&do=showNews">News</a> <a id="link-infos" class="links" href="?controller=Welcome&do=showWelcome">Infos</a>
<a id="link-profil" class="links" href="?controller=Contact&do=showContactForm">Profil</a> <a id="link-profil" class="links" href="?controller=Profile&do=showProfile">Profil</a>
<a id="link-login" class="links" href="?controller=Login&do=showLoginPage">Login</a>
<a id="link-register" class="links" href="?controller=Register&do=showRegisterPage">Register</a>
<div id="profile-picture"></div> <div id="profile-picture"></div>
<?php if (isset($_SESSION['user'])): ?>
<form method="post" action="/bibarts/index.php" style="display:inline;">
<input type="hidden" name="controller" value="Auth">
<input type="hidden" name="do" value="logout">
<button type="submit" class="links" style="background:none;border:none;cursor:pointer;">Logout</button>
</form>
<?php else: ?>
<a class="links" href="?controller=Auth&do=showLoginForm">Login</a>
<?php endif; ?>
</div> </div>
</nav> </div>
</div> </nav>
<script>
document.addEventListener('DOMContentLoaded', function() {
var btn = document.getElementById('nav-toggle-btn');
var links = document.querySelector('.nav-links');
if (btn && links) {
btn.addEventListener('click', function() {
links.classList.toggle('open');
btn.classList.toggle('open');
btn.innerHTML = links.classList.contains('open') ? '&#9650;' : '&#9660;';
});
}
});
</script>

View File

@@ -1,112 +1,124 @@
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 24. Nov 2017 um 17:01
-- Server-Version: 10.1.16-MariaDB
-- PHP-Version: 7.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00"; SET time_zone = "+00:00";
--
-- Datenbank: `blog`
--
-- -------------------------------------------------------- -- --------------------------------------------------------
CREATE TABLE user ( CREATE TABLE User (
user_id INT AUTO_INCREMENT PRIMARY KEY, userid INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50), vorname VARCHAR(50),
last_name VARCHAR(50), nachname VARCHAR(50),
street VARCHAR(100), strasse VARCHAR(100),
house_number VARCHAR(10), hausnr VARCHAR(10),
postal_code VARCHAR(10), postleitzahl VARCHAR(10),
city VARCHAR(50), ort VARCHAR(50),
country VARCHAR(50), land VARCHAR(50),
phone VARCHAR(20), tel VARCHAR(20),
email VARCHAR(100) UNIQUE, email VARCHAR(100) UNIQUE,
is_admin BOOLEAN DEFAULT FALSE, isAdmin BOOLEAN DEFAULT FALSE,
valid_until DATETIME NOT NULL DEFAULT '3025-01-01 00:00:00',
password VARCHAR(255) password VARCHAR(255)
); );
CREATE TABLE location ( CREATE TABLE Standort (
location_id INT AUTO_INCREMENT PRIMARY KEY, standortid INT AUTO_INCREMENT PRIMARY KEY,
street VARCHAR(100), strasse VARCHAR(100),
house_number VARCHAR(10), hausnr VARCHAR(10),
postal_code VARCHAR(10), plz VARCHAR(10),
city VARCHAR(50), ort VARCHAR(50),
country VARCHAR(50), land VARCHAR(50),
phone VARCHAR(20), tel VARCHAR(20),
email VARCHAR(100) email VARCHAR(100)
); );
CREATE TABLE event ( CREATE TABLE Ausstellung (
event_id INT AUTO_INCREMENT PRIMARY KEY, austellungid INT AUTO_INCREMENT PRIMARY KEY,
location_id INT, standortid INT,
start_date DATE, datum_von DATE,
end_date DATE, datum_bis DATE,
name VARCHAR(100), name VARCHAR(100),
description TEXT, beschreibung TEXT,
max_tickets INT, max_tickets INT,
ticket_price DECIMAL(5,2), FOREIGN KEY (standortid) REFERENCES Standort(standortid)
FOREIGN KEY (location_id) REFERENCES location(location_id)
); );
CREATE TABLE ticket ( CREATE TABLE Ticket (
ticket_id INT AUTO_INCREMENT PRIMARY KEY, ticketid INT AUTO_INCREMENT PRIMARY KEY,
user_id INT, userid INT,
event_id INT, ausstellungid INT,
purchase_date DATE, kaufdatum DATE,
valid_until DATE, gueltigkeit DATE,
FOREIGN KEY (user_id) REFERENCES user(user_id), preis DECIMAL(10,2),
FOREIGN KEY (event_id) REFERENCES event(event_id) FOREIGN KEY (userid) REFERENCES User(userid),
FOREIGN KEY (ausstellungid) REFERENCES Ausstellung(austellungid)
); );
CREATE TABLE voucher ( CREATE TABLE Gutschein (
voucher_id INT AUTO_INCREMENT PRIMARY KEY, gutscheinid INT AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) UNIQUE, code VARCHAR(50) UNIQUE,
discount INT CHECK (discount BETWEEN 0 AND 100), rabatt INT CHECK (rabatt BETWEEN 0 AND 100),
event_id INT, ausstellungid INT,
valid_until DATE, gueltigkeit DATE,
FOREIGN KEY (event_id) REFERENCES event(event_id) FOREIGN KEY (ausstellungid) REFERENCES Ausstellung(austellungid)
); );
CREATE TABLE news ( CREATE TABLE News (
news_id INT AUTO_INCREMENT PRIMARY KEY, newsid INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100), name VARCHAR(100),
description TEXT, beschreibung TEXT,
date DATE datum DATE
); );
-- User-Daten (Passwort: passwort123) -- User-Daten
INSERT INTO user (first_name, last_name, street, house_number, postal_code, city, country, phone, email, is_admin, password) INSERT INTO User (vorname, nachname, strasse, hausnr, postleitzahl, ort, land, tel, email, isAdmin, password)
VALUES VALUES
('Max', 'Muster', 'Musterstraße', '1', '12345', 'Musterstadt', 'Deutschland', '0123456789', 'max@muster.de', FALSE, '$2y$10$VAj.C0XHPUxV4oXS6b79aumlg5fBMPPx5FPqgkQSIQeBLh0WtYmKy'), ('Max', 'Muster', 'Musterstraße', '1', '12345', 'Musterstadt', 'Deutschland', '0123456789', 'max@muster.de', FALSE, 'passwort123'),
('Anna', 'Beispiel', 'Beispielweg', '5a', '54321', 'Beispielstadt', 'Deutschland', '0987654321', 'anna@beispiel.de', TRUE, '$2y$10$cnPBpkvLbdpDxzYvxlQg9uVp5y8ggr2SWL8NAMg9zk.3QnnEl.MGq'); ('Anna', 'Beispiel', 'Beispielweg', '5a', '54321', 'Beispielstadt', 'Deutschland', '0987654321', 'anna@beispiel.de', TRUE, 'adminpass');
-- Standort-Daten -- Standort-Daten
INSERT INTO location (street, house_number, postal_code, city, country, phone, email) INSERT INTO Standort (strasse, hausnr, plz, ort, land, tel, email)
VALUES VALUES
('Galeriestraße', '10', '10115', 'Berlin', 'Deutschland', '030123456', 'kontakt@galerie-berlin.de'), ('Galeriestraße', '10', '10115', 'Berlin', 'Deutschland', '030123456', 'kontakt@galerie-berlin.de'),
('Kunstallee', '22b', '50667', 'Köln', 'Deutschland', '0221123456', 'info@kunst-koeln.de'); ('Kunstallee', '22b', '50667', 'Köln', 'Deutschland', '0221123456', 'info@kunst-koeln.de');
-- Ausstellung-Daten -- Ausstellung-Daten
INSERT INTO event (location_id, start_date, end_date, name, description, max_tickets, ticket_price) INSERT INTO Ausstellung (standortid, datum_von, datum_bis, name, beschreibung, max_tickets)
VALUES VALUES
(1, '2025-07-01', '2025-08-31', 'Moderne Meisterwerke', 'Eine Sammlung moderner Kunstwerke aus Europa.', 200, 19.99), (1, '2025-07-01', '2025-08-31', 'Moderne Meisterwerke', 'Eine Sammlung moderner Kunstwerke aus Europa.', 200),
(2, '2025-09-10', '2025-10-20', 'Kunst der Antike', 'Ausstellung antiker Skulpturen und Gemälde.', 150, 39.99); (2, '2025-09-10', '2025-10-20', 'Kunst der Antike', 'Ausstellung antiker Skulpturen und Gemälde.', 150);
-- Gutschein-Daten -- Gutschein-Daten (Spaltennamen korrigiert)
INSERT INTO voucher (code, discount, event_id, valid_until) INSERT INTO Gutschein (code, rabatt, ausstellungid, gueltigkeit)
VALUES VALUES
('SOMMER2025', 15, 1, '2025-08-31'), ('SOMMER2025', 15, 1, '2025-08-31'),
('HERBST25', 25, 2, '2025-10-15'); ('HERBST25', 25, 2, '2025-10-15');
-- Ticket-Daten -- Ticket-Daten (Spaltennamen korrigiert)
INSERT INTO ticket (user_id, event_id, purchase_date, valid_until) INSERT INTO Ticket (userid, ausstellungid, kaufdatum, gueltigkeit, preis)
VALUES VALUES
(1, 1, '2025-06-01', '2025-07-15'), (1, 1, '2025-06-01', '2025-07-15', 12.50),
(2, 2, '2025-06-05', '2025-09-15'); (2, 2, '2025-06-05', '2025-09-15', 10.00);
-- News-Daten -- News-Daten
INSERT INTO news (name, description, date) INSERT INTO News (name, beschreibung, datum)
VALUES VALUES
('Neuer Standort eröffnet', 'Unsere Galerie in Köln ist jetzt geöffnet!', '2025-06-01'), ('Neuer Standort eröffnet', 'Unsere Galerie in Köln ist jetzt geöffnet!', '2025-06-01'),
('Frühbucher-Rabatt', 'Sichern Sie sich jetzt 15% Rabatt auf unsere Sommerausstellung.', '2025-05-20'); ('Frühbucher-Rabatt', 'Sichern Sie sich jetzt 15% Rabatt auf unsere Sommerausstellung.', '2025-05-20');

View File

@@ -1,45 +1,50 @@
<?php <?php
session_start();
include 'Views/header.phtml';
?>
<div id="wrapper">
<?php
spl_autoload_register(function ($className) {
if (substr($className, 0, 5) !== 'Blog\\') {
// not our business
return;
}
session_start();;; $fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php';
spl_autoload_register(function ($className) { if (file_exists($fileName)) {
if (substr($className, 0, 5) !== 'Blog\\') { include $fileName;
// not our business }
return; });
}
$controllerName = "";
$doMethodName = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$controllerName = isset($_POST['controller']) && $_POST['controller'] ? $_POST['controller'] : "Welcome";
$doMethodName = isset($_POST['do']) && $_POST['do'] ? $_POST['do'] : "showWelcome";
} else {
$controllerName = isset($_GET['controller']) && $_GET['controller'] ? $_GET['controller'] : "Welcome";
$doMethodName = isset($_GET['do']) && $_GET['do'] ? $_GET['do'] : "showWelcome";
}
$fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php'; $controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller';
if (file_exists($fileName)) { if (method_exists($controllerClassName, $doMethodName)) {
include $fileName; $view = new \Blog\Library\View(__DIR__.DIRECTORY_SEPARATOR.'Views'
} , ucfirst($controllerName), $doMethodName);
});
$controller = new $controllerClassName($view);
$controller->$doMethodName();
$controllerName = "";
$doMethodName = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$controllerName = isset($_POST['controller']) && $_POST['controller'] ? $_POST['controller'] : "Auth";
$doMethodName = isset($_POST['do']) && $_POST['do'] ? $_POST['do'] : "showAuthForm";
} else {
$controllerName = isset($_GET['controller']) && $_GET['controller'] ? $_GET['controller'] : "Auth";
$doMethodName = isset($_GET['do']) && $_GET['do'] ? $_GET['do'] : "showAuthForm";
}
$controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller'; $view->render();
if (method_exists($controllerClassName, $doMethodName)) { } else {
$view = new \Blog\Library\View(__DIR__.DIRECTORY_SEPARATOR.'Views' new \Blog\Library\ErrorMsg('Page not found: '.$controllerClassName.'::'.$doMethodName);
, ucfirst($controllerName), $doMethodName); }
?>
$controller = new $controllerClassName($view); </div>
$controller->$doMethodName(); <?php
include 'Views/footer.phtml';
$view->render();
} else {
new \Blog\Library\ErrorMsg('Page not found: '.$controllerClassName.'::'.$doMethodName);
}
?> ?>