Merge remote-tracking branch 'origin/main'
# Conflicts: # CSS/style.css
This commit is contained in:
commit
0ff636c20a
@ -1,104 +1,103 @@
|
|||||||
/* === Grundlayout === */
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: var(--font-family-main);
|
font-family: var(--font-family-main);
|
||||||
background-color: var(--brand-background);
|
background-color: var(--brand-background);
|
||||||
color: var(--brand-white);
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Header-Bereich === */
|
|
||||||
.welcome-header {
|
.welcome-header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 60px 20px 40px 20px;
|
margin: 60px 20px 40px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-heading {
|
.welcome-heading {
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--brand-primary);
|
color: var(--brand-primary);
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-subheading {
|
.welcome-subheading {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: white;
|
color: white;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding-left: 230px;
|
padding-left: 230px;
|
||||||
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Grid === */
|
.course-grid {
|
||||||
.courses-view {
|
display: flex;
|
||||||
display: flex;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
gap: 30px;
|
||||||
flex-wrap: wrap;
|
margin: 0 auto;
|
||||||
gap: 30px;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 30px 0 30px 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Karte === */
|
|
||||||
.course-card {
|
.course-card {
|
||||||
background: var(--brand-white);
|
background: var(--brand-white);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
|
||||||
max-width: 600px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Optional: Kurs-Bildbereich */
|
|
||||||
.course-image {
|
.course-image {
|
||||||
background-color: #ddd; /* Platzhalter – kannst du durch echte Bilder ersetzen */
|
background-color: #ddd;
|
||||||
height: 180px;
|
height: 180px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Inhalt === */
|
|
||||||
.course-content {
|
.course-content {
|
||||||
background-color: var(--brand-primary); /* Orange */
|
background-color: var(--brand-primary);
|
||||||
color: var(--brand-white);
|
color: var(--brand-white);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-left,
|
.course-left,
|
||||||
.course-right {
|
.course-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-left div:first-child,
|
.course-left div:first-child,
|
||||||
.course-right div:first-child {
|
.course-right div:first-child {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-right {
|
.course-right {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1024px) {
|
@media screen and (max-width: 1024px) {
|
||||||
|
.course-card {
|
||||||
|
flex: 0 0 calc(50% - 20px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 640px) {
|
@media screen and (max-width: 640px) {
|
||||||
.welcome-heading {
|
.course-card {
|
||||||
font-size: 36px;
|
flex: 0 0 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-subheading {
|
.welcome-heading {
|
||||||
font-size: 20px;
|
font-size: 36px;
|
||||||
text-align: center;
|
}
|
||||||
}
|
|
||||||
|
.welcome-subheading {
|
||||||
|
font-size: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
33
CSS/Element/filter_box.css
Normal file
33
CSS/Element/filter_box.css
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
.filter-box {
|
||||||
|
background: #EB8202;
|
||||||
|
color: #fff;
|
||||||
|
padding: 1em;
|
||||||
|
max-width: 300px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-family: sans-serif;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-box label {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-box select,
|
||||||
|
.filter-box input[type="text"],
|
||||||
|
.filter-box input[type="range"] {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-box button {
|
||||||
|
margin-top: 1em;
|
||||||
|
width: 100%;
|
||||||
|
background: white;
|
||||||
|
color: #000;
|
||||||
|
border: none;
|
||||||
|
padding: 0.5em;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
@ -95,21 +95,16 @@ form .error {
|
|||||||
grid-template-columns: auto !important;
|
grid-template-columns: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fix radio buttons registration */
|
|
||||||
.radio {
|
.radio {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
|
||||||
max-width: 290px;
|
max-width: 290px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
gap: 24px;
|
||||||
|
|
||||||
.radio {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio input {
|
.radio input {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
height: var(--h-sm);
|
||||||
|
width: var(--h-sm);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
@import url(Element/button.css);
|
@import url(Element/button.css);
|
||||||
@import url(Element/card.css);
|
@import url(Element/card.css);
|
||||||
@import url(Element/sidebar.css);
|
@import url(Element/sidebar.css);
|
||||||
|
@import url(Element/filter_box.css);
|
||||||
@import url(Element/modal.css);
|
@import url(Element/modal.css);
|
||||||
|
|
||||||
*,
|
*,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
/*Font-Weight*/
|
/*Font-Weight*/
|
||||||
--font-weight-semibold: 600;
|
--font-weight-semibold: 600;
|
||||||
|
|
||||||
|
--h-sm: 24px;
|
||||||
--h-md: 48px;
|
--h-md: 48px;
|
||||||
--border-primary: 1px solid #998E82;
|
--border-primary: 1px solid #998E82;
|
||||||
|
|
||||||
|
@ -134,6 +134,26 @@ class UserController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validateEditKursForm(){
|
||||||
|
foreach ($this->kursLabels as $index => $value) {
|
||||||
|
if($value === "|") continue;
|
||||||
|
if (strpos($value, "*") !== false && (!isset($_POST[$index]) || empty($_POST[$index]))) {
|
||||||
|
$this->kursErrors[$index] = "Bitte " . $value . " eingeben";
|
||||||
|
} else {
|
||||||
|
$this->kursValidData[$index] = $_POST[$index] === '' ? null : $_POST[$index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($this->errors) > 0) {
|
||||||
|
$this->view->setDoMethodName("showUserAccountPage");
|
||||||
|
$this->showUserAccountPage();
|
||||||
|
} else {
|
||||||
|
if ($this->db->writeNewCourse($this->kursValidData, $_SESSION["user_id"])) {
|
||||||
|
$this->view->setDoMethodName("showKursEditedConfirmation");
|
||||||
|
$this->showConfirmation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function showConfirmation(){}
|
public function showConfirmation(){}
|
||||||
|
|
||||||
public function showUserLoginConfirmation(){
|
public function showUserLoginConfirmation(){
|
||||||
|
@ -157,21 +157,108 @@ class UserModel extends Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getMyCourses() {
|
public function getMyCourses() {
|
||||||
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
$personId = $_SESSION["user_id"];
|
||||||
FROM kurs AS k
|
$isKursleiter = $_SESSION["user_role"] === "leiter";
|
||||||
JOIN ort AS o ON o.id = k.ort_id
|
|
||||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
|
||||||
ORDER BY k.name;";
|
|
||||||
|
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
if ($isKursleiter) {
|
||||||
|
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||||
|
o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
||||||
|
FROM kurs AS k
|
||||||
|
JOIN ort AS o ON o.id = k.ort_id
|
||||||
|
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||||
|
WHERE k.kursleiter = :personId
|
||||||
|
ORDER BY k.name";
|
||||||
|
} else {
|
||||||
|
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||||
|
o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
||||||
|
FROM kurs_user AS ku
|
||||||
|
JOIN kurs AS k ON k.id = ku.kurs_id
|
||||||
|
JOIN ort AS o ON o.id = k.ort_id
|
||||||
|
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||||
|
WHERE ku.user_id = :personId
|
||||||
|
ORDER BY k.name";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute([':personId' => $personId]);
|
||||||
return $sth->fetchAll(\PDO::FETCH_ASSOC);
|
return $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
|
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updateCourse($course) {
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isset($course['ort_id'])) {
|
||||||
|
$this->updateAddress($course);
|
||||||
|
$addressId = $course['ort_id'];
|
||||||
|
} else {
|
||||||
|
$addressId = $this->writeNewAddress($course);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE kurs SET
|
||||||
|
`name` = :name,
|
||||||
|
`preis` = :preis,
|
||||||
|
`dauer` = :dauer,
|
||||||
|
`rabatt` = :rabatt,
|
||||||
|
`kategorie` = :kategorie,
|
||||||
|
`beschreibung` = :beschreibung,
|
||||||
|
`ort_id` = :ort_id
|
||||||
|
WHERE `id` = :id";
|
||||||
|
|
||||||
|
$sth = $pdo->prepare($sql);
|
||||||
|
$sth->execute([
|
||||||
|
':id' => $course['id'],
|
||||||
|
':name' => $course['name'],
|
||||||
|
':preis' => $course['preis'],
|
||||||
|
':dauer' => $course['dauer'],
|
||||||
|
':rabatt' => $course['rabatt'],
|
||||||
|
':kategorie' => $course['kategorie'],
|
||||||
|
':beschreibung' => $course['beschreibung'],
|
||||||
|
':ort_id' => $addressId
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren des Kurses.", $e);
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateAddress($data) {
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
if (!isset($data['ort_id'])) {
|
||||||
|
throw new \Exception("Keine Adress-ID vorhanden zum Aktualisieren.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ort SET
|
||||||
|
`strasse` = :strasse,
|
||||||
|
`stadt` = :stadt,
|
||||||
|
`plz` = :plz
|
||||||
|
WHERE `id` = :id";
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sth = $pdo->prepare($sql);
|
||||||
|
$sth->execute([
|
||||||
|
':id' => $data['ort_id'],
|
||||||
|
':strasse' => $data['strasse'],
|
||||||
|
':stadt' => $data['stadt'],
|
||||||
|
':plz' => $data['plz']
|
||||||
|
]);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren der Adresse.", $e);
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,21 @@
|
|||||||
<h2>Neuer Kurs</h2>
|
<h2>Neuer Kurs</h2>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<?php
|
<?php
|
||||||
|
$userModel = new \Blog\Model\UserModel();
|
||||||
|
$courses = $userModel->getMyCourses();
|
||||||
|
$id = $_GET["id"] ?? null;
|
||||||
|
|
||||||
|
$selectedCourse = null;
|
||||||
|
foreach ($courses as $course) {
|
||||||
|
if ($course['id'] === $id) {
|
||||||
|
$selectedCourse = $course;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$validData = $selectedCourse ?? null;
|
||||||
|
$isEditing = $validData != null;
|
||||||
|
$saveLabel = $isEditing ? "Speichern" : "Erstellen";
|
||||||
|
|
||||||
function createInputField($label, $name, $errors, $validData, $type = 'input') {
|
function createInputField($label, $name, $errors, $validData, $type = 'input') {
|
||||||
$errorClass = isset($errors[$name]) ? 'error' : '';
|
$errorClass = isset($errors[$name]) ? 'error' : '';
|
||||||
$value = htmlspecialchars($validData[$name] ?? '');
|
$value = htmlspecialchars($validData[$name] ?? '');
|
||||||
@ -36,15 +51,18 @@ function createInputField($label, $name, $errors, $validData, $type = 'input') {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="controller" value="user">
|
<input type="hidden" name="controller" value="user">
|
||||||
<input type="hidden" name="do" value="validateKursForm">
|
<?php
|
||||||
<div class="form-grid-3" style="margin-top: 16px;">
|
$action = $isEditing ? 'validateEditKursForm' : 'validateKursForm';
|
||||||
<input style="grid-column: 3;" type="submit" name="submit" value="Absenden">
|
echo <<<HTML
|
||||||
</div>
|
<input type="hidden" name="do" value="{$action}">
|
||||||
|
<div class="form-grid-3" style="margin-top: 16px;">
|
||||||
|
<input style="grid-column: 3;" type="submit" name="submit" value="{$saveLabel}">
|
||||||
|
</div>
|
||||||
|
HTML;
|
||||||
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$userModel = new \Blog\Model\UserModel();
|
|
||||||
$courses = $userModel->getMyCourses();
|
|
||||||
$doc = new DOMDocument('1.0', 'UTF-8');
|
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||||
|
|
||||||
if (!empty($courses)) {
|
if (!empty($courses)) {
|
||||||
@ -52,7 +70,7 @@ if (!empty($courses)) {
|
|||||||
foreach ($courses as $kurs) {
|
foreach ($courses as $kurs) {
|
||||||
$courseCard = $doc->createElement('div');
|
$courseCard = $doc->createElement('div');
|
||||||
$courseCard->setAttribute('class', 'course-card');
|
$courseCard->setAttribute('class', 'course-card');
|
||||||
|
|
||||||
$courseImage = $doc->createElement('div');
|
$courseImage = $doc->createElement('div');
|
||||||
$courseImage->setAttribute('class', 'course-image');
|
$courseImage->setAttribute('class', 'course-image');
|
||||||
$courseCard->appendChild($courseImage);
|
$courseCard->appendChild($courseImage);
|
||||||
@ -84,6 +102,11 @@ if (!empty($courses)) {
|
|||||||
$category = $doc->createElement('div', htmlspecialchars($kurs['kategorie'] ?? 'Keine Kategorie'));
|
$category = $doc->createElement('div', htmlspecialchars($kurs['kategorie'] ?? 'Keine Kategorie'));
|
||||||
$courseRight->appendChild($category);
|
$courseRight->appendChild($category);
|
||||||
|
|
||||||
|
$editLink = $doc->createElement('a', "Bearbeiten");
|
||||||
|
$editLink->setAttribute('href', '?controller=User&do=showUserAccountPage&id=' . $kurs['id']);
|
||||||
|
$editLink->setAttribute('class', 'course-card-link');
|
||||||
|
$courseRight->appendChild($editLink);
|
||||||
|
|
||||||
echo $doc->saveHTML($courseCard);
|
echo $doc->saveHTML($courseCard);
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
12
Views/User/showKursEditedConfirmation.phtml
Normal file
12
Views/User/showKursEditedConfirmation.phtml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
include dirname(__DIR__).'/header.phtml';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="msg">
|
||||||
|
<p>Kurs erfolgreich bearbeitet.</p>
|
||||||
|
<a href="?controller=User&do=showUserAccountPage">Weiter</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@ -4,7 +4,7 @@ include dirname(__DIR__).'/header.phtml';
|
|||||||
|
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
<p>Kurs erfolgreich erstellt.</p>
|
<p>Kurs erfolgreich erstellt.</p>
|
||||||
<a href="?controller=Welcome&do=showWelcome">Weiter</a>
|
<a href="?controller=User&do=showUserAccountPage">Weiter</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if(isset($_SESSION["user_id"]) && $_SESSION["user_id"] != null) {
|
if(isset($_SESSION["user_id"]) && $_SESSION["user_id"] != null && $_SESSION["user_role"] == "leiter") {
|
||||||
include dirname(__DIR__).'/User/showAdminForm.phtml';
|
include dirname(__DIR__).'/User/showAdminForm.phtml';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -6,11 +6,9 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h1>Registration</h1>
|
<h1>Registration</h1>
|
||||||
|
|
||||||
<form method="post" class="form-grid">
|
<form method="post" class="form-grid">
|
||||||
|
|
||||||
<?php foreach ($labels as $key => $label): ?>
|
<?php foreach ($labels as $key => $label): ?>
|
||||||
<div class="input">
|
<div class="input <?= $key === 'role' ? "radio" : "" ?>">
|
||||||
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
||||||
<?php if ($key === 'password'): ?>
|
<?php if ($key === 'password'): ?>
|
||||||
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
||||||
|
@ -1,60 +1,128 @@
|
|||||||
<?php
|
<?php
|
||||||
include dirname(__DIR__) . '/header.phtml';
|
include dirname(__DIR__) . '/header.phtml';
|
||||||
|
|
||||||
|
// Filter auslesen
|
||||||
|
$rating = $_GET['rating'] ?? '';
|
||||||
|
$price = $_GET['price'] ?? '';
|
||||||
|
$location = $_GET['location'] ?? '';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
||||||
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
||||||
<div class="courses-view">
|
|
||||||
<?php
|
|
||||||
// Beispiel-Kurse
|
|
||||||
$kurse = [
|
|
||||||
[
|
|
||||||
'bewertung' => 5,
|
|
||||||
'titel' => 'Marketing Pro',
|
|
||||||
'adresse' => 'Bulu ulu Straße 17',
|
|
||||||
'preis' => '59,99€',
|
|
||||||
'ort' => '33333 Frankfurt',
|
|
||||||
'leiter' => 'Max Mustermann'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'bewertung' => 4,
|
|
||||||
'titel' => 'Design Basics',
|
|
||||||
'adresse' => 'Musterstraße 10',
|
|
||||||
'preis' => '39,99€',
|
|
||||||
'ort' => '10115 Berlin',
|
|
||||||
'leiter' => 'Lisa Beispiel'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'bewertung' => 5,
|
|
||||||
'titel' => 'Excel Masterclass',
|
|
||||||
'adresse' => 'Tabellenweg 5',
|
|
||||||
'preis' => '49,99€',
|
|
||||||
'ort' => '20457 Hamburg',
|
|
||||||
'leiter' => 'Thomas Tabelle'
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($kurse as $kurs): ?>
|
<div class="row">
|
||||||
<div class="course-card col-4">
|
<div class="col-4">
|
||||||
<div class="course-image"></div>
|
<div class="filter-box">
|
||||||
<div class="course-content">
|
<form method="get">
|
||||||
<div class="course-left">
|
<label for="rating">Bewertung:</label>
|
||||||
<div><?= $kurs['bewertung'] ?> ★</div>
|
<select name="rating" id="rating">
|
||||||
<div><?= $kurs['titel'] ?></div>
|
<option value="">Alle</option>
|
||||||
<div>Kursleiter: <?= $kurs['leiter'] ?></div>
|
<option value="5" <?= $rating == '5' ? 'selected' : '' ?>>5 Sterne</option>
|
||||||
<div><?= $kurs['adresse'] ?></div>
|
<option value="4" <?= $rating == '4' ? 'selected' : '' ?>>4 Sterne+</option>
|
||||||
</div>
|
<option value="3" <?= $rating == '3' ? 'selected' : '' ?>>3 Sterne+</option>
|
||||||
<div class="course-right">
|
</select>
|
||||||
<div><?= $kurs['preis'] ?></div>
|
|
||||||
<div><?= $kurs['ort'] ?></div>
|
<label for="price">Preis:</label>
|
||||||
</div>
|
<select name="price" id="price">
|
||||||
|
<option value="">Alle</option>
|
||||||
|
<option value="asc" <?= $price == 'asc' ? 'selected' : '' ?>>Aufsteigend</option>
|
||||||
|
<option value="desc" <?= $price == 'desc' ? 'selected' : '' ?>>Absteigend</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit">Anwenden</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
<div class="col-8">
|
||||||
|
<!-- KURSLISTE -->
|
||||||
|
<div class="course-grid row">
|
||||||
|
<?php
|
||||||
|
$kurse = [
|
||||||
|
[
|
||||||
|
'bewertung' => 5,
|
||||||
|
'titel' => 'Marketing Pro',
|
||||||
|
'adresse' => 'Bulu ulu Straße 17',
|
||||||
|
'preis' => '59,99€',
|
||||||
|
'ort' => '33333 Frankfurt',
|
||||||
|
'leiter' => 'Max Mustermann'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'bewertung' => 4,
|
||||||
|
'titel' => 'Design Basics',
|
||||||
|
'adresse' => 'Musterstraße 10',
|
||||||
|
'preis' => '39,99€',
|
||||||
|
'ort' => '10115 Berlin',
|
||||||
|
'leiter' => 'Lisa Beispiel'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'bewertung' => 5,
|
||||||
|
'titel' => 'Excel Masterclass',
|
||||||
|
'adresse' => 'Tabellenweg 5',
|
||||||
|
'preis' => '49,99€',
|
||||||
|
'ort' => '20457 Hamburg',
|
||||||
|
'leiter' => 'Thomas Tabelle'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'bewertung' => 5,
|
||||||
|
'titel' => 'Excel Masterclass',
|
||||||
|
'adresse' => 'Tabellenweg 5',
|
||||||
|
'preis' => '49,99€',
|
||||||
|
'ort' => '20457 Hamburg',
|
||||||
|
'leiter' => 'Thomas Tabelle'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'bewertung' => 5,
|
||||||
|
'titel' => 'Excel Masterclass',
|
||||||
|
'adresse' => 'Tabellenweg 5',
|
||||||
|
'preis' => '49,99€',
|
||||||
|
'ort' => '20457 Hamburg',
|
||||||
|
'leiter' => 'Thomas Tabelle'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Filter anwenden
|
||||||
|
$filteredKurse = array_filter($kurse, function($kurs) use ($rating, $location) {
|
||||||
|
if ($rating && $kurs['bewertung'] < $rating) return false;
|
||||||
|
if ($location && stripos($kurs['ort'], $location) === false) return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Preise in Float umwandeln für Sortierung
|
||||||
|
if ($price) {
|
||||||
|
usort($filteredKurse, function($a, $b) use ($price) {
|
||||||
|
$priceA = floatval(str_replace(',', '.', str_replace('€', '', $a['preis'])));
|
||||||
|
$priceB = floatval(str_replace(',', '.', str_replace('€', '', $b['preis'])));
|
||||||
|
return $price === 'asc' ? $priceA <=> $priceB : $priceB <=> $priceA;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($filteredKurse as $kurs): ?>
|
||||||
|
<div class="course-card col-4">
|
||||||
|
<div class="course-image"></div>
|
||||||
|
<div class="course-content">
|
||||||
|
<div class="course-left">
|
||||||
|
<div><?= $kurs['bewertung'] ?> ★</div>
|
||||||
|
<div><?= $kurs['titel'] ?></div>
|
||||||
|
<div>Kursleiter: <?= $kurs['leiter'] ?></div>
|
||||||
|
<div><?= $kurs['adresse'] ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="course-right">
|
||||||
|
<div><?= $kurs['preis'] ?></div>
|
||||||
|
<div><?= $kurs['ort'] ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user