This commit is contained in:
Karol Bielski 2025-07-10 11:32:32 +02:00
parent af6f6238ae
commit 4e243976db
4 changed files with 29 additions and 18 deletions

View File

@ -95,21 +95,16 @@ form .error {
grid-template-columns: auto !important;
}
/* fix radio buttons registration */
.radio {
flex-direction: row;
justify-content: space-between;
max-width: 290px;
align-items: center;
}
.radio {
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
gap: 24px;
}
.radio input {
margin-top: 0;
height: var(--h-sm);
width: var(--h-sm);
}

View File

@ -21,6 +21,7 @@
/*Font-Weight*/
--font-weight-semibold: 600;
--h-sm: 24px;
--h-md: 48px;
--border-primary: 1px solid #998E82;

View File

@ -157,17 +157,33 @@ class UserModel extends Database
}
public function getMyCourses() {
$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
ORDER BY k.name;";
$personId = $_SESSION["user_id"];
$isKursleiter = $_SESSION["user_role"] === "leiter";
$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 {
$sth = $pdo->prepare($sql);
$sth->execute();
$sth->execute([':personId' => $personId]);
return $sth->fetchAll(\PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
@ -175,6 +191,7 @@ class UserModel extends Database
}
}
public function updateCourse($course) {
$pdo = $this->linkDB();

View File

@ -6,11 +6,9 @@
<div class="row">
<div class="col-12">
<h1>Registration</h1>
<form method="post" class="form-grid">
<?php foreach ($labels as $key => $label): ?>
<div class="input">
<div class="input <?= $key === 'role' ? "radio" : "" ?>">
<label for="reg_<?= $key ?>"><?= $label ?></label>
<?php if ($key === 'password'): ?>
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>