fix parent and teacher pages to follow year filter
Tests / PHPUnit (push) Failing after 1m15s

This commit is contained in:
root
2026-07-15 20:03:36 -04:00
parent feb1b29a32
commit 5f27dccd0f
32 changed files with 582 additions and 364 deletions
+30 -8
View File
@@ -32,7 +32,9 @@
<?php
$classSectionId = (int)($class_section_id ?? 0);
$scoresLocked = !empty($scoresLocked);
$lockAttr = $scoresLocked ? 'disabled' : '';
$isSchoolYearReadonly = !empty($isSchoolYearReadonly);
$editingDisabled = $scoresLocked || $isSchoolYearReadonly;
$lockAttr = $editingDisabled ? 'disabled' : '';
$displayScore = static function ($value) {
return ($value === null || $value === '') ? '' : esc($value);
};
@@ -94,6 +96,11 @@
Scores are submitted and locked for this semester.
</div>
<?php endif; ?>
<?php if ($isSchoolYearReadonly): ?>
<div class="alert alert-info mt-3 mb-0">
This school year is read-only. You can view scores, but changes are disabled.
</div>
<?php endif; ?>
<div class="mt-3">
<a href="<?= base_url('/teacher/scores?choose_semester=1') ?>" class="btn btn-outline-secondary btn-sm">Choose another semester</a>
</div>
@@ -291,14 +298,29 @@
</div>
<div class="scores-action-bar d-flex flex-wrap gap-2 mt-3">
<a href="<?= base_url('/teacher/addHomework?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Homework</a>
<a href="<?= base_url('/teacher/addQuiz?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Quiz</a>
<a href="<?= base_url('/teacher/addProject?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Project</a>
<a href="<?= base_url('/teacher/addParticipation?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Participation</a>
<?php if ($isSchoolYearReadonly): ?>
<button type="button" class="btn btn-secondary" disabled>Add Homework</button>
<button type="button" class="btn btn-secondary" disabled>Add Quiz</button>
<button type="button" class="btn btn-secondary" disabled>Add Project</button>
<button type="button" class="btn btn-secondary" disabled>Add Participation</button>
<?php else: ?>
<a href="<?= base_url('/teacher/addHomework?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Homework</a>
<a href="<?= base_url('/teacher/addQuiz?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Quiz</a>
<a href="<?= base_url('/teacher/addProject?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Project</a>
<a href="<?= base_url('/teacher/addParticipation?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Participation</a>
<?php endif; ?>
<?php if ($semester === 'fall'): ?>
<a href="<?= base_url('/teacher/addMidtermExam?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Midterm</a>
<?php if ($isSchoolYearReadonly): ?>
<button type="button" class="btn btn-secondary" disabled>Add Midterm</button>
<?php else: ?>
<a href="<?= base_url('/teacher/addMidtermExam?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Midterm</a>
<?php endif; ?>
<?php elseif ($semester === 'spring'): ?>
<a href="<?= base_url('/teacher/addFinalExam?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Final</a>
<?php if ($isSchoolYearReadonly): ?>
<button type="button" class="btn btn-secondary" disabled>Add Final</button>
<?php else: ?>
<a href="<?= base_url('/teacher/addFinalExam?class_section_id=' . $classSectionId) ?>" class="btn btn-secondary">Add Final</a>
<?php endif; ?>
<?php endif; ?>
<button type="submit" class="btn btn-info" <?= $lockAttr ?>>Save Comments</button>
@@ -309,7 +331,7 @@
formaction="<?= base_url('/teacher/submit-scores-lock') ?>"
formmethod="post"
data-confirm-message="Once you submit, you cannot add any scores or comments. Do you want to continue?"
<?= $scoresLocked ? 'disabled' : '' ?>>
<?= $editingDisabled ? 'disabled' : '' ?>>
<?= $scoresLocked ? 'Scores Locked' : 'Submit Semester Scores' ?>
</button>
</div>