diff --git a/app/Controllers/View/HomeworkTrackingController.php b/app/Controllers/View/HomeworkTrackingController.php
index 516941f..5d58641 100644
--- a/app/Controllers/View/HomeworkTrackingController.php
+++ b/app/Controllers/View/HomeworkTrackingController.php
@@ -86,6 +86,7 @@ class HomeworkTrackingController extends BaseController
$hasHomework = [];
$hwEnteredAt = [];
+ $homeworkSubmissionCounts = [];
foreach ($rows as $r) {
$csid = (int)($r['class_section_id'] ?? 0);
$hi = (int)($r['homework_index'] ?? 0);
@@ -94,6 +95,7 @@ class HomeworkTrackingController extends BaseController
$hasHomework[$csid][$hi] = true;
$dateStr = substr((string)($r['first_created'] ?? ''), 0, 10);
$hwEnteredAt[$csid][$hi] = $dateStr ?: null;
+ $homeworkSubmissionCounts[$csid] = ($homeworkSubmissionCounts[$csid] ?? 0) + 1;
}
}
@@ -217,6 +219,7 @@ class HomeworkTrackingController extends BaseController
'teachers' => $teachersPage,
'hasHomework' => $hasHomework,
'hwEnteredAt' => $hwEnteredAt,
+ 'homeworkSubmissionCounts' => $homeworkSubmissionCounts,
'hasHomeworkByDate' => $hasHomeworkByDate,
'hwEnteredAtByDate' => $hwEnteredAtByDate,
'page' => $page,
diff --git a/app/Controllers/View/TeacherController.php b/app/Controllers/View/TeacherController.php
index f4a87dc..4a85a28 100644
--- a/app/Controllers/View/TeacherController.php
+++ b/app/Controllers/View/TeacherController.php
@@ -297,12 +297,16 @@ class TeacherController extends BaseController
$schoolYear = $forYear ?: ((string)($this->schoolYear ?? 'Not Set'));
$teachers = $this->teacherModel->getTeachersAndTAs();
- // Prefer class sections for the selected year, fallback to all if none
- $classSections = $classSectionModel
- ->where('school_year', $schoolYear)
- ->orderBy('class_section_name', 'ASC')
- ->findAll();
- if (empty($classSections)) {
+ // Prefer class sections for the selected year if the column exists, otherwise fallback to all.
+ if ($this->db->fieldExists('school_year', 'classSection')) {
+ $classSections = $classSectionModel
+ ->where('school_year', $schoolYear)
+ ->orderBy('class_section_name', 'ASC')
+ ->findAll();
+ if (empty($classSections)) {
+ $classSections = $classSectionModel->orderBy('class_section_name', 'ASC')->findAll();
+ }
+ } else {
$classSections = $classSectionModel->orderBy('class_section_name', 'ASC')->findAll();
}
diff --git a/app/Models/TeacherModel.php b/app/Models/TeacherModel.php
index 5194edd..7fb7520 100644
--- a/app/Models/TeacherModel.php
+++ b/app/Models/TeacherModel.php
@@ -34,11 +34,11 @@ class TeacherModel extends Model
public function getTeachersAndTAs(): array
{
return $this->db->table('users u')
- ->select('u.id, u.firstname, u.lastname, u.email, u.cellphone, r.name as role')
+ ->select('u.id, u.firstname, u.lastname, u.email, u.cellphone, MIN(r.name) as role')
->join('user_roles ur', 'ur.user_id = u.id')
->join('roles r', 'r.id = ur.role_id')
->whereIn('r.name', ['teacher', 'teacher_assistant']) // ✅ Filter only relevant roles
- ->groupBy('u.id')
+ ->groupBy('u.id, u.firstname, u.lastname, u.email, u.cellphone')
->orderBy('u.lastname', 'ASC')
->get()
->getResultArray();
@@ -72,4 +72,4 @@ public function getTeachersAndTAs(): array
->get()
->getResultArray();
}
-}
\ No newline at end of file
+}
diff --git a/app/Views/administrator/subject_curriculum.php b/app/Views/administrator/subject_curriculum.php
index 412a138..8896b5b 100644
--- a/app/Views/administrator/subject_curriculum.php
+++ b/app/Views/administrator/subject_curriculum.php
@@ -144,58 +144,86 @@
= count($entries) ?> record= count($entries) === 1 ? '' : 's' ?>
-
-
-
-
- | Class |
- Subject |
- Unit |
- Unit title |
- Chapter / Surah |
- Updated |
- Actions |
-
-
-
-
-
- | No curriculum records yet. |
-
-
-
- format('M d, Y H:i');
- } catch (\Exception $e) {
- $updatedDisplay = $updatedAt;
- }
- }
- ?>
-
- | = esc(($entry['class_name'] ?? '') ?: '—') ?> |
- = esc($subjectLabel) ?> |
- = $entry['unit_number'] ? esc((string)$entry['unit_number']) : '—' ?> |
- = esc(($entry['unit_title'] ?? '') ?: '—') ?> |
- = esc(($entry['chapter_name'] ?? '') ?: '—') ?> |
- = esc($updatedDisplay ?: '—') ?> |
-
- Edit
-
- |
-
-
-
-
-
-
+
+
No curriculum records yet.
+
+
+
+
+ $classEntries): ?>
+
+
+
+
+
+
+
+
+
+ | Subject |
+ Unit |
+ Unit title |
+ Chapter / Surah |
+ Updated |
+ Actions |
+
+
+
+
+ format('M d, Y H:i');
+ } catch (\Exception $e) {
+ $updatedDisplay = $updatedAt;
+ }
+ }
+ ?>
+
+ | = esc($subjectLabel) ?> |
+ = $entry['unit_number'] ? esc((string)$entry['unit_number']) : '—' ?> |
+ = esc(($entry['unit_title'] ?? '') ?: '—') ?> |
+ = esc(($entry['chapter_name'] ?? '') ?: '—') ?> |
+ = esc($updatedDisplay ?: '—') ?> |
+
+ Edit
+
+ |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/administrator/teacher_class_assignment.php b/app/Views/administrator/teacher_class_assignment.php
index b140603..4425f75 100644
--- a/app/Views/administrator/teacher_class_assignment.php
+++ b/app/Views/administrator/teacher_class_assignment.php
@@ -63,7 +63,15 @@
- | Loading... |
+ Loading... |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
@@ -198,10 +206,12 @@ document.addEventListener('DOMContentLoaded', function () {
if (!teachers || teachers.length === 0) {
var emptyRow = document.createElement('tr');
var emptyCell = document.createElement('td');
- emptyCell.colSpan = 9;
emptyCell.className = 'text-center text-muted';
emptyCell.textContent = 'No teachers found.';
emptyRow.appendChild(emptyCell);
+ for (var i = 0; i < 8; i++) {
+ emptyRow.appendChild(document.createElement('td'));
+ }
tbody.appendChild(emptyRow);
} else {
teachers.forEach(function (teacher, index) {
@@ -312,7 +322,10 @@ document.addEventListener('DOMContentLoaded', function () {
return;
}
- tbody.innerHTML = '| Loading... |
';
+ tbody.innerHTML = ''
+ + '| Loading... | '
+ + ' | | | | | | | | '
+ + '
';
var url = apiList + (selectedYear ? ('?schoolYear=' + encodeURIComponent(selectedYear)) : '');
fetch(url, {
diff --git a/app/Views/grading/homework_tracking.php b/app/Views/grading/homework_tracking.php
index 26a524d..9e2f32d 100644
--- a/app/Views/grading/homework_tracking.php
+++ b/app/Views/grading/homework_tracking.php
@@ -70,7 +70,8 @@ $todayYmd = local_date(utc_now(), 'Y-m-d');
| Grade |
Teacher & TAs |
- $label): $ymd = $sundays[$i] ?? ''; ?>
+ HW Submitted |
+ $label): $ymd = $sundays[$i] ?? ''; ?>
$todayYmd); ?>
= esc($label) ?> |
@@ -100,6 +101,9 @@ $todayYmd = local_date(utc_now(), 'Y-m-d');
TA= count($taNames) !== 1 ? 's' : '' ?>: = !empty($taNames) ? esc(implode(', ', $taNames)) : '—' ?>
+
+ = (int)($homeworkSubmissionCounts[$csid] ?? 0) ?>
+ |
— |