Limmat/s/courses.php

116 lines
4.8 KiB
PHP
Raw Normal View History

2025-01-07 03:45:35 +01:00
<?php
include('includes/header.php');
$student_id = $studentInfos['data']['id']; // Aktuell angemeldeter Schüler
?>
<div class="row">
<div class="col-12">
<h4 class="mt-3">Kursübersicht</h4>
</div>
</div>
<div class="text-center mt-2 mb-4">
<a href="signature-completed.php" class="btn w-100 btn-info"><i class="ti ti-arrow-left"></i> Zurück zur Wochenübersicht</a>
</div>
<h6 class="fw-semibold mb-4">Dienstag Vormittag</h6>
<?php
$courses = getCourses("di-vo");
foreach ($courses as $courseentry) {
$courseID = $courseentry['id'];
$course = getById('tbl_courses', $courseID);
$courseImage = $course['data']['image'] ?? '../assets/images/backgrounds/course.png'; // Standardbild, falls kein Bild vorhanden
// Überprüfen, ob der Kurs voll ist oder der Schüler bereits angemeldet ist
if (!isCourseFull($courseID) || isStudentEnrolled($student_id, $courseID)) {
echo '<div class="container p-0">';
echo '<div class="card rounded-2 w-100 mb-2" style="border-width: 0px;">';
echo '<div class="card-body d-flex align-items-center p-0">';
echo '<img src="' . $courseImage . '" style="height: 69px; width: 69px; object-fit: cover; border-radius: 5%; margin-right: 10px;">';
echo '<div class="flex-grow-1">';
echo '<h5 class="mb-0 ms-2 text-dark fw-bolder py-4">' . $courseentry['name'] . '</h5>';
echo '</div>';
echo '<a href="course.php?id=' . $courseentry['id'] . '" class="stretched-link"></a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
?>
<h6 class="fw-semibold mt-4 mb-4">Dienstag Nachmittag</h6>
<?php
$courses = getCourses("di-na");
foreach ($courses as $courseentry) {
$courseID = $courseentry['id'];
$course = getById('tbl_courses', $courseID);
$courseImage = $course['data']['image'] ?? '../assets/images/backgrounds/course.png';
if (!isCourseFull($courseID) || isStudentEnrolled($student_id, $courseID)) {
echo '<div class="container p-0">';
echo '<div class="card rounded-2 w-100 mb-2" style="border-width: 0px;">';
echo '<div class="card-body d-flex align-items-center p-0">';
echo '<img src="' . $courseImage . '" style="height: 69px; width: 69px; object-fit: cover; border-radius: 5%; margin-right: 10px;">';
echo '<div class="flex-grow-1">';
echo '<h5 class="mb-0 ms-2 text-dark fw-bolder py-4">' . $courseentry['name'] . '</h5>';
echo '</div>';
echo '<a href="course.php?id=' . $courseentry['id'] . '" class="stretched-link"></a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
?>
<!-- Repeat the above logic for "Donnerstag Vormittag" and "Donnerstag Nachmittag" -->
<h6 class="fw-semibold mt-4 mb-4">Donnerstag Vormittag</h6>
<?php
$courses = getCourses("do-vo");
foreach ($courses as $courseentry) {
$courseID = $courseentry['id'];
$course = getById('tbl_courses', $courseID);
$courseImage = $course['data']['image'] ?? '../assets/images/backgrounds/course.png';
if (!isCourseFull($courseID) || isStudentEnrolled($student_id, $courseID)) {
echo '<div class="container p-0">';
echo '<div class="card rounded-2 w-100 mb-2" style="border-width: 0px;">';
echo '<div class="card-body d-flex align-items-center p-0">';
echo '<img src="' . $courseImage . '" style="height: 69px; width: 69px; object-fit: cover; border-radius: 5%; margin-right: 10px;">';
echo '<div class="flex-grow-1">';
echo '<h5 class="mb-0 ms-2 text-dark fw-bolder py-4">' . $courseentry['name'] . '</h5>';
echo '</div>';
echo '<a href="course.php?id=' . $courseentry['id'] . '" class="stretched-link"></a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
?>
<h6 class="fw-semibold mt-4 mb-4">Donnerstag Nachmittag</h6>
<?php
$courses = getCourses("do-na");
foreach ($courses as $courseentry) {
$courseID = $courseentry['id'];
$course = getById('tbl_courses', $courseID);
$courseImage = $course['data']['image'] ?? '../assets/images/backgrounds/course.png';
if (!isCourseFull($courseID) || isStudentEnrolled($student_id, $courseID)) {
echo '<div class="container p-0">';
echo '<div class="card rounded-2 w-100 mb-2" style="border-width: 0px;">';
echo '<div class="card-body d-flex align-items-center p-0">';
echo '<img src="' . $courseImage . '" style="height: 69px; width: 69px; object-fit: cover; border-radius: 5%; margin-right: 10px;">';
echo '<div class="flex-grow-1">';
echo '<h5 class="mb-0 ms-2 text-dark fw-bolder py-4">' . $courseentry['name'] . '</h5>';
echo '</div>';
echo '<a href="course.php?id=' . $courseentry['id'] . '" class="stretched-link"></a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
?>
<div class="mb-5"></div>
<?php include('includes/footer.php'); ?>