Files
alrahma_sunday_school/app/Views/winners/competitions/show.php
T
root feb1b29a32
Tests / PHPUnit (push) Failing after 1m19s
apply the school year concept
2026-07-14 00:59:00 -04:00

47 lines
1.7 KiB
PHP

<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container mt-4">
<a href="/winners/competitions" class="btn btn-outline-secondary btn-sm mb-3">&larr; Back</a>
<h3><?= esc($competition['title']) ?></h3>
<div class="text-muted mb-3">
Published: <?= esc($competition['published_at'] ?? '') ?>
<?php if (!empty($schoolYear)): ?>
<span class="ms-2">School Year: <?= esc($schoolYear) ?></span>
<?php endif; ?>
</div>
<?php if (empty($winnersByClass)): ?>
<div class="alert alert-info">No winners found.</div>
<?php else: ?>
<?php foreach ($winnersByClass as $classId => $rows): ?>
<?php
$classLabel = $sectionMap[$classId] ?? ('Class ' . $classId);
$questions = $questionCounts[$classId] ?? null;
?>
<h5 class="mt-4"><?= esc($classLabel) ?></h5>
<?php if ($questions !== null): ?>
<div class="text-muted mb-2">Questions: <?= esc($questions) ?></div>
<?php endif; ?>
<table class="table table-bordered" data-no-mgmt-sticky>
<thead class="table-light">
<tr><th style="width:90px;">Rank</th><th>Student</th><th style="width:140px;">Score</th><th style="width:160px;">Prize</th></tr>
</thead>
<tbody>
<?php foreach ($rows as $w): ?>
<tr>
<td><?= esc($w['rank']) ?></td>
<td><?= esc($w['name']) ?></td>
<td><?= esc($w['score']) ?></td>
<td><?= esc(!empty($w['prize_amount']) ? $w['prize_amount'] : '-') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?= $this->endSection() ?>