exam draft fix
This commit is contained in:
@@ -95,6 +95,11 @@ class LandingPageController extends BaseController
|
||||
return null;
|
||||
}
|
||||
|
||||
// Teacher class sections only apply to the teacher role; other roles have no teacher_class rows.
|
||||
if (strtolower(trim((string) $this->getUserRole())) !== 'teacher') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get all class assignments for this teacher in the current term
|
||||
$assignments = $this->teacherClassModel->getClassAssignmentsByUserId(
|
||||
(int)$user_id,
|
||||
@@ -106,7 +111,7 @@ class LandingPageController extends BaseController
|
||||
$ids = array_values(array_filter(array_unique($ids)));
|
||||
|
||||
if (empty($ids)) {
|
||||
log_message('error', "No class section found for user ID: $user_id");
|
||||
log_message('warning', "No class section found for user ID: $user_id");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -868,8 +873,12 @@ class LandingPageController extends BaseController
|
||||
|
||||
protected function getUserRole()
|
||||
{
|
||||
// Assuming you have a session variable storing the user role
|
||||
return session()->get('user_role', 'guest'); // Default to guest if not set
|
||||
$active = session()->get('active_role');
|
||||
if ($active !== null && $active !== '') {
|
||||
return (string) $active;
|
||||
}
|
||||
|
||||
return (string) (session()->get('role') ?? 'guest');
|
||||
}
|
||||
|
||||
protected function getUserRoleFromDatabase($user_id)
|
||||
|
||||
Reference in New Issue
Block a user