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
@@ -4,30 +4,6 @@
<div class="wrapper">
<div class="content"></div>
<h2 class="text-center mt-4 mb-3">Classes Lists</h2>
<form method="get" class="row g-2 align-items-center justify-content-center mb-3">
<div class="col-auto">
<label class="form-label mb-0">School year</label>
</div>
<div class="col-auto">
<select name="school_year" class="form-select form-select-sm" style="min-width: 200px;">
<?php if (!empty($schoolYears)): ?>
<?php foreach ($schoolYears as $yearOption): ?>
<option value="<?= esc($yearOption) ?>" <?= ($selectedYear === $yearOption ? 'selected' : '') ?>>
<?= esc($yearOption) ?>
</option>
<?php endforeach; ?>
<?php else: ?>
<option value="<?= esc($schoolYear ?? '') ?>" <?= ($selectedYear === ($schoolYear ?? '') ? 'selected' : '') ?>>
<?= esc($schoolYear ?? 'Current') ?>
</option>
<?php endif; ?>
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-secondary btn-sm">Apply</button>
<a class="btn btn-outline-secondary btn-sm" href="<?= base_url('administrator/class_assignment') ?>">Reset</a>
</div>
</form>
<?php if (session()->getFlashdata('message')): ?>
<div class="alert alert-success">
+1 -42
View File
@@ -19,47 +19,6 @@ if (empty($schoolYears) && $schoolYear !== '') {
<div class="wrapper below-sixty-wrapper">
<h2 class="text-center mt-4 mb-4 below-sixty-title">Below 60 Summary</h2>
<!-- School year filter only -->
<div class="card shadow-sm mb-3">
<div class="card-body py-3">
<form method="get"
action="<?= site_url('grading/below-60') ?>"
class="row g-2 align-items-end justify-content-center">
<input type="hidden" name="semester" value="fall">
<div class="col-12 col-sm-auto">
<label class="form-label mb-1 small fw-semibold">School Year</label>
<?php if (!empty($schoolYears)): ?>
<select name="school_year"
class="form-select form-select-sm"
style="min-width:160px;">
<?php foreach ($schoolYears as $yr): ?>
<option value="<?= esc($yr) ?>" <?= (string)$yr === (string)$schoolYear ? 'selected' : '' ?>>
<?= esc($yr) ?>
</option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="text"
name="school_year"
class="form-control form-control-sm"
style="min-width:160px;"
value="<?= esc($schoolYear) ?>"
placeholder="2025-2026">
<?php endif; ?>
</div>
<div class="col-12 col-sm-auto">
<button type="submit" class="btn btn-sm btn-primary">
<i class="bi bi-funnel me-1"></i>Apply
</button>
</div>
</form>
</div>
</div>
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<div class="text-muted">
Fall • <?= esc($schoolYear) ?>
@@ -478,4 +437,4 @@ if (empty($schoolYears) && $schoolYear !== '') {
}
})();
</script>
<?= $this->endSection() ?>
<?= $this->endSection() ?>
+14 -1
View File
@@ -23,7 +23,20 @@
<body>
<!-- Navbar -->
<?php include(__DIR__ . '/../partials/navbar.php'); ?>
<?= view('partials/school_year_selector') ?>
<?php
$mainSchoolYearSelectorData = [];
if (!isset($schoolYearContext, $schoolYearOptions) && session()->get('user_id')) {
try {
$mainSchoolYearSelectorData = service('schoolYearViewData')->forCurrentRequest(service('request'));
$mainSchoolYearSelectorData['schoolYearSelectorEnabled'] = true;
} catch (\Throwable $e) {
log_message('warning', 'Unable to load main school-year selector: {message}', [
'message' => $e->getMessage(),
]);
}
}
?>
<?= view('partials/school_year_selector', $mainSchoolYearSelectorData) ?>
<div class="container my-4">
<?= $this->renderSection('content') ?>
+14 -1
View File
@@ -165,7 +165,20 @@ html, body { overflow-x: hidden; }
<body data-app-menu-mode="<?= esc($appMenuMode) ?>">
<?php include(__DIR__ . '/../partials/navbar.php'); ?>
<?= view('partials/school_year_selector') ?>
<?php
$mainSchoolYearSelectorData = [];
if (!isset($schoolYearContext, $schoolYearOptions) && session()->get('user_id')) {
try {
$mainSchoolYearSelectorData = service('schoolYearViewData')->forCurrentRequest(service('request'));
$mainSchoolYearSelectorData['schoolYearSelectorEnabled'] = true;
} catch (\Throwable $e) {
log_message('warning', 'Unable to load main school-year selector: {message}', [
'message' => $e->getMessage(),
]);
}
}
?>
<?= view('partials/school_year_selector', $mainSchoolYearSelectorData) ?>
<?php
$uri = service('uri');
+4 -16
View File
@@ -2,22 +2,10 @@
<?= $this->section('content') ?>
<div class="container my-5">
<h3 class="text-center text-success" style="font-family: Arial, sans-serif;">Attendance Record</h2>
<?php if (!empty($selectedYear)): ?>
<div class="text-center text-muted small">School Year: <?= esc($selectedYear) ?></div>
<?php endif; ?>
</div>
<!-- Filter Form -->
<form action="" method="get" class="form-inline">
<div class="d-flex align-items-center">
<select name="school_year" id="school_year" class="form-control me-3"> <!-- Added me-3 (right margin) -->
<?php foreach ($schoolYears as $year): ?>
<option value="<?= esc($year['school_year']) ?>" <?= $selectedYear === $year['school_year'] ? 'selected' : '' ?>>
<?= esc($year['school_year']) ?>
</option>
<?php endforeach; ?>
</select>
<button type="submit" class="btn btn-success">Filter</button>
</div>
</form>
<!-- Error Message -->
<?php if (isset($error)): ?>
@@ -52,7 +40,7 @@
</tbody>
</table>
<?php else: ?>
<div class="alert alert-info mb-3 d-inline-block">No attendance records found for the selected school year.</div>
<div class="alert alert-info mb-3 d-inline-block">No attendance records found for this school year.</div>
<?php endif; ?>
</main>
</div>
+3 -13
View File
@@ -2,21 +2,11 @@
<?= $this->section('content') ?>
<div class="container my-5">
<h3 class="text-center text-success" style="font-family: Arial, sans-serif;">Enroll in Classes</h3>
<?php if (!empty($selectedYear)): ?>
<div class="text-center text-muted small">School Year: <?= esc($selectedYear) ?></div>
<?php endif; ?>
</div>
<!-- School Year Filter -->
<form action="<?= base_url('/parent/enroll_classes') ?>" method="get" class="form-inline mb-3">
<div class="d-flex align-items-center">
<select name="school_year" id="school_year" class="form-control me-3">
<?php foreach ($schoolYears as $year): ?>
<option value="<?= esc($year['school_year']) ?>" <?= $selectedYear === $year['school_year'] ? 'selected' : '' ?>>
<?= esc($year['school_year']) ?>
</option>
<?php endforeach; ?>
</select>
<button type="submit" class="btn btn-success">Filter</button>
</div>
</form>
<?php
// Put this near the very top of the file (before output), or right after the extend/section lines.
$tz = (string) (config('School')->attendance['timezone'] ?? user_timezone());
+4 -29
View File
@@ -63,24 +63,11 @@ if (!function_exists('parseDbDateTime')) {
<div class="container my-5">
<h3 class="text-center text-success" style="font-family: Arial, sans-serif;">Invoices and Payments</h3>
<?php if (!empty($selectedYear)): ?>
<div class="text-center text-muted small">School Year: <?= esc($selectedYear) ?></div>
<?php endif; ?>
</div>
<!-- School Year Filter -->
<form action="<?= base_url('/parent/invoice_payment') ?>" method="get" class="form-inline mb-3">
<div class="d-flex align-items-center justify-content-center">
<select name="school_year" id="school_year" class="form-control me-3">
<?php foreach ($schoolYears as $year): ?>
<option value="<?= esc($year['school_year']) ?>"
<?= ($selectedYear === $year['school_year']) ? 'selected' : '' ?>
<?= ($currentSchoolYear === $year['school_year']) ? 'data-current="true"' : '' ?>>
<?= esc($year['school_year']) ?><?= ($currentSchoolYear === $year['school_year']) ? ' (Current)' : '' ?>
</option>
<?php endforeach; ?>
</select>
<button type="submit" class="btn btn-success">Filter</button>
</div>
</form>
<!-- Display Payment Notice / Deadline -->
<?php
$displayTz = user_timezone();
@@ -198,7 +185,7 @@ $deadline = parseDbDateTime($dueDate, 'UTC', $displayTz); // format either DATE
<?php endif; ?>
<?php else: ?>
<div class="alert alert-info mb-3 d-inline-block">
No invoice found for the selected school year.
No invoice found for this school year.
</div>
<?php endif; ?>
@@ -208,18 +195,6 @@ $deadline = parseDbDateTime($dueDate, 'UTC', $displayTz); // format either DATE
<?= $this->section('scripts') ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
const dropdown = document.getElementById('school_year');
const options = dropdown.options;
for (let i = 0; i < options.length; i++) {
if (options[i].dataset.current === "true") {
options[i].style.fontWeight = 'bold';
if (!dropdown.value) dropdown.selectedIndex = i;
break;
}
}
});
function showPaymentDevelopmentMessage(event) {
event.preventDefault();
alert('The payment method is currently under development. Please contact the school administration at alrahma.isgl@gmail.com');
+3 -17
View File
@@ -3,24 +3,12 @@
<div class="container my-5">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2">
<h3 class="text-success mb-0" style="font-family: Arial, sans-serif;">Scores</h3>
<?php if (!empty($selectedYear)): ?>
<div class="text-muted small">School Year: <?= esc($selectedYear) ?></div>
<?php endif; ?>
</div>
</div>
<!-- Filter Form -->
<form action="" method="get" class="form-inline">
<div class="d-flex align-items-center">
<select name="school_year" id="school_year" class="form-control me-3"> <!-- Added me-3 (right margin) -->
<?php foreach ($schoolYears as $year): ?>
<option value="<?= esc($year) ?>" <?= $selectedYear === $year ? 'selected' : '' ?>>
<?= esc($year) ?>
</option>
<?php endforeach; ?>
</select>
<button type="submit" class="btn btn-success">Filter</button>
</div>
</form>
<!-- Scores Table -->
<?php $yearScores = $organizedScores[$selectedYear] ?? []; ?>
<?php $semesterOrder = $semesterOrder ?? ['Fall', 'Spring']; ?>
@@ -104,12 +92,10 @@ $showExamScoresBySemester = $showExamScoresBySemester ?? [];
<?php
$reportStudentId = (int) ($student['student_id'] ?? 0);
if ($reportStudentId > 0) {
$reportYear = (string) ($selectedYear ?? '');
$reportSemester = (string) ($semester ?? '');
$reportDate = date('Y-m-d');
$reportUrl = base_url('parent/report-cards/view/' . $reportStudentId);
$query = http_build_query([
'school_year' => $reportYear,
'semester' => $reportSemester,
'report_date' => $reportDate,
]);
+11 -5
View File
@@ -1,10 +1,16 @@
<?= $this->extend('layout/main_layout') ?>
<?= $this->section('content') ?>
<?php $isSchoolYearReadonly = (bool) ($isSchoolYearReadonly ?? false); ?>
<div class="container-fluid py-5">
<div class="row">
<div class="col-md-12">
<h2>Print/Copy Requests</h2>
<?php if ($isSchoolYearReadonly): ?>
<div class="alert alert-warning">
This school year is read-only. Existing requests are visible, but changes are disabled.
</div>
<?php endif; ?>
<!-- Print/Copy Request Tabs -->
<div class="card my-4">
@@ -109,7 +115,7 @@
You are not assigned to any class. Please contact the administrator to be able to submit print requests.
</div>
<?php endif; ?>
<button type="submit" class="btn btn-primary mt-3" <?= (!isset($class_id) || !$class_id) ? 'disabled' : '' ?>>Submit Request</button>
<button type="submit" class="btn btn-primary mt-3" <?= (!isset($class_id) || !$class_id || $isSchoolYearReadonly) ? 'disabled' : '' ?>>Submit Request</button>
</div>
</div>
</form>
@@ -164,7 +170,7 @@
<div class="form-text mt-2">
No file upload is required; please hand the original document to the copy staff after submitting.
</div>
<button type="submit" class="btn btn-outline-primary mt-3">Submit Copy Request</button>
<button type="submit" class="btn btn-outline-primary mt-3" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Submit Copy Request</button>
</form>
</div>
</div>
@@ -241,10 +247,10 @@
</td>
<td>
<div class="d-flex flex-wrap gap-1">
<?php if (in_array($request['status'], ['not_assigned', 'assigned'])): ?>
<?php if (!$isSchoolYearReadonly && in_array($request['status'], ['not_assigned', 'assigned'])): ?>
<button type="button" class="btn btn-sm btn-warning mb-1" onclick='editRequest(<?= json_encode($request, JSON_HEX_APOS | JSON_HEX_QUOT) ?>)'>Edit</button>
<?php endif; ?>
<?php if ($request['status'] === 'not_assigned'): ?>
<?php if (!$isSchoolYearReadonly && $request['status'] === 'not_assigned'): ?>
<button type="button" class="btn btn-sm btn-danger mb-1" onclick="deleteRequest(<?= $request['id'] ?>)">Delete</button>
<?php endif; ?>
</div>
@@ -328,7 +334,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="submit" class="btn btn-primary" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Save changes</button>
</div>
</form>
</div>
-15
View File
@@ -7,21 +7,6 @@
<h2 class="mb-0">Student Score Card</h2>
<div class="text-muted small">Select a student to open their score card.</div>
</div>
<?php
$roleRaw = session()->get('role');
if (is_array($roleRaw)) {
$roleRaw = $roleRaw[0] ?? 'guest';
}
$role = strtolower((string)($roleRaw ?? 'guest'));
if (in_array($role, ['parent', 'parent_dashboard'], true)) {
$backUrl = base_url('/parent_dashboard');
} elseif (in_array($role, ['teacher', 'teacher_assistant', 'teacher_dashboard'], true)) {
$backUrl = base_url('/teacher_dashboard');
} else {
$backUrl = base_url('/');
}
?>
<a href="<?= $backUrl ?>" class="btn btn-outline-secondary">Back</a>
</div>
<?php if (empty($students)): ?>
+12 -2
View File
@@ -1,12 +1,17 @@
<?= $this->extend('layout/main_layout') ?>
<?= $this->section('content') ?>
<?php $isSchoolYearReadonly = (bool) ($isSchoolYearReadonly ?? false); ?>
<div class="container py-4">
<div class="d-flex align-items-center justify-content-between mb-3">
<div>
<h3 class="mb-0">Class Progress Reports</h3>
<div class="text-muted">Review weekly submissions and compare Islamic Studies with Quran/Arabic.</div>
</div>
<a href="<?= base_url('teacher/progress/submit') ?>" class="btn btn-outline-secondary">Submit New Report</a>
<?php if ($isSchoolYearReadonly): ?>
<span class="btn btn-outline-secondary disabled" aria-disabled="true">Submit New Report</span>
<?php else: ?>
<a href="<?= base_url('teacher/progress/submit') ?>" class="btn btn-outline-secondary">Submit New Report</a>
<?php endif; ?>
</div>
<?php
@@ -15,6 +20,9 @@
$classSectionOptions = $classSectionOptions ?? [];
$selectedSectionId = $selectedSectionId ?? null;
?>
<?php if ($isSchoolYearReadonly): ?>
<div class="alert alert-warning">This school year is read-only. Progress submissions can be viewed but not changed.</div>
<?php endif; ?>
<?php if (!empty($classSectionOptions)): ?>
<form method="get" class="mb-3 row g-2 align-items-center">
<div class="col-auto">
@@ -90,7 +98,9 @@
<td class="text-end">
<?php if ($exampleReport): ?>
<a href="<?= base_url('teacher/progress/view/' . $exampleReport['id']) ?>" class="btn btn-sm btn-outline-primary">View Weekly Details</a>
<a href="<?= base_url('teacher/progress/edit/' . $exampleReport['id']) ?>" class="btn btn-sm btn-outline-secondary ms-1">Edit</a>
<?php if (!$isSchoolYearReadonly): ?>
<a href="<?= base_url('teacher/progress/edit/' . $exampleReport['id']) ?>" class="btn btn-sm btn-outline-secondary ms-1">Edit</a>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
+13 -7
View File
@@ -11,6 +11,7 @@
$weekStartSelected = set_value('week_start', $defaultWeekStart);
$weekEndValue = set_value('week_end', $existingWeekEnd ?? '');
$existingReports = $existingReports ?? [];
$isSchoolYearReadonly = (bool) ($isSchoolYearReadonly ?? false);
if (!$weekEndValue && $weekStartSelected) {
try {
$dt = new \DateTime($weekStartSelected);
@@ -58,6 +59,9 @@
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<?php if ($isSchoolYearReadonly): ?>
<div class="alert alert-warning">This school year is read-only. Progress submissions are disabled.</div>
<?php endif; ?>
<?php if (session()->getFlashdata('errors')): ?>
<div class="alert alert-danger">
<ul class="mb-0">
@@ -142,7 +146,8 @@
<button type="button"
class="btn btn-sm btn-outline-dark"
data-add-unit-chapter
data-subject="<?= esc($slug) ?>">
data-subject="<?= esc($slug) ?>"
<?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
<?= $slug === 'quran' ? '+ Add Surah, Arabic Subject' : '+ Add Unit, Chapter' ?>
</button>
<div class="subject-curriculum-list position-absolute d-none border rounded shadow-sm bg-white mt-1" id="curriculumList-<?= esc($slug) ?>" style="min-width: 220px; z-index: 5;">
@@ -170,7 +175,8 @@
data-subject="<?= esc($slug) ?>"
data-unit-number="<?= esc($unitNumber) ?>"
data-unit-title="<?= esc($unitTitle) ?>"
data-chapter="<?= esc($chapterName) ?>">
data-chapter="<?= esc($chapterName) ?>"
<?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
<?= esc($display) ?>
</button>
<?php endforeach; ?>
@@ -179,7 +185,7 @@
<div class="px-2 py-2 border-top">
<div class="input-group input-group-sm">
<input type="text" class="form-control" placeholder="Custom Surah" data-custom-input data-subject="<?= esc($slug) ?>">
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>">Add</button>
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Add</button>
</div>
<div class="form-text small text-muted">Add a custom Surah or Arabic target.</div>
</div>
@@ -187,7 +193,7 @@
<div class="px-2 py-2 border-top">
<div class="input-group input-group-sm">
<input type="text" class="form-control" placeholder="Type subject or topic" data-custom-input data-subject="<?= esc($slug) ?>">
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>">Add</button>
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Add</button>
</div>
<div class="form-text small text-muted">Add a subject or unit not listed above (e.g. Seerah, Fiqh, Akhlaq).</div>
</div>
@@ -206,7 +212,7 @@
<input type="text" name="chapter_<?= esc($slug) ?>[]" class="form-control form-control-sm" placeholder="Chapter" value="<?= esc($chapterValues[$i] ?? '') ?>" readonly>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-danger btn-sm" data-remove-unit-chapter aria-label="Remove entry">X</button>
<button type="button" class="btn btn-outline-danger btn-sm" data-remove-unit-chapter aria-label="Remove entry" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>X</button>
</div>
</div>
<?php endfor; ?>
@@ -232,7 +238,7 @@
<div class="col">
<div class="card shadow-sm">
<div class="card-body d-flex flex-column">
<button class="btn btn-primary w-100 mt-auto" type="submit" <?= $hasClass ? '' : 'disabled' ?>><?= esc($submitLabel) ?></button>
<button class="btn btn-primary w-100 mt-auto" type="submit" <?= ($hasClass && !$isSchoolYearReadonly) ? '' : 'disabled' ?>><?= esc($submitLabel) ?></button>
<?php if (! $hasClass): ?>
<div class="text-muted small mt-2">
You are not assigned to a class. Contact the administrator to submit progress.
@@ -288,7 +294,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="confirmOverwriteButton">Override</button>
<button type="button" class="btn btn-primary" id="confirmOverwriteButton" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Override</button>
</div>
</div>
</div>
+10 -4
View File
@@ -10,6 +10,7 @@ $examTypes = $examTypes ?? [];
$schoolYear = $schoolYear ?? '';
$semester = $semester ?? '';
$maxUploadBytes = $maxUploadBytes ?? (12 * 1024 * 1024);
$isSchoolYearReadonly = (bool) ($isSchoolYearReadonly ?? false);
?>
<style>
.teacher-drafts-page,
@@ -48,6 +49,11 @@ $maxUploadBytes = $maxUploadBytes ?? (12 * 1024 * 1024);
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<?php if ($isSchoolYearReadonly): ?>
<div class="alert alert-warning">
This school year is read-only. Exam draft submissions are disabled.
</div>
<?php endif; ?>
<div class="card mb-4">
<div class="card-body">
@@ -55,7 +61,7 @@ $maxUploadBytes = $maxUploadBytes ?? (12 * 1024 * 1024);
<?= csrf_field() ?>
<div class="col-md-6">
<label class="form-label" for="exam_type">Exam type <span class="text-danger">*</span></label>
<select name="exam_type" id="exam_type" class="form-select" required>
<select name="exam_type" id="exam_type" class="form-select" required <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
<option value="">— Select —</option>
<?php foreach ($examTypes as $t): ?>
<option value="<?= esc($t) ?>" <?= old('exam_type') === $t ? 'selected' : '' ?>><?= esc($t) ?></option>
@@ -64,15 +70,15 @@ $maxUploadBytes = $maxUploadBytes ?? (12 * 1024 * 1024);
</div>
<div class="col-8">
<label class="form-label" for="author_comment">Author comment</label>
<textarea name="author_comment" id="author_comment" class="form-control" rows="2" placeholder="Optional note for reviewers"><?= esc(old('author_comment') ?? '') ?></textarea>
<textarea name="author_comment" id="author_comment" class="form-control" rows="2" placeholder="Optional note for reviewers" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>><?= esc(old('author_comment') ?? '') ?></textarea>
</div>
<div class="col-md-8">
<label class="form-label" for="draft_file">File (Word) <span class="text-danger">*</span></label>
<input type="file" name="draft_file" id="draft_file" class="form-control" accept=".doc,.docx" required>
<input type="file" name="draft_file" id="draft_file" class="form-control" accept=".doc,.docx" required <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
<div class="form-text">Max <?= esc(number_format($maxUploadBytes / 1048576, 1)) ?> MB.</div>
</div>
<div class="col-12 d-flex flex-wrap gap-2">
<button type="submit" class="btn btn-primary">Submit for review</button>
<button type="submit" class="btn btn-primary" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Submit for review</button>
</div>
<?= form_close() ?>
<?php if ($schoolYear !== '' || $semester !== ''): ?>
+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>