Limmat/admin/teilnahmebedingungen.php
2025-01-07 03:45:35 +01:00

118 lines
6.2 KiB
PHP

<?php include('includes/header.php'); ?>
<div>
<div class="card card-body p-4">
<div class="row">
<div class="col-12">
<h3 class="fw-semibold mb-4">Unterschriebene Teilnahmebedingungen</h3>
</div>
</div>
<?= alertMessage(); ?>
<input type="text" class="form-control mb-3" id="myInput" onkeyup="myFunction()" placeholder="Volltextsuche...">
<div class="table-responsive">
<table class="table table-hover table-striped table-bordered" id="sortTable">
<thead>
<tr>
<th style="cursor: pointer;" onclick="sortTable(0)">Vorname</th>
<th style="cursor: pointer;" onclick="sortTable(1)">Nachname</th>
<th style="cursor: pointer;" onclick="sortTable(2)">Klasse</th>
<th style="cursor: pointer;" onclick="sortTable(3)">Unterschrift Schüler:in</th>
<th style="cursor: pointer;" onclick="sortTable(4)">Unterschrift Elternteil</th>
</tr>
</thead>
<tbody>
<?php
// Schüler abrufen
$studentsQuery = "SELECT * FROM tbl_students";
$studentsResult = mysqli_query($conn, $studentsQuery);
if ($studentsResult && mysqli_num_rows($studentsResult) > 0) {
while ($student = mysqli_fetch_assoc($studentsResult)) {
if(((strlen($student['sig_student']) <= 1526)) && ((strlen($student['sig_parent']) <= 1526))){
$rowClassdanger = "table-danger";
}
else{
$rowClassdanger = '';
}
if(((strlen($student['sig_student']) <= 1526)) || ((strlen($student['sig_parent']) <= 1526))){
$rowClasswarning = "table-warning";
}
else{
$rowClasswarning = '';
}
$classOptions = getAllClasses('active');
$classID = $student['class'];
$className = isset($classOptions[$classID]) ? $classOptions[$classID] : 'Nicht verfügbar';
?>
<tr class="<?= $rowClassdanger;?> <?= $rowClasswarning;?>">
<td><?= $student['firstname']; ?></td>
<td><?= $student['lastname']; ?></td>
<td><?= $className; ?></td>
<?php
if((strlen($student['sig_student']) > 1526)){ ?>
<td><button type="button" class="btn btn-sm btn-light" data-bs-toggle="modal" data-bs-target="#signaturestudent-<?= $student['id'];?>"><i class="ti ti-signature"></i></button></td>
<?php
} else {
echo '<td> </td>';
}
if((strlen($student['sig_parent']) > 1526)){ ?>
<td><button type="button" class="btn btn-sm btn-light" data-bs-toggle="modal" data-bs-target="#signatureparent-<?= $student['id'];?>"><i class="ti ti-signature"></i></button></td>
<?php } else {
echo '<td> </td>';
}
?>
<div class="modal fade" id="signaturestudent-<?=$student['id'] ;?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Signatur von <?= $student['firstname'] . ' ' . $student['lastname'];?></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p> Unterschrieben am <?= date("d.m.Y H:i:s", strtotime($student['sig_student_time'])); ?> Uhr</p>
<img src="<?= $student['sig_student'] ?>" alt="Unterschrift des Schülers / der Schülerin">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="signatureparent-<?=$student['id'] ;?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Signatur eines Elternteils von <?= $student['firstname'] . ' ' . $student['lastname'];?></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p> Unterschrieben am <?= date("d.m.Y H:i:s", strtotime($student['sig_parent_time'])); ?> Uhr</p>
<img src="<?= $student['sig_parent'] ?>" alt="Unterschrift des Elternteils">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
<?php
echo '</tr>';
}
} else {
echo '<tr><td colspan="7">Keine Schüler gefunden.</td></tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php include('includes/footer.php'); ?>