74 lines
3.1 KiB
PHP
74 lines
3.1 KiB
PHP
<?php include('includes/header.php'); ?>
|
|
<div>
|
|
<?php
|
|
$paramResult = checkParamId('id');
|
|
if(!is_numeric($paramResult)){
|
|
echo '<div class="alert alert-danger" role="alert">'.$paramResult.'</div>';
|
|
return false;
|
|
}
|
|
|
|
$category = getById('tbl_categories',checkParamId('id'));
|
|
if($category['status'] == 200)
|
|
{
|
|
?>
|
|
<div class="card card-body p-4">
|
|
<?= alertMessage(); ?>
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<h3 class="fw-semibold mb-4">Statistik nach Kurs zu <?=$category['data']['name'] ;?> </h3>
|
|
</div>
|
|
<div class="col-4">
|
|
<a href="categories-edit.php?id=<?=$category['data']['id'] ;?>" class="btn btn-light float-end"> <i class="ti ti-arrow-left"></i> Zurück zur Übersicht</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-hover" id="sortTable">
|
|
<thead>
|
|
<tr>
|
|
<th style="cursor: pointer;" onclick="sortTable(0)">Kursname</th>
|
|
<th style="cursor: pointer;" onclick="sortTable(1)">Anzahl der Schüler</th>
|
|
<th style="cursor: pointer;" onclick="sortTable(2)">Angemeldet</th>
|
|
<th style="cursor: pointer;" onclick="sortTable(3)">Genehmigt</th>
|
|
<th style="cursor: pointer;" onclick="sortTable(4)">Abgelehnt</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$category_id = $category['data']['id'];
|
|
$courses = getAll('id,name', 'tbl_courses', "WHERE category_id='$category_id'");
|
|
|
|
if(mysqli_num_rows($courses) > 0) {
|
|
foreach($courses as $courseEntry) {
|
|
$studentCount = countAllStudentsInCourse($courseEntry['id']);
|
|
$registeredCount = countStudentsByStatus($courseEntry['id'], 'Angemeldet');
|
|
$selectedCount = countStudentsByStatus($courseEntry['id'], 'Genehmigt');
|
|
$rejectedCount = countStudentsByStatus($courseEntry['id'], 'Abgelehnt');
|
|
?>
|
|
<tr>
|
|
<td><?= $courseEntry['name']; ?></td>
|
|
<td><?= $studentCount; ?></td>
|
|
<td><?= $registeredCount; ?></td>
|
|
<td><?= $selectedCount; ?></td>
|
|
<td><?= $rejectedCount; ?></td>
|
|
<td>
|
|
<a href="courses-edit.php?id=<?= $courseEntry['id']; ?>" class="btn btn-light btn-sm float-end mx-1"> <i class="ti ti-pencil"></i></a>
|
|
</td>
|
|
</tr>
|
|
<?php }
|
|
}
|
|
} else {
|
|
?>
|
|
<tr>
|
|
<td colspan="7">Keine Kurse vorhanden</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php include('includes/footer.php'); ?>
|