Lachenzelg/s/course_old.php

183 lines
7.7 KiB
PHP
Raw Normal View History

2025-01-07 03:02:25 +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;
}
$course = getById('tbl_courses',checkParamId('id'));
if($course['status'] == 200)
{
$category = getByCategoryId('tbl_categories',$course['data']['category_id']);
?>
<div class="row mb-3">
<div class="col-2">
<a href="categories.php?id= <?= $course['data']['category_id'] ;?>" class="btn btn-light float-end"> <i class="ti ti-arrow-left"></i></a>
</div>
<div class="col-10">
<h4 class="mb-0 align-middle"> <?= $course['data']['name'] ;?></h4>
<?php
if(isset($course['data']['slogan']))
{
echo '
<div class="mt-1"><h6>
'.$course['data']['slogan'].'</h6>
</div>';
}
?>
</div>
</div>
<div class="container">
<div class="row">
<ul class="nav nav-pills mt-3 p-2 justify-content-center rounded-3" style="background-color: #f8f9fc !important;" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="description-tab" data-bs-toggle="tab" data-bs-target="#description" type="button" role="tab" aria-controls="home" aria-selected="true">Kursbeschreibung</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="data-tab" data-bs-toggle="tab" data-bs-target="#data" type="button" role="tab" aria-controls="profile" aria-selected="false">Kursdaten</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="description" role="tabpanel" aria-labelledby="description-tab">
<?php
echo '
<div class="mt-4">
'.$course['data']['description'].'
</div>';
?>
</div>
<div class="tab-pane fade" id="data" role="tabpanel" aria-labelledby="data-tab">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<b>Ort:</b>
</td>
<td>
<?= $course['data']['place'];?>
</td>
</tr>
<?php
if (
($category["data"]["registration"] == "custom" && $category["data"]["type"] == "year")
|| ($category["data"]["registration"] == "yes" && $category["data"]["confirmation"] == "yes" && $category["data"]["type"] == "year")
|| ($category["data"]["registration"] == "yes" && $category["data"]["confirmation"] == "custom" && $category["data"]["type"] == "year")
|| ($category["data"]["registration"] == "no")
) {
$teacherid = $course["data"]["teacherid_year"];
$teacher = getCourseTeacher($teacherid); ?>
<tr>
<td>
<b>Kursleiter/in:</b>
</td>
<td>
<?php echo $teacher; ?>
</td>
</tr>
<?php }
if (
($category["data"]["registration"] == "custom" && $category["data"]["type"] == "semester")
|| ($category["data"]["registration"] == "yes" && $category["data"]["confirmation"] == "yes" && $category["data"]["type"] == "semester")
|| ($category["data"]["registration"] == "yes" && $category["data"]["confirmation"] == "custom" && $category["data"]["type"] == "semester")
) {
$teacherid1sem = $course["data"]["teacherid_1sem"];
$teacher1sem = getCourseTeacher($teacherid1sem);
$teacherid2sem = $course["data"]["teacherid_2sem"];
$teacher2sem = getCourseTeacher($teacherid2sem);
?>
<tr>
<td>
<b>Kursleiter/in 1. Semester:</b>
</td>
<td>
<?php echo $teacher1sem; ?>
</td>
</tr>
<tr>
<td>
<b>Kursleiter/in 2. Semester:</b>
</td>
<td>
<?php echo $teacher2sem; ?>
</td>
</tr>
<?php }
?>
<tr>
<td>
<b>Zeiten:</b>
</td>
</tr>
<?php
$courseDates = getCourseDatesByCourseID($course['data']['id']);
if (!empty($courseDates)) {
$prevDay = ''; // Variable zur Speicherung des vorherigen Tages
foreach ($courseDates as $index => $courseDate) {
echo '<tr>';
if ($courseDate['day'] !== $prevDay) {
echo '<td>' . $courseDate['day'] . '</td>';
$prevDay = $courseDate['day'];
} else {
echo '<td></td>'; // Leerzelle für den Tag in den folgenden Zeilen desselben Tages
}
// Zeige die Zeit
echo '<td>' . $courseDate['start_time'] . ' Uhr - ' . $courseDate['end_time'] . ' Uhr</td>';
echo '</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
$category_id = $category['data']['id'];
$class_id = $studentInfos['data']['class'];
$deadline = getDeadline($category_id, $class_id);
if (strtotime($deadline) >= strtotime('today')) {
?>
<div class="text-center mt-4 mb-5">
<a href="register.php?id=<?= $category["data"]["id"] ?>" class="btn w-100 btn-secondary"> Weiter zur Anmeldung<i class="ti ti-arrow-right"></i></a>
</div>
<?php
}
else{
echo '
<div class="text-center mt-4 mb-5">
<button type="button" class="btn" disabled>Die Anmeldefrist ist abgelaufen</button>
</div>';
}
?>
</div>
</div>
<?php
}
include('includes/footer.php'); ?>