Limmat/s/forms.php

66 lines
2.4 KiB
PHP
Raw Normal View History

2025-01-07 03:45:35 +01:00
<?php
include('includes/header.php');
$paramResult = checkParamId('id');
if (!is_numeric($paramResult)) {
echo '<div class="alert alert-danger" role="alert">' . $paramResult . '</div>';
return false;
}
$form = getById('tbl_forms', checkParamId('id'));
if ($form['status'] == 200) {
$formID = $form['data']['id'];
$classID = $studentInfos['data']['class'];
$deadline = getDeadline($formID, $classID);
if (strtotime($deadline) >= strtotime('today')) {
?>
<div class="row mb-4">
<div class="col-2">
<a href="index.php" class="btn btn-light float-end"> <i class="ti ti-arrow-left"></i></a>
</div>
<div class="col-10">
<h4> <?= $form['data']['name']; ?></h4>
</div>
</div>
<?php
$form_id = $form['data']['id'];
$class_id = $studentInfos['data']['class'];
$courses = getCoursesByClassAndform($class_id, $form_id);
if (!empty($courses)) {
$bgColors = ['bg-secondary', 'bg-info', 'bg-warning', 'bg-success'];
$index = 0;
foreach ($courses as $courseentry) {
// Abfrage, um die individuelle Deadline für diesen Kurs zu erhalten
$courseID = $courseentry['id'];
$courseDeadline = getCourseDeadline($courseID);
// Überprüfen, ob die Deadline überschritten ist
if (strtotime($courseDeadline) >= strtotime('today')) {
$bgColor = $bgColors[$index % count($bgColors)];
$index++;
echo '<div class="container">';
echo '<div class="card rounded-4 ' . $bgColor . ' bg-gradient w-100 mb-2">';
echo '<div class="card-body">';
echo '<h5 class="mb-0 text-light">' . $courseentry['name'] . '</h5>';
echo '<a href="course.php?id=' . $courseentry['id'] . '" class="stretched-link"></a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
} else {
echo '<h6>Aktuell sind keine Kurse verfügbar.</br> Schau später nochmals vorbei.</h6>';
}
} else {
echo '<div class="alert alert-danger" role="alert">Die Anmeldefrist ist abgelaufen</div>';
}
}
?>
<?php include('includes/footer.php'); ?>