This commit is contained in:
@@ -32,6 +32,12 @@ class StaffController extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
if ($redirect = $this->redirectWithoutLegacyTermFilters('staff/index')) {
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
$schoolYear = $this->currentSchoolYearName((string) ($this->schoolYear ?? ''));
|
||||
|
||||
// roles we never show
|
||||
$excludedRoles = ['student', 'parent', 'guest', 'inactive']; // ← add inactive here
|
||||
|
||||
@@ -45,7 +51,7 @@ class StaffController extends BaseController
|
||||
$assignRows = $this->teacherClassModel
|
||||
->select('teacher_class.teacher_id, teacher_class.position, classSection.class_section_name')
|
||||
->join('classSection', 'classSection.class_section_id = teacher_class.class_section_id', 'left')
|
||||
->where('teacher_class.school_year', (string)$this->schoolYear)
|
||||
->where('teacher_class.school_year', $schoolYear)
|
||||
->findAll();
|
||||
|
||||
$assignByTeacher = [];
|
||||
@@ -88,10 +94,31 @@ class StaffController extends BaseController
|
||||
'staff' => $staffList,
|
||||
'issues_count' => $issuesCount,
|
||||
'semester' => $this->semester,
|
||||
'school_year' => $this->schoolYear,
|
||||
'school_year' => $schoolYear,
|
||||
]);
|
||||
}
|
||||
|
||||
private function redirectWithoutLegacyTermFilters(string $route): ?\CodeIgniter\HTTP\RedirectResponse
|
||||
{
|
||||
$legacyTermKeys = ['school_year', 'schoolYear', 'year', 'semester'];
|
||||
$query = $this->request->getGet();
|
||||
$hasLegacyTermFilter = false;
|
||||
|
||||
foreach ($legacyTermKeys as $key) {
|
||||
if (array_key_exists($key, $query)) {
|
||||
unset($query[$key]);
|
||||
$hasLegacyTermFilter = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$hasLegacyTermFilter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$target = site_url($route) . (!empty($query) ? '?' . http_build_query($query) : '');
|
||||
return redirect()->to($target);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('staff/create');
|
||||
|
||||
Reference in New Issue
Block a user