791 lines
38 KiB
PHP
791 lines
38 KiB
PHP
|
<?php include "includes/header.php"; ?>
|
||
|
<div>
|
||
|
<div class="card card-body p-4">
|
||
|
<?= alertMessage() ?>
|
||
|
<?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 = getById('tbl_categories',$course["data"]["category_id"]);
|
||
|
|
||
|
?>
|
||
|
<div class="row">
|
||
|
<div class="col-6">
|
||
|
<h3 class="fw-semibold mb-4"><?= $course['data']['name']; ?></h3>
|
||
|
</div>
|
||
|
<div class="col-6">
|
||
|
<a href="categories-edit.php?id=<?= $course["data"]["category_id"] ?>" class="btn btn-light float-end"> <i class="ti ti-arrow-left"></i> Zurück zur Kategorie</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
<form action="code.php" method="POST" enctype="multipart/form-data">
|
||
|
<input type="hidden" name="course_id" value="<?= $course["data"]['id'] ;?>" required>
|
||
|
<div class="row">
|
||
|
<div class="col-auto">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Name</label>
|
||
|
<input type="text" name="name" value="<?= $course['data']['name'] ;?>" required class="form-control">
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<?php
|
||
|
if ($category["data"]["registration"] == "custom") { ?>
|
||
|
<div class="col-auto">
|
||
|
<div class="mb-3">
|
||
|
<div class="form-group">
|
||
|
<label class="form-label">Benötigt der Kurs eine Anmeldung?</label>
|
||
|
<a tabindex="0" class="badge rounded-pill text-bg-info ms-2" role="button" data-bs-toggle="popover" data-bs-trigger="focus" data-bs-html="true" data-bs-content="Wenn <b>Ja</b> ausgewählt wird, wird bei diesem Kurs eine Anmeldung verlangt.</br> Wenn <b>Nein</b> ausgewählt wird, müssen sich Schüler:innen für diesen Kurs nicht anmelden.">?</i></a>
|
||
|
</div>
|
||
|
|
||
|
<div class="btn-group" role="group">
|
||
|
<input type="radio" class="btn-check" name="regbtnradio" id="registrationyes" value="registrationyes" autocomplete="off" <?= $course['data']['registration'] == 'yes' ? 'checked':'' ;?>>
|
||
|
<label class="btn btn-outline-info" for="registrationyes">Ja</label>
|
||
|
|
||
|
<input type="radio" class="btn-check" name="regbtnradio" id="registrationno" value="registrationno" autocomplete="off" <?= $course['data']['registration'] == 'no' ? 'checked':'' ;?>>
|
||
|
<label class="btn btn-outline-info" for="registrationno">Nein</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php }
|
||
|
if (
|
||
|
($category["data"]["registration"] == "custom" && $category["data"]["confirmation"] == "custom") || ($category["data"]["registration"] == "yes" && $category["data"]["confirmation"] == "custom")
|
||
|
) { ?>
|
||
|
<div class="col-auto" id="showconfirmation">
|
||
|
<div class="mb-3">
|
||
|
<div class="form-group">
|
||
|
<label class="form-label">Muss die Anmeldung bestätigt werden?</label>
|
||
|
<a tabindex="0" class="badge rounded-pill text-bg-info ms-2" role="button" data-bs-toggle="popover" data-bs-trigger="focus" data-bs-html="true" data-bs-content="Wenn <b>Ja</b> ausgewählt wird, haben Sie bei der Kurszuweisung die Möglichkeit, die Anmeldung anzunehmen oder abzulehnen.</br> Wenn <b>Nein</b> ausgewählt wird, ist die Anmeldung des/der Schüler:in ohne Ihre Interaktion definitiv.">?</a>
|
||
|
</div>
|
||
|
<div class="btn-group" role="group">
|
||
|
<input type="radio" class="btn-check" name="confbtnradio" id="confirmationyes" value="confirmationyes" autocomplete="off" <?= $course['data']['confirmation'] == 'yes' ? 'checked':'' ;?>>
|
||
|
<label class="btn btn-outline-info" for="confirmationyes">Ja</label>
|
||
|
|
||
|
<input type="radio" class="btn-check" name="confbtnradio" id="confirmationno" value="confirmationno" autocomplete="off" <?= $course['data']['confirmation'] == 'no' ? 'checked':'' ;?>>
|
||
|
<label class="btn btn-outline-info" for="confirmationno">Nein</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php }
|
||
|
if (
|
||
|
($category["data"]["registration"] == "no" && $category["data"]["showuntil_set"] == "custom") || ($category["data"]["registration"] == "custom")
|
||
|
) { ?>
|
||
|
<div class="col-auto" id="showuntil">
|
||
|
<div class="mb-3">
|
||
|
<div class="form-group">
|
||
|
<label class="form-label">Kurs anzeigen bis</label>
|
||
|
</div>
|
||
|
<div class="btn-group" role="group">
|
||
|
<input type="date" name="showuntil" class="form-control" value="<?= $course['data']['show_until'] ;?>">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php }
|
||
|
if (
|
||
|
(($category["data"]["registration"] == "yes" && $category["data"]["deadline_set"] == "custom") || ($category["data"]["registration"] == "custom"))
|
||
|
) { ?>
|
||
|
<div class="col-auto" id="showdeadline">
|
||
|
<div class="mb-3">
|
||
|
<div class="form-group">
|
||
|
<label class="form-label">Anmeldefrist </label>
|
||
|
</div>
|
||
|
<div class="btn-group" role="group">
|
||
|
<input type="date" name="deadline" class="form-control" value="<?= $course['data']['deadline'] ;?>">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php }
|
||
|
?>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col-3">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Slogan</label><i> (optional)</i>
|
||
|
<input type="text" name="slogan" class="form-control" value="<?= $course['data']['slogan'] ;?>">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-3">
|
||
|
<label for="courseImage" class="form-label">Kursbild ändern</label>
|
||
|
<input class="form-control" type="file" id="courseImage" name="courseImage" accept="image/*" value="<?= $course['data']['image'] ;?>">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Kursbeschreibung</label>
|
||
|
<textarea id="summernote" name="description" required class="form-control" ><?= $course['data']['description'] ;?></textarea>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col-auto">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Kursraum / Ort</label>
|
||
|
<input type="text" name="place" required class="form-control" value="<?= $course['data']['place'] ;?>">
|
||
|
</div>
|
||
|
</div>
|
||
|
<?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"] == "yes" && $category["data"]["confirmation"] == "no")
|
||
|
|| ($category["data"]["registration"] == "no")
|
||
|
) { ?>
|
||
|
<div class="col-auto">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Kursleiter:in</label>
|
||
|
<select name="teacheryear" required class="form-select">
|
||
|
<option value="">--- Auswählen ---</option>
|
||
|
<?php
|
||
|
$teacherOptions = getTeachers();
|
||
|
if ($teacherOptions) {
|
||
|
foreach ($teacherOptions as $teacher) {
|
||
|
$id = $teacher['id'];
|
||
|
$name = $teacher['name'];
|
||
|
echo '<option value="' . $id . '" ' . ($course['data']['teacherid_year'] == $id ? 'selected' : '') . '>' . $name . '</option>';
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?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")
|
||
|
) { ?>
|
||
|
<div class="col-auto">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Kursleiter:in 1. Semester</label>
|
||
|
<select name="teacher1sem" required class="form-select">
|
||
|
<option value="">--- Auswählen ---</option>
|
||
|
<?php
|
||
|
$teacherOptions = getTeachers();
|
||
|
if ($teacherOptions) {
|
||
|
foreach ($teacherOptions as $teacher) {
|
||
|
$id = $teacher['id'];
|
||
|
$name = $teacher['name'];
|
||
|
echo '<option value="' . $id . '" ' . ($course['data']['teacherid_1sem'] == $id ? 'selected' : '') . '>' . $name . '</option>';
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-auto">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Kursleiter:in 2. Semester</label>
|
||
|
<select name="teacher2sem" required class="form-select">
|
||
|
<option value="">--- Auswählen ---</option>
|
||
|
<?php
|
||
|
$teacherOptions = getTeachers();
|
||
|
if ($teacherOptions) {
|
||
|
foreach ($teacherOptions as $teacher) {
|
||
|
$id = $teacher['id'];
|
||
|
$name = $teacher['name'];
|
||
|
echo '<option value="' . $id . '" ' . ($course['data']['teacherid_2sem'] == $id ? 'selected' : '') . '>' . $name . '</option>';
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?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"] == "yes" && $category["data"]["confirmation"] == "no")
|
||
|
|
||
|
) {
|
||
|
?>
|
||
|
<div class="col-auto" id="minyear">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Min. Schüler:innen</label>
|
||
|
<input type="text" name="minstudentyear" value="<?= $course['data']['minstudents_year'] ;?>" onkeydown="if(!(event.key >= '0' && event.key <= '9') && event.key !== 'Backspace' && event.key !== 'Tab'){return false;}" class="form-control">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-auto" id="maxyear">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Max. Schüler:innen</label>
|
||
|
<input type="text" name="maxstudentyear" value="<?= $course['data']['maxstudents_year'] ;?>" onkeydown="if(!(event.key >= '0' && event.key <= '9') && event.key !== 'Backspace' && event.key !== 'Tab'){return false;}" class="form-control">
|
||
|
</div>
|
||
|
</div>
|
||
|
<?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")
|
||
|
) {
|
||
|
?>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col-auto" id="min1sem">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Min. Schüler:innen 1. Sem</label>
|
||
|
<input type="text" name="minstudent1sem" value="<?= $course['data']['minstudents_1sem'] ;?>" onkeydown="if(!(event.key >= '0' && event.key <= '9') && event.key !== 'Backspace' && event.key !== 'Tab'){return false;}" class="form-control">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-auto" id="max1sem">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Max. Schüler:innen 1. Sem</label>
|
||
|
<input type="text" name="maxstudent1sem" value="<?= $course['data']['maxstudents_1sem'] ;?>" onkeydown="if(!(event.key >= '0' && event.key <= '9') && event.key !== 'Backspace' && event.key !== 'Tab'){return false;}" class="form-control">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-auto" id="min2sem">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Min. Schüler:innen 2. Sem</label>
|
||
|
<input type="text" name="minstudent2sem" value="<?= $course['data']['minstudents_2sem'] ;?>" onkeydown="if(!(event.key >= '0' && event.key <= '9') && event.key !== 'Backspace' && event.key !== 'Tab'){return false;}" class="form-control">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-auto" id="max2sem">
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Max. Schüler:innen 2. Sem</label>
|
||
|
<input type="text" name="maxstudent2sem" value="<?= $course['data']['maxstudents_2sem'] ;?>" onkeydown="if(!(event.key >= '0' && event.key <= '9') && event.key !== 'Backspace' && event.key !== 'Tab'){return false;}" class="form-control">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php }
|
||
|
if (
|
||
|
($category["data"]["registration"] == "yes") || ($category["data"]["registration"] == "custom")
|
||
|
) {
|
||
|
?>
|
||
|
<div class="row">
|
||
|
<div class="col-auto" id="maxbehavior">
|
||
|
<div class="mb-3">
|
||
|
<div class="form-group">
|
||
|
<label class="form-label">Wenn Höchstanzahl der Anmeldungen erreicht ist</label>
|
||
|
</div>
|
||
|
<div class="btn-group" role="group">
|
||
|
<input type="radio" class="btn-check" name="maxbtnradio" id="hidecourse" value="hidecourse" autocomplete="off" <?= $course['data']['max_behavior'] == 'hide' ? 'checked':'' ;?>>
|
||
|
<label class="btn btn-outline-info" for="hidecourse">Kurs ausblenden</label>
|
||
|
|
||
|
<input type="radio" class="btn-check" name="maxbtnradio" id="showcourse" value="showcourse" autocomplete="off" <?= $course['data']['max_behavior'] == 'show' ? 'checked':'' ;?>>
|
||
|
<label class="btn btn-outline-info" for="showcourse">Weitere Anmeldungen zulassen</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php }
|
||
|
?>
|
||
|
|
||
|
</div>
|
||
|
<div class="row mt-3 mb-4">
|
||
|
<h5 class='fw-semibold mb-4 mt-3'>Kursdaten</h5>
|
||
|
<?php $courseDates = getCourseDatesByCourseID($course['data']['id']);
|
||
|
|
||
|
if (!empty($courseDates)) {
|
||
|
echo '
|
||
|
<div id="time-input-container">
|
||
|
';
|
||
|
// Iteriere über jede Zeile der Kurszeiten
|
||
|
foreach ($courseDates as $courseDate) {
|
||
|
// Holen der Daten für den aktuellen Kurszeitpunkt
|
||
|
$day = $courseDate['day'];
|
||
|
$startTime = $courseDate['start_time'];
|
||
|
$endTime = $courseDate['end_time'];
|
||
|
|
||
|
// Hier kannst du den HTML-Code generieren, um die Werte in die UI einzufügen
|
||
|
// Beispiel:
|
||
|
echo '
|
||
|
<div class="row mb-3 align-items-center time-input">
|
||
|
<div class="col-md-3">
|
||
|
<select name="days[]" class="form-select">
|
||
|
<option value="' . $day . '" selected>' . $day . '</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="start_times[]" class="form-control" value="' . $startTime . '">
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="end_times[]" class="form-control" value="' . $endTime . '">
|
||
|
</div>
|
||
|
<div class="col-md-1">
|
||
|
<button type="button" class="btn btn-sm btn-success" onclick="addTimeInput(this)">+</button>
|
||
|
<button type="button" class="btn btn-sm btn-danger" onclick="removeTimeInput(this)">-</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
';
|
||
|
}
|
||
|
echo '
|
||
|
|
||
|
</div>
|
||
|
<div class="mb-3">
|
||
|
<button type="button" class="btn btn-outline-info" onclick="addDayInput()">Tag hinzufügen</button>
|
||
|
</div>';
|
||
|
} else {
|
||
|
?>
|
||
|
<div id="time-input-container">
|
||
|
<div class="row mb-3 align-items-center time-input">
|
||
|
<div class="col-md-3">
|
||
|
<select name="days[]" class="form-select">
|
||
|
<option value="Montag">Montag</option>
|
||
|
<option value="Dienstag">Dienstag</option>
|
||
|
<option value="Mittwoch">Mittwoch</option>
|
||
|
<option value="Donnerstag">Donnerstag</option>
|
||
|
<option value="Freitag">Freitag</option>
|
||
|
<option value="Samstag">Samstag</option>
|
||
|
<option value="Sonntag">Sonntag</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="start_times[]" class="form-control">
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="end_times[]" class="form-control">
|
||
|
</div>
|
||
|
<div class="col-md-1">
|
||
|
<button type="button" class="btn btn-sm btn-success" onclick="addTimeInput(this)">+</button>
|
||
|
<button type="button" class="btn btn-sm btn-danger" onclick="removeTimeInput(this)">-</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="mb-3">
|
||
|
<button type="button" class="btn btn-outline-info" onclick="addDayInput()">Tag hinzufügen</button>
|
||
|
</div>
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
$classesCategory = getClassesPerCategory($category["data"]["id"]);
|
||
|
echo "<h5 class='fw-semibold mb-4 mt-3'>Klassenzuweisung</h5>";
|
||
|
echo "<div class='row'>";
|
||
|
$assignedClasses = getAssignedItems('tbl_assign_courses_classes', $course['data']['id'], 'class_id', 'course_id');
|
||
|
|
||
|
if (!empty($classesCategory)) {
|
||
|
|
||
|
$groupedClasses = array();
|
||
|
|
||
|
foreach ($classesCategory as $class) {
|
||
|
$level = $class['sek'];
|
||
|
$groupedClasses[$level][] = $class;
|
||
|
}
|
||
|
|
||
|
foreach ($groupedClasses as $level => $levelClasses) {
|
||
|
echo "<div class='col'>";
|
||
|
echo "<div class='card' style='border-radius:10px;'>";
|
||
|
echo "<div class='card-header fw-semibold bg-info-subtle'>";
|
||
|
echo "$level";
|
||
|
echo "</div>";
|
||
|
|
||
|
// Checkbox für "Alle Auswählen"
|
||
|
$idSafeLevel = str_replace(['.', ' '], '_', $level);
|
||
|
$idSafeLevel = preg_replace('/[^A-Za-z0-9_]/', '', $idSafeLevel);
|
||
|
echo "<div class='form-check ms-3 mt-2 mb-3'>";
|
||
|
echo "<input class='form-check-input' type='checkbox' id='select-all_$idSafeLevel' data-toggle='select-all' data-level='$level'>";
|
||
|
echo "<label class='form-check-label' for='select-all_$idSafeLevel' style='user-select: none; -webkit-user-select: none; -ms-user-select: none;' for=''>Alle auswählen</label>";
|
||
|
echo "</div>";
|
||
|
|
||
|
foreach ($levelClasses as $class) {
|
||
|
$classId = $class['id'];
|
||
|
$className = htmlspecialchars($class['classDisplayName']);
|
||
|
$isChecked = in_array($classId, $assignedClasses) ? 'checked' : '';
|
||
|
|
||
|
echo "<div class='form-check ms-3 mt-2 mb-3'>";
|
||
|
echo "<input class='form-check-input' type='checkbox' name='selected_classes[]' id='class_$classId' data-class-id='$level' value='$classId' $isChecked>";
|
||
|
echo "<label class='form-check-label' style='user-select: none; -webkit-user-select: none; -ms-user-select: none;' for='class_$classId'>$className</label>";
|
||
|
echo "</div>";
|
||
|
}
|
||
|
|
||
|
echo "</div>";
|
||
|
echo "</div>";
|
||
|
}
|
||
|
|
||
|
echo "</div>";
|
||
|
} else {
|
||
|
echo "<h6>Dieser Kategorie sind keine Klassen zugewiesen.</h6>";
|
||
|
}
|
||
|
?>
|
||
|
</form>
|
||
|
<div class="col-12">
|
||
|
<button type="submit" name="updatecourse" class="btn btn-info mx-3 float-end"><i class="ti ti-check me-1"></i>Änderungen speichern</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="card card-body p-4" id="additionalSettings">
|
||
|
<div class="row">
|
||
|
<div class="col-6">
|
||
|
<h5 class="fw-semibold mb-4">Anmeldungen</h5>
|
||
|
</div>
|
||
|
<div class="col-6 text-end">
|
||
|
<button onclick="exportTableToExcel('tblData', 'Scolify - Kursanmeldungen <?= $course['data']['name']; ?> - <?= $category['data']['name']; ?>')" class="btn btn-success"><i class="ti ti-table me-2"></i>Export</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="table-responsive">
|
||
|
<table id="tblData" class="table table-hover">
|
||
|
<?php
|
||
|
$course_id = $course['data']['id'];
|
||
|
$students = getAll('student_id,status', 'tbl_assign_students_courses', "WHERE course_id='$course_id'");
|
||
|
|
||
|
if(mysqli_num_rows($students) > 0)
|
||
|
{
|
||
|
?>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th style="cursor: pointer;" onclick="sortTable(0)">Vorname</th>
|
||
|
<th style="cursor: pointer;" onclick="sortTable(1)">Nachname</th>
|
||
|
<th style="cursor: pointer;" onclick="sortTable(2)">Benutzer-ID</th>
|
||
|
<th style="cursor: pointer;" onclick="sortTable(3)">Klasse</th>
|
||
|
<th style="cursor: pointer;" onclick="sortTable(5)">Status</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<?php
|
||
|
foreach($students as $studentEntry)
|
||
|
{
|
||
|
$studentInfo = getStudentInformation($studentEntry['student_id']);
|
||
|
|
||
|
if((($studentEntry['status'] == "Angemeldet") && ($category['data']['confirmation'] == "yes"))
|
||
|
|| (($studentEntry['status'] == "Angemeldet") && ($category['data']['confirmation'] == "custom") && ($course['data']['confirmation'] == "yes"))
|
||
|
) {
|
||
|
$statusText = "Angemeldet, warte auf Genehmigung...";
|
||
|
$statusColour = "secondary";
|
||
|
}
|
||
|
elseif($studentEntry['status'] == "Abgelehnt"){
|
||
|
$statusText = "Abgelehnt";
|
||
|
$statusColour = "danger";
|
||
|
}
|
||
|
else{
|
||
|
$statusText = "Angemeldet";
|
||
|
$statusColour = "success";
|
||
|
}
|
||
|
?>
|
||
|
<tr>
|
||
|
<td><?= $studentInfo['data']['firstname']; ?></td>
|
||
|
<td><?= $studentInfo['data']['lastname']; ?></td>
|
||
|
<td><?= $studentInfo['data']['userid']; ?></td>
|
||
|
<td><?= $studentInfo['data']['classDisplayName']; ?></td>
|
||
|
<td><span class="badge rounded-pill text-bg-<?= $statusColour ?>"><?= $statusText ?></span></td>
|
||
|
|
||
|
</tr>
|
||
|
<?php
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
?>
|
||
|
<tr>
|
||
|
<td colspan="7"> Keine Anmeldungen vorhanden</td>
|
||
|
</tr>
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
} else {
|
||
|
echo '<div class="alert alert-danger" role="alert">' .
|
||
|
$course["message"] .
|
||
|
"</div>";
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
|
||
|
<script>
|
||
|
// Funktion zum Hinzufügen einer neuen Zeitzeile
|
||
|
window.onload = function() {
|
||
|
updateDaySelects();
|
||
|
};
|
||
|
function addTimeInput(button) {
|
||
|
const container = button.closest('.time-input');
|
||
|
const newTimeInput = document.createElement('div');
|
||
|
newTimeInput.className = 'row mb-3 align-items-center time-input';
|
||
|
newTimeInput.innerHTML = `
|
||
|
<div class="col-md-3">
|
||
|
<select name="days[]" class="form-select">
|
||
|
<option value="${container.querySelector('select').value}">${container.querySelector('select').value}</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="start_times[]" class="form-control">
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="end_times[]" class="form-control">
|
||
|
</div>
|
||
|
<div class="col-md-1">
|
||
|
<button type="button" class="btn btn-success btn-sm" onclick="addTimeInput(this)">+</button>
|
||
|
<button type="button" class="btn btn-danger btn-sm" onclick="removeTimeInput(this)">-</button>
|
||
|
</div>
|
||
|
`;
|
||
|
container.parentNode.insertBefore(newTimeInput, container.nextSibling);
|
||
|
updateDaySelects(); // Aktualisiert die Anzeige der Wochentage
|
||
|
}
|
||
|
|
||
|
// Funktion zum Entfernen einer Zeitzeile
|
||
|
function removeTimeInput(button) {
|
||
|
const container = button.closest('.time-input');
|
||
|
container.remove();
|
||
|
updateDaySelects(); // Aktualisiert die Anzeige der Wochentage
|
||
|
}
|
||
|
|
||
|
// Funktion zum Aktualisieren der Anzeige der Wochentage
|
||
|
function updateDaySelects() {
|
||
|
const daySelects = document.querySelectorAll('.time-input select[name="days[]"]');
|
||
|
let currentDay = '';
|
||
|
daySelects.forEach(select => {
|
||
|
const value = select.value;
|
||
|
if (value !== currentDay) {
|
||
|
currentDay = value;
|
||
|
select.style.display = ''; // Zeigt den Wochentag an, wenn er der erste in der Gruppe ist
|
||
|
} else {
|
||
|
select.style.display = 'none'; // Versteckt den Wochentag, wenn er nicht der erste in der Gruppe ist
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// Funktion zum Hinzufügen eines neuen Wochentages
|
||
|
function addDayInput() {
|
||
|
const container = document.getElementById('time-input-container');
|
||
|
const days = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
|
||
|
const existingDays = Array.from(document.querySelectorAll('select[name="days[]"]')).map(select => select.value);
|
||
|
const remainingDays = days.filter(day => !existingDays.includes(day));
|
||
|
|
||
|
const newTimeInput = document.createElement('div');
|
||
|
newTimeInput.className = 'row mb-3 align-items-center time-input';
|
||
|
newTimeInput.innerHTML = `
|
||
|
<div class="col-md-3">
|
||
|
<select name="days[]" class="form-select">
|
||
|
${remainingDays.map(day => `<option value="${day}">${day}</option>`).join('')}
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="start_times[]" class="form-control">
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<input type="time" name="end_times[]" class="form-control">
|
||
|
</div>
|
||
|
<div class="col-md-1">
|
||
|
<button type="button" class="btn btn-success btn-sm" onclick="addTimeInput(this)">+</button>
|
||
|
<button type="button" class="btn btn-danger btn-sm" onclick="removeTimeInput(this)">-</button>
|
||
|
</div>
|
||
|
`;
|
||
|
container.appendChild(newTimeInput);
|
||
|
updateDaySelects(); // Aktualisiert die Anzeige der Wochentage
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<script>
|
||
|
// Funktion zum Überwachen von Änderungen in den Textfeldern
|
||
|
function checkMinMaxCourses() {
|
||
|
// Wert von min_courses und max_courses holen
|
||
|
var minStudentsYearField = document.getElementsByName("minstudentyear");
|
||
|
var maxStudentsYearField = document.getElementsByName("maxstudentyear");
|
||
|
var minStudents1SemField = document.getElementsByName("minstudent1sem");
|
||
|
var maxStudents1SemField = document.getElementsByName("maxstudent1sem");
|
||
|
var minStudents2SemField = document.getElementsByName("minstudent2sem");
|
||
|
var maxStudents2SemField = document.getElementsByName("maxstudent2sem");
|
||
|
|
||
|
// Überprüfen und Anpassen der Werte
|
||
|
if (minStudentsYearField.length > 0 && maxStudentsYearField.length > 0) {
|
||
|
var minStudentsYearValue = parseInt(minStudentsYearField[0].value);
|
||
|
var maxStudentsYearValue = parseInt(maxStudentsYearField[0].value);
|
||
|
|
||
|
if (!isNaN(minStudentsYearValue) && !isNaN(maxStudentsYearValue)) {
|
||
|
if (minStudentsYearValue > maxStudentsYearValue) {
|
||
|
// Wenn min_courses größer ist als max_courses, setze max_courses auf den Wert von min_courses
|
||
|
maxStudentsYearField[0].value = minStudentsYearValue;
|
||
|
} else if (maxStudentsYearValue < minStudentsYearValue) {
|
||
|
// Wenn max_courses kleiner ist als min_courses, setze min_courses auf den Wert von max_courses
|
||
|
minStudentsYearField[0].value = maxStudentsYearValue;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (minStudents1SemField.length > 0 && maxStudents1SemField.length > 0) {
|
||
|
var minStudents1SemValue = parseInt(minStudents1SemField[0].value);
|
||
|
var maxStudents1SemValue = parseInt(maxStudents1SemField[0].value);
|
||
|
|
||
|
if (!isNaN(minStudents1SemValue) && !isNaN(maxStudents1SemValue)) {
|
||
|
if (minStudents1SemValue > maxStudents1SemValue) {
|
||
|
// Wenn min_courses größer ist als max_courses, setze max_courses auf den Wert von min_courses
|
||
|
maxStudents1SemField[0].value = minStudents1SemValue;
|
||
|
} else if (maxStudents1SemValue < minStudents1SemValue) {
|
||
|
// Wenn max_courses kleiner ist als min_courses, setze min_courses auf den Wert von max_courses
|
||
|
minStudents1SemField[0].value = maxStudents1SemValue;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (minStudents2SemField.length > 0 && maxStudents2SemField.length > 0) {
|
||
|
var minStudents2SemValue = parseInt(minStudents2SemField[0].value);
|
||
|
var maxStudents2SemValue = parseInt(maxStudents2SemField[0].value);
|
||
|
|
||
|
if (!isNaN(minStudents2SemValue) && !isNaN(maxStudents2SemValue)) {
|
||
|
if (minStudents2SemValue > maxStudents2SemValue) {
|
||
|
// Wenn min_courses größer ist als max_courses, setze max_courses auf den Wert von min_courses
|
||
|
maxStudents2SemField[0].value = minStudents2SemValue;
|
||
|
} else if (maxStudents2SemValue < minStudents2SemValue) {
|
||
|
// Wenn max_courses kleiner ist als min_courses, setze min_courses auf den Wert von max_courses
|
||
|
minStudents2SemField[0].value = maxStudents2SemValue;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Analog für die anderen Felder
|
||
|
};
|
||
|
|
||
|
// Event-Listener hinzufügen
|
||
|
document.addEventListener("DOMContentLoaded", function() {
|
||
|
if (document.getElementsByName("minstudentyear").length > 0) {
|
||
|
document.getElementsByName("minstudentyear")[0].addEventListener("input", checkMinMaxCourses);
|
||
|
}
|
||
|
if (document.getElementsByName("maxstudentyear").length > 0) {
|
||
|
document.getElementsByName("maxstudentyear")[0].addEventListener("input", checkMinMaxCourses);
|
||
|
}
|
||
|
if (document.getElementsByName("minstudent1sem").length > 0) {
|
||
|
document.getElementsByName("minstudent1sem")[0].addEventListener("input", checkMinMaxCourses);
|
||
|
}
|
||
|
if (document.getElementsByName("maxstudent1sem").length > 0) {
|
||
|
document.getElementsByName("maxstudent1sem")[0].addEventListener("input", checkMinMaxCourses);
|
||
|
}
|
||
|
if (document.getElementsByName("minstudent2sem").length > 0) {
|
||
|
document.getElementsByName("minstudent2sem")[0].addEventListener("input", checkMinMaxCourses);
|
||
|
}
|
||
|
if (document.getElementsByName("maxstudent2sem").length > 0) {
|
||
|
document.getElementsByName("maxstudent2sem")[0].addEventListener("input", checkMinMaxCourses);
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<script>
|
||
|
// Funktion zum Aktualisieren des Anzeigezustands
|
||
|
function updateDisplay() {
|
||
|
if ($("#registrationno").is(":checked")) {
|
||
|
$("#showuntil").show();
|
||
|
$("#showconfirmation").hide();
|
||
|
$("#showdeadline").hide();
|
||
|
$("#maxbehavior").hide();
|
||
|
$("#minyear").hide();
|
||
|
$("#maxyear").hide();
|
||
|
$("#min1sem").hide();
|
||
|
$("#min2sem").hide();
|
||
|
$("#max1sem").hide();
|
||
|
$("#max2sem").hide();
|
||
|
|
||
|
} else {
|
||
|
$("#showconfirmation").show();
|
||
|
$("#showdeadline").show();
|
||
|
$("#showuntil").hide();
|
||
|
$("#maxbehavior").show();
|
||
|
$("#minyear").show();
|
||
|
$("#maxyear").show();
|
||
|
$("#min1sem").show();
|
||
|
$("#min2sem").show();
|
||
|
$("#max1sem").show();
|
||
|
$("#max2sem").show();
|
||
|
}
|
||
|
|
||
|
if ($("#registrationyes").is(":checked")) {
|
||
|
$("#showuntil").hide();
|
||
|
} else {
|
||
|
$("#showuntil").show();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$(document).ready(function(){
|
||
|
// Setze den Anfangszustand beim Laden der Seite
|
||
|
updateDisplay();
|
||
|
|
||
|
// Überwache Änderungen am Radiobutton
|
||
|
$('input[name="regbtnradio"]').change(function(){
|
||
|
updateDisplay();
|
||
|
});
|
||
|
$('input[name="confbtnradio"]').change(function(){
|
||
|
updateDisplay();
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<script>
|
||
|
$(document).ready(function() {
|
||
|
// Überwache Änderungen an den Klassen-Checkboxen
|
||
|
$('input[name="selected_classes[]"]').change(function() {
|
||
|
updateSelectAllCheckbox($(this).data('class-id'));
|
||
|
});
|
||
|
|
||
|
// Überwache Änderungen an den "Alle auswählen"-Checkboxen
|
||
|
$('input[type="checkbox"][data-toggle="select-all"]').change(function() {
|
||
|
var level = $(this).data('level');
|
||
|
var isChecked = $(this).prop('checked');
|
||
|
$('input[name="selected_classes[]"][data-class-id="' + level + '"]').prop('checked', isChecked);
|
||
|
});
|
||
|
|
||
|
// Initialisiere den Status der "Alle auswählen"-Checkboxen beim Laden der Seite
|
||
|
$('input[data-toggle="select-all"]').each(function() {
|
||
|
updateSelectAllCheckbox($(this).data('level'));
|
||
|
});
|
||
|
});
|
||
|
|
||
|
// Funktion zum Aktualisieren des Status der "Alle auswählen"-Checkboxen
|
||
|
function updateSelectAllCheckbox(level) {
|
||
|
var classCheckboxes = $('input[name="selected_classes[]"][data-class-id="' + level + '"]');
|
||
|
var selectAllCheckbox = $('input[data-toggle="select-all"][data-level="' + level + '"]');
|
||
|
|
||
|
var allChecked = true;
|
||
|
var anyChecked = false;
|
||
|
|
||
|
classCheckboxes.each(function() {
|
||
|
if (!$(this).prop('checked')) {
|
||
|
allChecked = false;
|
||
|
} else {
|
||
|
anyChecked = true;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
selectAllCheckbox.prop('checked', allChecked);
|
||
|
selectAllCheckbox.prop('indeterminate', anyChecked && !allChecked);
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<script>
|
||
|
function exportTableToExcel(tableID, filename = ''){
|
||
|
var downloadLink;
|
||
|
var dataType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
||
|
var tableSelect = document.getElementById(tableID);
|
||
|
var tableHTML = tableSelect.outerHTML.replace(/ /g, '%20');
|
||
|
|
||
|
filename = filename?filename+'.xlsx':'excel_data.xlsx';
|
||
|
|
||
|
downloadLink = document.createElement("a");
|
||
|
|
||
|
document.body.appendChild(downloadLink);
|
||
|
|
||
|
var workbook = XLSX.utils.table_to_book(tableSelect, {sheet: "Sheet1"});
|
||
|
var excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
|
||
|
var data = new Blob([excelBuffer], {type: dataType});
|
||
|
|
||
|
var url = URL.createObjectURL(data);
|
||
|
downloadLink.href = url;
|
||
|
downloadLink.download = filename;
|
||
|
|
||
|
downloadLink.click();
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
|
||
|
<?php include "includes/footer.php"; ?>
|