/home/techb158/workloadmatch.com/api
NameSizeModeActions
chat/-0755rm
notifications/-0755rm
reports/-0755rm
routes/-0700rm
teacher/-0755rm
.htaccess7620644editdlrm
admin.php331100644editdlrm
api_functions.php214740644editdlrm
Auth.php45040644editdlrm
change_status.php13320644editdlrm
cors_test.php1840644editdlrm
Database.php9740644editdlrm
db_connect.php6230644editdlrm
forgetpassword.php74150644editdlrm
index.php239320644editdlrm
logout.php11670644editdlrm
psl-config.php3500644editdlrm
reports_schedule_by_course.php12870644editdlrm
reports_schedule_by_group.php13520644editdlrm
Response.php19380644editdlrm
tasks.php29930644editdlrm
teacher_profile.php11770644editdlrm
test.php11130644editdlrm
Edit: /home/techb158/workloadmatch.com/api/tasks.php (2993B)
0, 'items' => [], 'debug' => 'no user']); exit; } $user_type = $_GET['user_type'] ?? 'manager'; $items = []; $totalCount = 0; $errors = []; if ($user_type === 'manager') { // Unassigned course sessions $stmt = $mysqli->prepare(" SELECT COUNT(DISTINCT CONCAT(scg.Course_ID, '-', scg.Group_ID)) AS task_count FROM schedule_course_for_group scg JOIN manager_group_name mgn ON mgn.Group_ID = scg.Group_ID WHERE scg.Assigned = 0 AND mgn.Manager_ID = ? "); if ($stmt) { $stmt->bind_param("i", $userId); if ($stmt->execute()) { $r = $stmt->get_result()->fetch_assoc(); if ($r && (int)$r['task_count'] > 0) { $c = (int)$r['task_count']; $totalCount += $c; $items[] = [ 'icon' => 'fa fa-user-plus text-yellow', 'text' => $c . ' unassigned course' . ($c > 1 ? 's' : ''), 'preview' => 'Assign teachers', 'link' => 'assign_teacher_manual.php' ]; } } else { $errors[] = 'tasks1 execute: ' . $stmt->error; } $stmt->close(); } else { $errors[] = 'tasks1 prepare: ' . $mysqli->error; } } else { // Teacher: today's courses $today = date('Y-m-d'); $stmt = $mysqli->prepare(" SELECT COUNT(*) AS cnt FROM schedule_course_for_group scg JOIN teacher_course_assignments tca ON tca.Schedule_ID = scg.Schedule_ID WHERE tca.Teacher_ID = ? AND scg.Start_Date = ? "); if ($stmt) { $stmt->bind_param("is", $userId, $today); if ($stmt->execute()) { $r = $stmt->get_result()->fetch_assoc(); if ($r && (int)$r['cnt'] > 0) { $c = (int)$r['cnt']; $totalCount += 1; $items[] = [ 'icon' => 'fa fa-calendar-check-o text-green', 'text' => $c . ' course' . ($c > 1 ? 's' : '') . ' today', 'preview' => 'View schedule', 'link' => 'dashboard.php' ]; } } else { $errors[] = 'tasks2 execute: ' . $stmt->error; } $stmt->close(); } else { $errors[] = 'tasks2 prepare: ' . $mysqli->error; } } if (empty($items)) { $items[] = [ 'icon' => 'fa fa-check-circle text-green', 'text' => 'All clear', 'preview' => '', 'link' => '#' ]; } echo json_encode(['count' => $totalCount, 'items' => $items, 'debug' => $errors]); $mysqli->close();