134 lines
6.1 KiB
PHP
134 lines
6.1 KiB
PHP
<?php include('includes/header.php');
|
|
|
|
if(!isset($_SESSION['id'])){
|
|
header('Location: index.php');
|
|
}
|
|
?>
|
|
<div>
|
|
<div class="card card-body p-4">
|
|
<?= alertMessage(); ?>
|
|
|
|
<?php
|
|
$ID = $_SESSION['id'];
|
|
if (!is_numeric($ID)) {
|
|
echo '<div class="alert alert-danger" role="alert">' . $ID . '</div>';
|
|
return false;
|
|
}
|
|
|
|
$registration = getById('tbl_registrations', $ID);
|
|
if ($registration['status'] == 200) {
|
|
// Daten des Benutzers abrufen
|
|
$userFirstname = $registration['data']['firstname'];
|
|
$userLastname = $registration['data']['lastname'];
|
|
$userClass = $registration['data']['class'];
|
|
$userSek = $registration['data']['sek'];
|
|
$userFNiveau = $registration['data']['fniveau'];
|
|
$userMNiveau = $registration['data']['mniveau'];
|
|
// Weitere Daten abrufen und zuweisen...
|
|
|
|
?>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<h4 class="fw-semibold mb-4">Übersicht</h4>
|
|
<table class="table">
|
|
<tbody>
|
|
<tr>
|
|
<td><strong>Vorname:</strong></td>
|
|
<td><?= $userFirstname; ?></td>
|
|
<td><strong>Nachname:</strong></td>
|
|
<td><?= $userLastname; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>Klasse:</strong></td>
|
|
<td><?= $userClass; ?></td>
|
|
<td><strong>Sek:</strong></td>
|
|
<td><?= $userSek; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>F-Niveau:</strong></td>
|
|
<td><?= $userFNiveau; ?></td>
|
|
<td><strong>M-Niveau:</strong></td>
|
|
<td><?= $userMNiveau; ?></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
// Kurse abrufen, ohne Englisch- und Französischkurse für Sekunde A
|
|
if ($userSek == 'A') {
|
|
$courseQuery = "SELECT name, lessons FROM tbl_courses WHERE id IN (SELECT course_id FROM tbl_assign_courses WHERE user_id = $ID) AND name NOT IN ('Englisch', 'Französisch')";
|
|
} else {
|
|
$courseQuery = "SELECT name, lessons FROM tbl_courses WHERE id IN (SELECT course_id FROM tbl_assign_courses WHERE user_id = $ID)";
|
|
}
|
|
$courseResult = mysqli_query($conn, $courseQuery);
|
|
|
|
// Tabelle mit Kursen erstellen, wenn die Abfrage erfolgreich war
|
|
if ($courseResult && mysqli_num_rows($courseResult) > 0) {
|
|
// Gesamtanzahl der Lektionen nach der Filterung nach Kursen initialisieren
|
|
$totalLessonCount = 0;
|
|
|
|
?>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Kurs</th>
|
|
<th>Lektionen</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
while ($row = mysqli_fetch_assoc($courseResult)) {
|
|
echo '<tr>';
|
|
echo '<td>' . $row['name'] . '</td>';
|
|
echo '<td>' . $row['lessons'] . '</td>';
|
|
echo '</tr>';
|
|
// Lektionen zum Gesamtwert hinzufügen
|
|
$totalLessonCount += $row['lessons'];
|
|
}
|
|
// Wenn Sek=A, dann die Lektionen von Englisch- und Französischkursen addieren
|
|
if ($userSek == 'A') {
|
|
$englishFrenchLessonCountQuery = "SELECT SUM(lessons) AS english_french_lessons FROM tbl_courses WHERE name IN ('Englisch', 'Französisch') AND id IN (SELECT course_id FROM tbl_assign_courses WHERE user_id = $ID)";
|
|
$englishFrenchLessonCountResult = mysqli_query($conn, $englishFrenchLessonCountQuery);
|
|
$englishFrenchLessonCountRow = mysqli_fetch_assoc($englishFrenchLessonCountResult);
|
|
$englishFrenchLessonCount = $englishFrenchLessonCountRow['english_french_lessons'];
|
|
$totalLessonCount += $englishFrenchLessonCount;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
// Anzeige der Gesamtanzahl der Lektionen pro Woche
|
|
echo '<div class="row">';
|
|
echo '<div class="col-12">';
|
|
echo '<table class="table">';
|
|
echo '<thead>';
|
|
echo '<tr>';
|
|
echo '<th>Total Lektionen pro Woche:</th>';
|
|
echo '<th>'. ($totalLessonCount + 22) .'</th>';
|
|
echo '</tr>';
|
|
echo '</thead>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
} else {
|
|
// Wenn keine passenden Kurse gefunden wurden
|
|
echo '<div class="row"><div class="col-12">Keine Kurse gefunden.</div></div>';
|
|
}
|
|
?>
|
|
<div class="col-md-12 mt-4">
|
|
<a href="signature-student.php" type="button" class="btn btn-info float-end mx-1" id="submitButton" >Weiter<i class="ti ti-arrow-right ms-2"></i> </a>
|
|
</div>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php include('includes/footer.php'); ?>
|