Lachenzelg/s/course.php
2025-01-07 03:02:25 +01:00

212 lines
9.2 KiB
PHP

<?php
require '../config/function.php';
include('./authentication.php');
$studentInfos = getStudentInformation($id);
$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']);
?>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scolify - Schule Lachenzelg</title>
<link rel="shortcut icon" type="image/png" href="../assets/images/logos/favicon.png" />
<link rel="stylesheet" href="../assets/css/register.css">
<link rel="stylesheet" href="../assets/css/styles.min.css" />
<link rel="stylesheet" href="../assets/css/transition.css" />
<style>
body, html {
margin: 0;
height: 100%;
}
.course-background {
background-image: url('<?php echo $course['data']['image']; ?>');
background-size: cover;
background-position: center;
height: 40vh; /* Verwende 50vh anstelle von 50% für die halbe Bildschirmhöhe */
position: relative;
}
.course-card-container {
position: relative;
top: -5vh; /* Stelle sicher, dass die Karte die unteren 10% überdeckt */
width: 90%;
margin: 0 auto;
}
.card {
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.td {
padding-left: 0px !important;
padding-right: 0px;
}
</style>
<script src="../assets/libs/jquery/dist/jquery.min.js"></script>
</head>
<body>
<div class="page-wrapper" id="main-wrapper" data-layout="vertical" data-navbarbg="skin6" data-sidebartype="full" data-sidebar-position="fixed" data-header-position="fixed">
<?php include('includes/sidebar.php'); ?>
<div class="body-wrapper">
<header class="app-header ps-0 pe-3">
<?php include('includes/navbar.php'); ?>
</header>
<div class="container-fluid p-0">
<div class="course-background"></div>
<div class="course-card-container mb-3">
<div class="card">
<div class="card-body">
<h1 class="card-title fw-bolder"><?php echo $course['data']['name']; ?></h1>
<?php
if(isset($course['data']['slogan']))
{
echo '
<div class="mt-1"><h6 class="fw-bolder">
'.$course['data']['slogan'].'</h6>
</div>';
}
?>
<p class="card-text"><?php echo $course['data']['description'];; ?></p>
<?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">
<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">
<button type="button" class="btn" disabled>Die Anmeldefrist ist abgelaufen</button>
</div>';
}
?>
<hr>
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td class="ps-0">
<b>Ort:</b>
</td>
<td class="ps-0">
<?= $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 class="ps-0">
<b>Kursleiter/in:</b>
</td>
<td class="ps-0">
<?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 class="ps-0">
<b>Kursleiter/in 1. Semester:</b>
</td>
<td class="ps-0">
<?php echo $teacher1sem; ?>
</td>
</tr>
<tr>
<td class="ps-0">
<b>Kursleiter/in 2. Semester:</b>
</td>
<td class="ps-0">
<?php echo $teacher2sem; ?>
</td>
</tr>
<?php }
?>
<tr>
<td class="ps-0">
<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 class="ps-0">' . $courseDate['day'] . '</td>';
$prevDay = $courseDate['day'];
} else {
echo '<td class="ps-0"></td>'; // Leerzelle für den Tag in den folgenden Zeilen desselben Tages
}
// Zeige die Zeit
echo '<td class="ps-0">' . $courseDate['start_time'] . ' Uhr - ' . $courseDate['end_time'] . ' Uhr</td>';
echo '</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
include('includes/footer.php'); ?>