fix is_active student flag and apply it in all pages
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user