Anzeige nur abgeschlossener Treffen. Edit nur als Admin
This commit is contained in:
78
history.php
78
history.php
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// PHP-Logik muss VOR dem HTML kommen!
|
|
||||||
include('inc/check_login.php');
|
include('inc/check_login.php');
|
||||||
include('inc/db.php');
|
include('inc/db.php');
|
||||||
include('inc/helpers.php');
|
include('inc/helpers.php');
|
||||||
@@ -38,7 +37,7 @@ function get_all_meeting_details($conn)
|
|||||||
JOIN colors c ON m.color_id = c.id
|
JOIN colors c ON m.color_id = c.id
|
||||||
LEFT JOIN meeting_teilnehmer mt ON m.id = mt.meeting_id
|
LEFT JOIN meeting_teilnehmer mt ON m.id = mt.meeting_id
|
||||||
LEFT JOIN users u ON mt.user_id = u.id
|
LEFT JOIN users u ON mt.user_id = u.id
|
||||||
WHERE m.meeting_date < CURDATE()
|
WHERE is_completed = 1
|
||||||
ORDER BY m.meeting_date DESC, u.username ASC
|
ORDER BY m.meeting_date DESC, u.username ASC
|
||||||
";
|
";
|
||||||
|
|
||||||
@@ -103,65 +102,15 @@ $colors = mysqli_fetch_all($colors_result, MYSQLI_ASSOC);
|
|||||||
|
|
||||||
// Hier wird die Funktion aufgerufen, nachdem sie definiert wurde
|
// Hier wird die Funktion aufgerufen, nachdem sie definiert wurde
|
||||||
$all_meetings = get_all_meeting_details($conn);
|
$all_meetings = get_all_meeting_details($conn);
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// Erst jetzt wird der Header inkludiert und HTML gesendet
|
|
||||||
include('inc/header.php');
|
include('inc/header.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="container mt-5">
|
<div class="container mt-5">
|
||||||
<div class="collapse mt-3" id="addMeetingForm">
|
|
||||||
<div class="card shadow mb-4">
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (isset($_GET['status']) && $_GET['status'] == 'success'): ?>
|
|
||||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
||||||
Treffen erfolgreich hinzugefügt.
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
<?php elseif (isset($_GET['status']) && $_GET['status'] == 'deleted'): ?>
|
|
||||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
||||||
Treffen erfolgreich gelöscht.
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
<?php elseif (isset($error_message)): ?>
|
|
||||||
<div class="alert alert-danger" role="alert">
|
|
||||||
<?= $error_message ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<form action="history.php" method="POST">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4 mb-3">
|
|
||||||
<label for="meeting_date" class="form-label">Datum des Treffens</label>
|
|
||||||
<input type="date" class="form-control" id="meeting_date" name="meeting_date" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 mb-3">
|
|
||||||
<label for="color_id" class="form-label">Farbvorgabe</label>
|
|
||||||
<select class="form-select" id="color_id" name="color_id" required>
|
|
||||||
<option value="">Wähle eine Farbe...</option>
|
|
||||||
<?php foreach ($colors as $color): ?>
|
|
||||||
<option value="<?= $color['id'] ?>"><?= htmlspecialchars($color['name']) ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 mb-3">
|
|
||||||
<label for="reason" class="form-label">Grund (optional)</label>
|
|
||||||
<input type="text" class="form-control" id="reason" name="reason">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button type="submit" name="submit_meeting" class="btn btn-primary">Treffen hinzufügen</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr class="mt-4 mb-4">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h2>Termin-History</h2>
|
<h2>Termin-History</h2>
|
||||||
<a class="btn btn-sm btn-outline-primary" data-bs-toggle="collapse" href="#addMeetingForm" role="button" aria-expanded="false" aria-controls="addMeetingForm">
|
|
||||||
<span class="material-symbols-outlined">add</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (empty($all_meetings)): ?>
|
<?php if (empty($all_meetings)): ?>
|
||||||
@@ -175,14 +124,21 @@ include('inc/header.php');
|
|||||||
<div class="mb-0 fs-6 fs-md-5 fw-bold">
|
<div class="mb-0 fs-6 fs-md-5 fw-bold">
|
||||||
<span class="fw-normal me-2">am</span><?= date('d.m.y', strtotime($meeting['date'])) ?>
|
<span class="fw-normal me-2">am</span><?= date('d.m.y', strtotime($meeting['date'])) ?>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<?php
|
||||||
<a href="admin/participant.php?id=<?= $meeting_id ?>&source=history" style="text-decoration: none; border: none; outline: none;">
|
if ($_SESSION['role'] == 'admin') {
|
||||||
<span class="material-symbols-outlined text-dark">edit_calendar</span>
|
?>
|
||||||
</a>
|
|
||||||
<a href="history.php?action=delete&id=<?= $meeting_id ?>" class="ms-1" style="text-decoration: none; border: none; outline: none;" onclick="return confirm('Möchtest du diesen Termin wirklich löschen?');">
|
<div>
|
||||||
<span class="material-symbols-outlined text-danger">delete_outline</span>
|
<a href="admin/participant.php?id=<?= $meeting_id ?>&source=history" style="text-decoration: none; border: none; outline: none;">
|
||||||
</a>
|
<span class="material-symbols-outlined text-dark">edit_calendar</span>
|
||||||
</div>
|
</a>
|
||||||
|
<a href="history.php?action=delete&id=<?= $meeting_id ?>" class="ms-1" style="text-decoration: none; border: none; outline: none;" onclick="return confirm('Möchtest du diesen Termin wirklich löschen?');">
|
||||||
|
<span class="material-symbols-outlined text-danger">delete_outline</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex flex-column text-muted fst-italic mb-2">
|
<div class="d-flex flex-column text-muted fst-italic mb-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user