fix is_active student flag and apply it in all pages
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 48s
Tests / PHPUnit (push) Successful in 1m17s

This commit is contained in:
root
2026-08-20 12:59:59 -04:00
parent 0a31aa1393
commit bfa343b69f
57 changed files with 820 additions and 240 deletions
+10 -5
View File
@@ -230,13 +230,18 @@
if ($yearVal !== null && $yearVal < 60) {
$rowClass = $yearVal < 50 ? 'grade-red' : 'grade-orange';
}
$badge = $decisionBadge[$decision] ?? null;
[$srcCls, $srcLabel] = $sourceBadge[$source] ?? ['bg-light text-muted', $source];
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
$fmt = fn($v) => is_numeric($v) ? number_format((float)$v, 2) : '—';
$badge = $decisionBadge[$decision] ?? null;
[$srcCls, $srcLabel] = $sourceBadge[$source] ?? ['bg-light text-muted', $source];
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
$rowLocked = student_is_non_active_for_editing($row, $schoolYear ?? null);
$rowClass = trim($rowClass . ' ' . ($rowLocked ? 'table-secondary text-muted' : ''));
$fmt = fn($v) => is_numeric($v) ? number_format((float)$v, 2) : '—';
?>
<tr class="<?= esc($rowClass) ?>">
<td><?= esc($studentName ?: 'N/A') ?></td>
<td>
<?= esc($studentName ?: 'N/A') ?>
<?= student_enrollment_status_button($row, $schoolYear ?? null) ?>
</td>
<td><?= esc($row['class_section_name'] ?? '—') ?></td>
<td class="text-center"><?= esc($fmt($row['fall_score'] ?? null)) ?></td>
<td class="text-center"><?= esc($fmt($row['spring_score'] ?? null)) ?></td>
+20 -13
View File
@@ -85,12 +85,17 @@ if (empty($schoolYears) && $schoolYear !== '') {
}
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
$studentLabel = $studentName !== '' ? $studentName : 'N/A';
$isClosed = ($row['status'] ?? 'Open') === 'Closed';
?>
$studentLabel = $studentName !== '' ? $studentName : 'N/A';
$isClosed = ($row['status'] ?? 'Open') === 'Closed';
$rowLocked = student_is_non_active_for_editing($row, $schoolYear ?? null);
$rowClass = trim($scoreClass . ' ' . ($rowLocked ? 'table-secondary text-muted' : ''));
?>
<tr class="<?= esc($scoreClass) ?>">
<td><?= esc($studentLabel) ?></td>
<tr class="<?= esc($rowClass) ?>">
<td>
<?= esc($studentLabel) ?>
<?= student_enrollment_status_button($row, $schoolYear ?? null) ?>
</td>
<td><?= esc($row['class_section_name'] ?? '—') ?></td>
<td class="text-center">
@@ -124,9 +129,10 @@ if (empty($schoolYears) && $schoolYear !== '') {
name="school_year"
value="<?= esc((string)$schoolYear) ?>">
<select name="status"
class="form-select form-select-sm"
style="width:110px;">
<select name="status"
class="form-select form-select-sm"
<?= $rowLocked ? 'disabled aria-disabled="true"' : '' ?>
style="width:110px;">
<option value="Open" <?= ($row['status'] ?? 'Open') === 'Open' ? 'selected' : '' ?>>
Open
</option>
@@ -137,12 +143,13 @@ if (empty($schoolYears) && $schoolYear !== '') {
<input type="text"
name="note"
class="form-control form-control-sm"
style="width:140px;"
placeholder="Note (optional)"
value="<?= esc((string)($row['note'] ?? '')) ?>">
class="form-control form-control-sm"
style="width:140px;"
placeholder="Note (optional)"
<?= $rowLocked ? 'readonly aria-disabled="true"' : '' ?>
value="<?= esc((string)($row['note'] ?? '')) ?>">
<button type="submit" class="btn btn-sm btn-outline-secondary">
<button type="submit" class="btn btn-sm btn-outline-secondary" <?= $rowLocked ? 'disabled' : '' ?>>
Update
</button>
</form>
+26 -20
View File
@@ -176,14 +176,20 @@ if (empty($schoolYears) && $schoolYear !== '') {
}
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
$studentLabel = $studentName !== '' ? $studentName : 'N/A';
$currentDecision = (string)($row['decision'] ?? '');
$currentNotes = (string)($row['decision_notes'] ?? '');
$badge = $decisionBadge[$currentDecision] ?? null;
?>
$studentLabel = $studentName !== '' ? $studentName : 'N/A';
$currentDecision = (string)($row['decision'] ?? '');
$currentNotes = (string)($row['decision_notes'] ?? '');
$badge = $decisionBadge[$currentDecision] ?? null;
$rowLocked = student_is_non_active_for_editing($row, $schoolYear ?? null);
$rowClass = trim($rowClass . ' ' . ($rowLocked ? 'table-secondary text-muted' : ''));
$controlsEditable = $isEditable && !$rowLocked;
?>
<tr class="<?= esc($rowClass) ?>">
<td><?= esc($studentLabel) ?></td>
<td>
<?= esc($studentLabel) ?>
<?= student_enrollment_status_button($row, $schoolYear ?? null) ?>
</td>
<td class="text-center"><?= esc((string)($row['age'] ?? '—')) ?></td>
@@ -219,15 +225,15 @@ if (empty($schoolYears) && $schoolYear !== '') {
value="<?= esc((string)$schoolYear) ?>">
<textarea name="notes"
class="form-control form-control-sm decision-notes"
rows="3"
placeholder="Add comments or rationale…"
<?= $isEditable ? '' : 'readonly' ?>><?= esc($currentNotes) ?></textarea>
class="form-control form-control-sm decision-notes"
rows="3"
placeholder="Add comments or rationale…"
<?= $controlsEditable ? '' : 'readonly aria-disabled="true"' ?>><?= esc($currentNotes) ?></textarea>
<div class="d-flex gap-2 mt-2 align-items-center">
<select name="decision"
class="form-select form-select-sm decision-select flex-grow-1"
<?= $isEditable ? '' : 'disabled' ?>>
<select name="decision"
class="form-select form-select-sm decision-select flex-grow-1"
<?= $controlsEditable ? '' : 'disabled aria-disabled="true"' ?>>
<?php foreach ($decisionOptions as $val => $label): ?>
<option value="<?= esc($val) ?>" <?= $currentDecision === $val ? 'selected' : '' ?>>
<?= esc($label) ?>
@@ -235,9 +241,9 @@ if (empty($schoolYears) && $schoolYear !== '') {
<?php endforeach; ?>
</select>
<button type="submit"
class="btn btn-sm btn-primary"
<?= $isEditable ? '' : 'disabled' ?>>
<button type="submit"
class="btn btn-sm btn-primary"
<?= $controlsEditable ? '' : 'disabled' ?>>
Save
</button>
</div>
@@ -252,10 +258,10 @@ if (empty($schoolYears) && $schoolYear !== '') {
<button type="button"
class="btn btn-sm btn-outline-primary btn-send-email"
data-student-id="<?= (int)($row['student_id'] ?? 0) ?>"
data-semester="year"
data-school-year="<?= esc((string)$schoolYear) ?>"
<?= $isEditable ? '' : 'disabled' ?>>
data-student-id="<?= (int)($row['student_id'] ?? 0) ?>"
data-semester="year"
data-school-year="<?= esc((string)$schoolYear) ?>"
<?= $controlsEditable ? '' : 'disabled' ?>>
Send Email
</button>
<?php else: ?>
+28 -20
View File
@@ -78,16 +78,22 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
</tr>
</thead>
<tbody>
<?php $rowNum = 1; ?>
<?php foreach ($students as $student): ?>
<?php $studentId = $student['student_id']; ?>
<tr>
<?php $rowNum = 1; ?>
<?php foreach ($students as $student): ?>
<?php
$studentId = $student['student_id'];
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
$rowButtonLockAttr = ($scoresLocked || $rowLocked) ? 'disabled' : '';
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $rowNum++ ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
<?= esc($student['firstname']) ?> <?= esc($student['lastname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<!-- PTAP Comment and Review -->
@@ -102,7 +108,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
data-first-name="<?= esc($student['firstname']) ?>"
minlength="100"
maxlength="350"
placeholder="Enter PTAP comment" <?= $lockAttr ?>><?= esc($comments[$studentId]['ptap']['comment'] ?? '') ?></textarea>
placeholder="Enter PTAP comment" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['ptap']['comment'] ?? '') ?></textarea>
</td>
<td class="ptap-review-cell">
<div class="d-flex gap-2 align-items-start">
@@ -111,13 +117,13 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
name="reviews[<?= $studentId ?>][ptap]"
rows="2"
class="form-control review-field"
placeholder="Enter PTAP review" <?= $lockAttr ?>><?= esc($comments[$studentId]['ptap']['comment_review'] ?? '') ?></textarea>
placeholder="Enter PTAP review" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['ptap']['comment_review'] ?? '') ?></textarea>
<div class="d-flex flex-column gap-1 align-items-stretch">
<button
type="button"
class="btn btn-outline-secondary btn-sm copy-ptap-btn"
data-copy-source="#<?= esc($ptapCommentId) ?>"
data-copy-target="#<?= esc($ptapReviewId) ?>" <?= $lockAttr ?>>
data-copy-target="#<?= esc($ptapReviewId) ?>" <?= $rowButtonLockAttr ?>>
Paste
</button>
<div class="small text-muted proofread-status" data-status-for="<?= esc($ptapReviewId) ?>"></div>
@@ -144,7 +150,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
data-first-name="<?= esc($student['firstname']) ?>"
minlength="100"
maxlength="350"
placeholder="Enter Midterm comment" <?= $lockAttr ?>><?= esc($comments[$studentId]['midterm']['comment'] ?? '') ?></textarea>
placeholder="Enter Midterm comment" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['midterm']['comment'] ?? '') ?></textarea>
</td>
<td>
<div class="d-flex gap-2 align-items-start">
@@ -156,13 +162,13 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
data-first-name="<?= esc($student['firstname']) ?>"
minlength="100"
maxlength="350"
placeholder="Enter Midterm review" <?= $lockAttr ?>><?= esc($comments[$studentId]['midterm']['comment_review'] ?? '') ?></textarea>
placeholder="Enter Midterm review" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['midterm']['comment_review'] ?? '') ?></textarea>
<div class="d-flex flex-column gap-1 align-items-stretch">
<button
type="button"
class="btn btn-outline-secondary btn-sm copy-midterm-btn"
data-copy-source="#<?= esc($midCommentId) ?>"
data-copy-target="#<?= esc($midReviewId) ?>" <?= $lockAttr ?>>
data-copy-target="#<?= esc($midReviewId) ?>" <?= $rowButtonLockAttr ?>>
Paste
</button>
<div class="small text-muted proofread-status" data-status-for="<?= esc($midReviewId) ?>"></div>
@@ -187,7 +193,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
data-first-name="<?= esc($student['firstname']) ?>"
minlength="100"
maxlength="350"
placeholder="Enter Final comment" <?= $lockAttr ?>><?= esc($comments[$studentId]['final']['comment'] ?? '') ?></textarea>
placeholder="Enter Final comment" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['final']['comment'] ?? '') ?></textarea>
</td>
<td>
<div class="d-flex gap-2 align-items-start">
@@ -196,13 +202,13 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
name="reviews[<?= $studentId ?>][final]"
rows="2"
class="form-control review-field"
placeholder="Enter Final review" <?= $lockAttr ?>><?= esc($comments[$studentId]['final']['comment_review'] ?? '') ?></textarea>
placeholder="Enter Final review" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['final']['comment_review'] ?? '') ?></textarea>
<div class="d-flex flex-column gap-1 align-items-stretch">
<button
type="button"
class="btn btn-outline-secondary btn-sm copy-final-btn"
data-copy-source="#<?= esc($finalCommentId) ?>"
data-copy-target="#<?= esc($finalReviewId) ?>" <?= $lockAttr ?>>
data-copy-target="#<?= esc($finalReviewId) ?>" <?= $rowButtonLockAttr ?>>
Paste
</button>
<div class="small text-muted proofread-status" data-status-for="<?= esc($finalReviewId) ?>"></div>
@@ -225,7 +231,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
data-first-name="<?= esc($student['firstname']) ?>"
minlength="100"
maxlength="350"
placeholder="Enter Attendance comment" <?= $lockAttr ?>><?= esc($comments[$studentId]['attendance']['comment'] ?? '') ?></textarea>
placeholder="Enter Attendance comment" <?= $rowLockAttr ?>><?= esc($comments[$studentId]['attendance']['comment'] ?? '') ?></textarea>
</td>
</tr>
<?php endforeach; ?>
@@ -377,7 +383,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
};
const shouldAutoSave = function(field, value) {
if (field.disabled) return false;
if (field.disabled || field.readOnly) return false;
const lastSaved = field.getAttribute('data-last-saved') || '';
if (value === lastSaved) return false;
const parsed = parseFieldName(field.name || '');
@@ -434,8 +440,9 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
form.addEventListener('submit', function(event) {
syncCsrfToken();
const errors = [];
form.querySelectorAll('textarea[data-first-name]').forEach(field => {
const value = field.value.trim();
form.querySelectorAll('textarea[data-first-name]').forEach(field => {
if (field.disabled || field.readOnly) return;
const value = field.value.trim();
if (value === '') return;
const min = 100;
@@ -472,9 +479,10 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
const wireCopyButtons = (selector) => {
document.querySelectorAll(selector).forEach(button => {
button.addEventListener('click', function() {
const source = document.querySelector(this.dataset.copySource || '');
const target = document.querySelector(this.dataset.copyTarget || '');
if (!source || !target) return;
const source = document.querySelector(this.dataset.copySource || '');
const target = document.querySelector(this.dataset.copyTarget || '');
if (!source || !target) return;
if (target.disabled || target.readOnly) return;
target.value = source.value;
target.style.height = 'auto';
target.style.height = (target.scrollHeight) + 'px';
+9 -4
View File
@@ -88,15 +88,20 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
</tr>
</thead>
<tbody>
<?php foreach ($students as $index => $student): ?>
<tr>
<tbody>
<?php foreach ($students as $index => $student): ?>
<?php
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $index + 1 ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['student_id'] ?? 0) ?>">
<?= esc($student['firstname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['student_id'] ?? 0) ?>">
@@ -106,7 +111,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<td>
<input type="number" name="final_score[<?= esc($student['student_id']) ?>][score]"
value="<?= esc($student['score'] ?? '') ?>" class="form-control text-center" min="0" max="100" step="0.01"
placeholder="Enter score (optional)" <?= $lockAttr ?>>
placeholder="Enter score (optional)" <?= $rowLockAttr ?>>
</td>
</tr>
<?php endforeach; ?>
+6 -3
View File
@@ -357,9 +357,10 @@
<th>Semester Score</th>
</tr>
</thead>
<tbody>
<?php foreach ($students as $student): ?>
<tr>
<tbody>
<?php foreach ($students as $student): ?>
<?php $rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null); ?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= esc($student['school_id'] ?? 'N/A') ?></td>
<td>
<?php $sid = (int)($student['id'] ?? 0); ?>
@@ -367,8 +368,10 @@
<a href="#" class="text-decoration-none" data-family-student-id="<?= $sid ?>">
<?= esc($student['firstname'] ?? 'N/A') ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
<?php else: ?>
<?= esc($student['firstname'] ?? 'N/A') ?>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
<?php endif; ?>
</td>
<td>
+5 -2
View File
@@ -55,14 +55,17 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<?php
$studentId = $student['id'];
$scores = $homeworkScores[$studentId]['scores'] ?? [];
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
?>
<tr>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $row++ ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
<?= esc($student['firstname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
@@ -78,7 +81,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
name="scores[<?= $studentId ?>][<?= $index ?>]"
value="<?= esc(is_array($scoreValue) ? '' : $scoreValue) ?>"
class="form-control text-center"
min="0" max="100" step="0.01" <?= $lockAttr ?>>
min="0" max="100" step="0.01" <?= $rowLockAttr ?>>
</td>
<?php endforeach; ?>
</tr>
+9 -4
View File
@@ -45,15 +45,20 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
</tr>
</thead>
<tbody>
<?php foreach ($students as $index => $student): ?>
<tr>
<tbody>
<?php foreach ($students as $index => $student): ?>
<?php
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $index + 1 ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['student_id'] ?? 0) ?>">
<?= esc($student['firstname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['student_id'] ?? 0) ?>">
@@ -63,7 +68,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<td>
<input type="number" name="final_score[<?= esc($student['student_id']) ?>][score]"
value="<?= esc($student['score'] ?? '') ?>" class="form-control text-center" min="0" max="100" step="0.01"
placeholder="Enter score (optional)" <?= $lockAttr ?>>
placeholder="Enter score (optional)" <?= $rowLockAttr ?>>
</td>
</tr>
<?php endforeach; ?>
+9 -4
View File
@@ -45,15 +45,20 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
</tr>
</thead>
<tbody>
<?php foreach ($students as $index => $student): ?>
<tr>
<tbody>
<?php foreach ($students as $index => $student): ?>
<?php
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $index + 1 ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['student_id'] ?? 0) ?>">
<?= esc($student['firstname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['student_id'] ?? 0) ?>">
@@ -63,7 +68,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<td>
<input type="number" name="final_score[<?= esc($student['student_id']) ?>][score]"
value="<?= esc($student['score'] ?? '') ?>" class="form-control text-center" min="0" max="100" step="0.01"
placeholder="Enter score (optional)" <?= $lockAttr ?>>
placeholder="Enter score (optional)" <?= $rowLockAttr ?>>
</td>
</tr>
<?php endforeach; ?>
+14 -9
View File
@@ -53,13 +53,17 @@
</thead>
<tbody>
<?php foreach ($students as $student): ?>
<?php
$sid = (int) ($student['student_id'] ?? 0);
$current = (string) ($levels[$sid] ?? '');
?>
<tr>
<?php
$sid = (int) ($student['student_id'] ?? 0);
$current = (string) ($levels[$sid] ?? '');
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= esc($student['school_id'] ?? '') ?></td>
<td><?= esc($student['firstname'] ?? '') ?></td>
<td>
<?= esc($student['firstname'] ?? '') ?>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td><?= esc($student['lastname'] ?? '') ?></td>
<td>
<input type="number"
@@ -67,9 +71,10 @@
class="form-control form-control-sm"
min="0"
max="100"
step="1"
value="<?= esc($current) ?>"
placeholder="0-100">
step="1"
value="<?= esc($current) ?>"
<?= $rowLocked ? 'readonly aria-disabled="true"' : '' ?>
placeholder="0-100">
</td>
</tr>
<?php endforeach; ?>
+15 -10
View File
@@ -53,14 +53,18 @@
<?php
$sid = (int) ($student['student_id'] ?? 0);
$scoreRow = $scores[$sid] ?? null;
$current = $scoreRow ? (string) ($scoreRow['score'] ?? '') : '';
$sectionName = (string) ($student['class_section_name'] ?? '');
$className = (string) ($student['class_name'] ?? '');
$sectionLabel = $className !== '' ? ($className . ' — ' . $sectionName) : $sectionName;
?>
<tr>
$current = $scoreRow ? (string) ($scoreRow['score'] ?? '') : '';
$sectionName = (string) ($student['class_section_name'] ?? '');
$className = (string) ($student['class_name'] ?? '');
$sectionLabel = $className !== '' ? ($className . ' — ' . $sectionName) : $sectionName;
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= esc($student['school_id'] ?? '') ?></td>
<td><?= esc($student['firstname'] ?? '') ?></td>
<td>
<?= esc($student['firstname'] ?? '') ?>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td><?= esc($student['lastname'] ?? '') ?></td>
<td><?= esc($sectionLabel ?: '—') ?></td>
<td>
@@ -69,9 +73,10 @@
class="form-control form-control-sm"
min="0"
max="100"
step="1"
value="<?= esc($current) ?>"
placeholder="0-100">
step="1"
value="<?= esc($current) ?>"
<?= $rowLocked ? 'readonly aria-disabled="true"' : '' ?>
placeholder="0-100">
</td>
</tr>
<?php endforeach; ?>
+24 -15
View File
@@ -61,13 +61,17 @@
<?php foreach ($students as $student): ?>
<?php
$sid = (int) ($student['student_id'] ?? 0);
$sectionName = (string) ($student['class_section_name'] ?? '');
$className = (string) ($student['class_name'] ?? '');
$sectionLabel = $className !== '' ? ($className . ' — ' . $sectionName) : $sectionName;
?>
<tr>
$sectionName = (string) ($student['class_section_name'] ?? '');
$className = (string) ($student['class_name'] ?? '');
$sectionLabel = $className !== '' ? ($className . ' — ' . $sectionName) : $sectionName;
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= esc($student['school_id'] ?? '') ?></td>
<td><?= esc($student['firstname'] ?? '') ?></td>
<td>
<?= esc($student['firstname'] ?? '') ?>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td><?= esc($student['lastname'] ?? '') ?></td>
<td><?= esc($sectionLabel ?: '—') ?></td>
<td>
@@ -76,9 +80,10 @@
class="form-control form-control-sm"
min="0"
max="100"
step="1"
value=""
placeholder="0-100">
step="1"
value=""
<?= $rowLocked ? 'readonly aria-disabled="true"' : '' ?>
placeholder="0-100">
</td>
</tr>
<?php endforeach; ?>
@@ -154,13 +159,17 @@
<tbody>
<?php foreach ($detailRows as $row): ?>
<?php
$sectionName = (string) ($row['class_section_name'] ?? '');
$className = (string) ($row['class_name'] ?? '');
$sectionLabel = $className !== '' ? ($className . ' — ' . $sectionName) : $sectionName;
?>
<tr>
$sectionName = (string) ($row['class_section_name'] ?? '');
$className = (string) ($row['class_name'] ?? '');
$sectionLabel = $className !== '' ? ($className . ' — ' . $sectionName) : $sectionName;
$rowLocked = student_is_non_active_for_editing($row, $schoolYear ?? null);
?>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= esc($row['school_id'] ?? '') ?></td>
<td><?= esc($row['firstname'] ?? '') ?></td>
<td>
<?= esc($row['firstname'] ?? '') ?>
<?= student_enrollment_status_button($row, $schoolYear ?? null) ?>
</td>
<td><?= esc($row['lastname'] ?? '') ?></td>
<td><?= esc($sectionLabel ?: '—') ?></td>
<td><?= esc($row['score'] ?? '') ?></td>
+5 -2
View File
@@ -56,14 +56,17 @@
<?php
$studentId = $student['id'];
$scores = $projectScores[$studentId]['scores'] ?? [];
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
?>
<tr>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $row++ ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
<?= esc($student['firstname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
@@ -79,7 +82,7 @@
name="scores[<?= $studentId ?>][<?= $index ?>]"
value="<?= esc(is_array($scoreValue) ? '' : $scoreValue) ?>"
class="form-control text-center"
min="0" max="100" step="0.01" <?= $lockAttr ?>>
min="0" max="100" step="0.01" <?= $rowLockAttr ?>>
</td>
<?php endforeach; ?>
</tr>
+5 -2
View File
@@ -56,14 +56,17 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<?php
$studentId = $student['id'];
$scores = $quizScores[$studentId]['scores'] ?? [];
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
?>
<tr>
<tr class="<?= $rowLocked ? 'table-secondary text-muted' : '' ?>">
<td><?= $row++ ?></td>
<td><?= esc($student['school_id']) ?></td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
<?= esc($student['firstname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</td>
<td>
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)$studentId ?>">
@@ -79,7 +82,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
name="scores[<?= $studentId ?>][<?= $index ?>]"
value="<?= esc(is_array($scoreValue) ? '' : $scoreValue) ?>"
class="form-control text-center"
min="0" max="100" step="0.01" <?= $lockAttr ?>>
min="0" max="100" step="0.01" <?= $rowLockAttr ?>>
</td>
<?php endforeach; ?>
</tr>
+9 -5
View File
@@ -41,6 +41,9 @@ switch ($viewFile) {
$scoresLocked = !empty($scoresLocked);
$lockAttr = $scoresLocked ? 'disabled' : '';
$rowLocked = student_is_non_active_for_editing($student, $schoolYear ?? null);
$rowLockAttr = $scoresLocked ? $lockAttr : ($rowLocked ? 'readonly aria-disabled="true"' : '');
$rowButtonLockAttr = ($scoresLocked || $rowLocked) ? 'disabled' : '';
?>
<?= $this->extend('layout/management_layout') ?>
@@ -51,6 +54,7 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<a href="#" class="text-decoration-none" data-family-student-id="<?= (int)($student['id'] ?? 0) ?>">
<?= esc($student['firstname'] . ' ' . $student['lastname']) ?>
</a>
<?= student_enrollment_status_button($student, $schoolYear ?? null) ?>
</h2>
<?php if ($scoresLocked): ?>
<div class="alert alert-warning text-center">
@@ -79,10 +83,10 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<td><?= $index + 1 ?></td>
<td>
<input type="hidden" name="score_ids[]" value="<?= $row['id'] ?>">
<input type="number" class="form-control" name="scores[]" value="<?= $row['score'] ?>" <?= $lockAttr ?>>
<input type="number" class="form-control" name="scores[]" value="<?= $row['score'] ?>" <?= $rowLockAttr ?>>
</td>
<td>
<textarea class="form-control" name="comments[]" <?= $lockAttr ?>><?= esc($row['comment'] ?? '') ?></textarea>
<textarea class="form-control" name="comments[]" <?= $rowLockAttr ?>><?= esc($row['comment'] ?? '') ?></textarea>
</td>
</tr>
<?php endforeach; ?>
@@ -91,17 +95,17 @@ $lockAttr = $scoresLocked ? 'disabled' : '';
<?php elseif (in_array($type, ['midterm', 'final', 'test'])): ?>
<div class="form-group">
<label>Score</label>
<input type="number" class="form-control" name="score" value="<?= $scores[0]['score'] ?? '' ?>" <?= $lockAttr ?>>
<input type="number" class="form-control" name="score" value="<?= $scores[0]['score'] ?? '' ?>" <?= $rowLockAttr ?>>
</div>
<?php elseif ($type === 'comments'): ?>
<div class="form-group">
<label>General Comment</label>
<textarea class="form-control" name="comment" rows="5" <?= $lockAttr ?>><?= $scores[0]['comment'] ?? '' ?></textarea>
<textarea class="form-control" name="comment" rows="5" <?= $rowLockAttr ?>><?= $scores[0]['comment'] ?? '' ?></textarea>
</div>
<?php endif; ?>
<div class="form-group text-center mt-3">
<button type="submit" class="btn btn-primary" <?= $lockAttr ?>>Save Changes</button>
<button type="submit" class="btn btn-primary" <?= $rowButtonLockAttr ?>>Save Changes</button>
</div>
</form>
<div class="text-center mt-4">