fix parent pages to adopt the school year logic
Tests / PHPUnit (push) Successful in 1m20s

This commit is contained in:
root
2026-07-17 00:02:53 -04:00
parent a5517b516a
commit 539d0eb220
12 changed files with 258 additions and 51 deletions
+10 -2
View File
@@ -17,6 +17,13 @@
<?php
$query = service('request')->getUri()->getQuery();
$returnTo = current_url() . ($query !== '' ? '?' . $query : '');
$activeSchoolYearId = null;
foreach ($schoolYearOptions as $year) {
if (strtolower((string) ($year['status'] ?? '')) === 'active') {
$activeSchoolYearId = (int) ($year['id'] ?? 0);
break;
}
}
?>
<div class="school-year-context-bar border-bottom bg-light py-2">
<div class="container-fluid px-3">
@@ -55,10 +62,11 @@
<span class="text-muted small"><?= esc($schoolYearContext->yearName()) ?></span>
</form>
<?php if ($schoolYearContext->isExplicitSelection()): ?>
<form method="post" action="<?= site_url('school-year/reset') ?>" class="d-inline-block mt-2 mt-sm-0 ms-sm-2">
<?php if ($schoolYearContext->isExplicitSelection() && $activeSchoolYearId !== null): ?>
<form method="post" action="<?= site_url('school-year/select') ?>" class="d-inline-block mt-2 mt-sm-0 ms-sm-2">
<?= csrf_field() ?>
<input type="hidden" name="return_to" value="<?= esc($returnTo) ?>">
<input type="hidden" name="school_year_id" value="<?= (int) $activeSchoolYearId ?>">
<button type="submit" class="btn btn-outline-secondary btn-sm">
Active year
</button>