Uhrzeit mit aufgenommen
This commit is contained in:
@@ -86,12 +86,19 @@ if (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id'])) {
|
|||||||
$edit_meeting = mysqli_fetch_assoc($result);
|
$edit_meeting = mysqli_fetch_assoc($result);
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
$edit_mode = true;
|
$edit_mode = true;
|
||||||
|
|
||||||
|
// Datum und Uhrzeit für die Formularfelder aufteilen
|
||||||
|
$edit_date_time = new DateTime($edit_meeting['meeting_date']);
|
||||||
|
$edit_meeting['meeting_date_only'] = $edit_date_time->format('Y-m-d');
|
||||||
|
$edit_meeting['meeting_time_only'] = $edit_date_time->format('H:i');
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Logik zum Hinzufügen oder Speichern von Terminen (POST) ---
|
// --- Logik zum Hinzufügen oder Speichern von Terminen (POST) ---
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
$meeting_date = $_POST['meeting_date'];
|
$meeting_date_only = $_POST['meeting_date'];
|
||||||
|
$meeting_time_only = $_POST['meeting_time'] ?? '12:00'; // Standardwert 12:00 Uhr
|
||||||
|
$meeting_date = $meeting_date_only . ' ' . $meeting_time_only;
|
||||||
$color_id = $_POST['color_id'];
|
$color_id = $_POST['color_id'];
|
||||||
$id = $_POST['id'] ?? null;
|
$id = $_POST['id'] ?? null;
|
||||||
|
|
||||||
@@ -120,12 +127,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Nächste 2 Donnerstage automatisch hinzufügen ---
|
// --- Nächste 2 Donnerstage automatisch hinzufügen (mit 12:00 Uhr) ---
|
||||||
$date = new DateTime('now');
|
$date = new DateTime('now');
|
||||||
$date->modify('next thursday');
|
$date->modify('next thursday');
|
||||||
|
|
||||||
for ($i = 0; $i < 2; $i++) {
|
for ($i = 0; $i < 2; $i++) {
|
||||||
$next_thursday = $date->format('Y-m-d');
|
$next_thursday = $date->format('Y-m-d') . ' 12:00:00';
|
||||||
|
|
||||||
$stmt = mysqli_prepare($conn, "SELECT id FROM meetings WHERE meeting_date = ?");
|
$stmt = mysqli_prepare($conn, "SELECT id FROM meetings WHERE meeting_date = ?");
|
||||||
mysqli_stmt_bind_param($stmt, "s", $next_thursday);
|
mysqli_stmt_bind_param($stmt, "s", $next_thursday);
|
||||||
@@ -182,12 +189,17 @@ require_once '../inc/header.php';
|
|||||||
<input type="hidden" name="id" value="<?php echo htmlspecialchars($edit_meeting['id']); ?>">
|
<input type="hidden" name="id" value="<?php echo htmlspecialchars($edit_meeting['id']); ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="row g-1 align-items-end">
|
<div class="row g-1 align-items-end">
|
||||||
<div class="col-md-6">
|
<div class="col-md-4">
|
||||||
<label for="meeting_date" class="form-label">Datum</label>
|
<label for="meeting_date" class="form-label">Datum</label>
|
||||||
<input type="date" class="form-control" id="meeting_date" name="meeting_date" value="<?php echo htmlspecialchars($edit_meeting['meeting_date'] ?? ''); ?>" required>
|
<input type="date" class="form-control" id="meeting_date" name="meeting_date" value="<?php echo htmlspecialchars($edit_meeting['meeting_date_only'] ?? ''); ?>" required>
|
||||||
<div class="form-text" style="visibility: hidden;"> </div>
|
<div class="form-text" style="visibility: hidden;"> </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-4">
|
||||||
|
<label for="meeting_time" class="form-label">Uhrzeit</label>
|
||||||
|
<input type="time" class="form-control" id="meeting_time" name="meeting_time" value="<?php echo htmlspecialchars($edit_meeting['meeting_time_only'] ?? '12:00'); ?>" required>
|
||||||
|
<div class="form-text" style="visibility: hidden;"> </div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<label for="color_id" class="form-label">Farbe</label>
|
<label for="color_id" class="form-label">Farbe</label>
|
||||||
<select class="form-select" id="color_id" name="color_id" required>
|
<select class="form-select" id="color_id" name="color_id" required>
|
||||||
<?php foreach ($all_colors as $color): ?>
|
<?php foreach ($all_colors as $color): ?>
|
||||||
@@ -199,6 +211,7 @@ require_once '../inc/header.php';
|
|||||||
<div class="form-text" style="visibility: hidden;"> </div>
|
<div class="form-text" style="visibility: hidden;"> </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 d-flex justify-content-start">
|
<div class="col-12 d-flex justify-content-start">
|
||||||
|
<div class="d-flex w-100">
|
||||||
<button type="submit" class="btn btn-<?php echo $edit_mode ? 'success' : 'primary'; ?> w-auto me-2">
|
<button type="submit" class="btn btn-<?php echo $edit_mode ? 'success' : 'primary'; ?> w-auto me-2">
|
||||||
<?php echo $edit_mode ? 'Speichern' : 'Hinzufügen'; ?>
|
<?php echo $edit_mode ? 'Speichern' : 'Hinzufügen'; ?>
|
||||||
</button>
|
</button>
|
||||||
@@ -207,6 +220,7 @@ require_once '../inc/header.php';
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -223,7 +237,7 @@ require_once '../inc/header.php';
|
|||||||
<table class="table table-striped table-hover">
|
<table class="table table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Datum</th>
|
<th>Datum & Uhrzeit</th>
|
||||||
<th>Farbe</th>
|
<th>Farbe</th>
|
||||||
<th>Aktionen</th>
|
<th>Aktionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -231,7 +245,7 @@ require_once '../inc/header.php';
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($meetings as $meeting): ?>
|
<?php foreach ($meetings as $meeting): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo date('d.m.Y', strtotime($meeting['meeting_date'])); ?></td>
|
<td><?php echo date('d.m.Y H:i', strtotime($meeting['meeting_date'])); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<div class="color-preview rounded me-2" style="background-color: <?php echo htmlspecialchars($meeting['hex_code']); ?>;"></div>
|
<div class="color-preview rounded me-2" style="background-color: <?php echo htmlspecialchars($meeting['hex_code']); ?>;"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user