/home/techb158/workloadmatch.com/workloadmatch.com/BackUp/Manager
NameSizeModeActions
core/-0755rm
css/-0755rm
data/-0755rm
fonts/-0755rm
Inc/-0755rm
js/-0755rm
php/-0755rm
accesscontrol.php160390644editdlrm
AddClient.php39300644editdlrm
addcourse.php177360644editdlrm
addcoursesession.php205280644editdlrm
addcoursetime.php173050644editdlrm
addgroup - Copy.php212120644editdlrm
addgroup.php229990644editdlrm
addgroup1.php206670644editdlrm
addholiday.php180190644editdlrm
addmanager.php187650644editdlrm
addremediation.php178770644editdlrm
addretake.php219140644editdlrm
adduser.php300790644editdlrm
adduser1.php235270644editdlrm
Add_Course_Session.php65290644editdlrm
add_event.php19600644editdlrm
Add_Teacher_Unavailability.php17460644editdlrm
adminreports.php162190644editdlrm
AI_Generate_Schedule - Copy.php122170644editdlrm
AI_Generate_Schedule.php107310644editdlrm
ajax_course_group_Backup.php172700644editdlrm
ajax_course_group_Backup_1.php187420644editdlrm
ajax_fetch_schedule.php37600644editdlrm
ajax_get_group_slots.php8720644editdlrm
ajax_replace_saturday -Completed.php187390644editdlrm
ajax_replace_saturday - Copy (2).php187390644editdlrm
ajax_replace_saturday - Copy (3).php265540644editdlrm
ajax_replace_saturday - Copy (4).php266150644editdlrm
ajax_replace_saturday - Copy (5).php283740644editdlrm
ajax_replace_saturday - Copy.php134520644editdlrm
ajax_replace_saturday - Good.php172700644editdlrm
ajax_replace_saturday.php307790644editdlrm
ajax_swap_courses.php42790644editdlrm
assign_course_group-BackUp.php213310644editdlrm
assign_course_group - Copy (BackUp).php183150644editdlrm
assign_course_group - Copy.php213180644editdlrm
assign_course_group.php183150644editdlrm
assign_course_group1.php209620644editdlrm
Assign_Course_Report.php13750644editdlrm
assign_teacher_manual-1.php210950644editdlrm
assign_teacher_manual - Copy (2).php223280644editdlrm
assign_teacher_manual - Copy.php223880644editdlrm
assign_teacher_manual-Not work.php205850644editdlrm
assign_teacher_manual.php223280644editdlrm
assign_teacher_manual_force_conflicts.php223590644editdlrm
availableteacherreport.php137180644editdlrm
Available_Teacher_Report - Copy.php22360644editdlrm
Available_Teacher_Report.php76910644editdlrm
brokerreports.php163180644editdlrm
calendar - Copy (2).php168910644editdlrm
calendar - Copy.php231930644editdlrm
calendar.php306530644editdlrm
changestatus.php8650644editdlrm
Check_if_Teacher_Report.php15870644editdlrm
complete_schedule_report_by_teacher.php193120644editdlrm
courseflagtime.php34110644editdlrm
Create_Group_Schedule_Algorithm.php38280644editdlrm
Create_Schedule_Algorithm - Copy (2).php414120644editdlrm
Create_Schedule_Algorithm - Copy (3).php463520644editdlrm
Create_Schedule_Algorithm - Copy (4).php535690644editdlrm
Create_Schedule_Algorithm - Copy (5).php679560644editdlrm
Create_Schedule_Algorithm - Copy (6).php711340644editdlrm
Create_Schedule_Algorithm - Copy (7).php725290644editdlrm
Create_Schedule_Algorithm - Copy (8).php730840644editdlrm
Create_Schedule_Algorithm - Copy (9).php735770644editdlrm
Create_Schedule_Algorithm - Copy (10).php765050644editdlrm
Create_Schedule_Algorithm - Copy (11).php767640644editdlrm
Create_Schedule_Algorithm - Copy (12).php863240644editdlrm
Create_Schedule_Algorithm - Copy (13).php831330644editdlrm
Create_Schedule_Algorithm - Copy (14).php872740644editdlrm
Create_Schedule_Algorithm - Copy (get info only).php697470644editdlrm
Create_Schedule_Algorithm - Copy (with 2 course 2nd SPECIAL ).php823140644editdlrm
Create_Schedule_Algorithm - Copy.php405810644editdlrm
Create_Schedule_Algorithm.php882760644editdlrm
Create_Schedule_Algorithm_1.php414120644editdlrm
Create_Schedule_Algorithm_2.php765050644editdlrm
Create_Schedule_Algorithm_2_combined.php897640644editdlrm
Create_Schedule_Algorithm_2_combined_both_slots.php919320644editdlrm
Create_Schedule_Algorithm_2_fixed.php768290644editdlrm
Create_Schedule_Algorithm_3.php872740644editdlrm
Create_Schedule_Algorithm_4.php872740644editdlrm
dashboard-BackUp.php188060644editdlrm
dashboard.php225070644editdlrm
deleteschedulefromgroup.php168190644editdlrm
delete_course.php5800644editdlrm
delete_course_from_teacher.php49900644editdlrm
delete_course_from_teacher_backup.php30940644editdlrm
delete_event.php12120644editdlrm
delete_group.php18580644editdlrm
delete_holiday.php7150644editdlrm
delete_retake.php12760644editdlrm
delete_schedule_from_group-1.php18700644editdlrm
delete_schedule_from_group.php18500644editdlrm
delete_teacher_level.php7980644editdlrm
delete_teacher_unavailability.php13470644editdlrm
delete_timeslot.php5970644editdlrm
display_schedule-1.php188460644editdlrm
display_schedule.php188460644editdlrm
do_remove_saturday.php61700644editdlrm
edit_event.php16120644editdlrm
error_log740700644editdlrm
examschedulereport.php162670644editdlrm
Exam_Schedule_Report.php26770644editdlrm
export_absences.php12210644editdlrm
fetch_all_scheduled_courses.php63180644editdlrm
fetch_courses - BackUp.php97110644editdlrm
fetch_courses - Copy.php77190644editdlrm
fetch_courses.php91670644editdlrm
fetch_courses_for_program.php7880644editdlrm
fetch_courses_for_program_by_schedule - Copy.php22970644editdlrm
fetch_courses_for_program_by_schedule.php39350644editdlrm
fetch_courses_teacher_preference.php38520644editdlrm
fetch_course_for_added_group.php8970644editdlrm
fetch_course_hours.php6910644editdlrm
fetch_disabled_dates.php5180644editdlrm
fetch_events.php9750644editdlrm
fetch_exist_dates.php10990644editdlrm
fetch_groups_exist_in_schedule.php9560644editdlrm
fetch_groups_for_program.php8430644editdlrm
fetch_group_timeslot.php8470644editdlrm
fetch_reserve_courses.php74290644editdlrm
fetch_retake_courses.php9230644editdlrm
fetch_scheduled_courses.php21780644editdlrm
fetch_schedule_report_by_group.php54400644editdlrm
fetch_teachers_by_group.php44210644editdlrm
fetch_teachers_by_program.php18210644editdlrm
fetch_teachers_for_group.php31700644editdlrm
fetch_teacher_assignment.php247760644editdlrm
fetch_teacher_by_course.php38800644editdlrm
fetch_teacher_conflicts.php56820644editdlrm
fetch_teacher_conflicts_only.php76650644editdlrm
fetch_teacher_conflicts_only_force_conflicts.php71140644editdlrm
fetch_teacher_conflicts_showonly.php104470644editdlrm
fetch_teacher_load.php14820644editdlrm
fetch_teacher_prefrence_courses_accounting.php16060644editdlrm
find_replacement-1.php160750644editdlrm
find_replacement.php181610644editdlrm
followup.php161600644editdlrm
Generate Group Schedule.php169870644editdlrm
Generate Group Schedule 1.php181210644editdlrm
generateschedule.php157060644editdlrm
Generate_Schedule.php336200644editdlrm
generate_schedule_handler.php70950644editdlrm
Generate_Schedule_Script.php297310644editdlrm
getlang.php3260644editdlrm
getrefer.php43490644editdlrm
getstatus.php12600644editdlrm
get_groups_by_program.php6080644editdlrm
get_schedule_ai-1.php377550644editdlrm
get_schedule_ai - Copy.php364590644editdlrm
get_schedule_ai.php368550644editdlrm
get_schedule_report.php23930644editdlrm
group_schedule_form - Copy.php169940644editdlrm
group_schedule_form.php169940644editdlrm
main-header-inc.php11960644editdlrm
main-header.php166710644editdlrm
managecategory.php92330644editdlrm
managerreports.php250560644editdlrm
Preference_Accounting.php225030644editdlrm
profile.php206800644editdlrm
reference_list.php82070644editdlrm
remove_saturday_course.php195030644editdlrm
report_absence.php192870644editdlrm
report_absence_1.php61600644editdlrm
reserve_course.php189570644editdlrm
rewrite_ajax_replace_saturday.php128000644editdlrm
rewrite_Create_Schedule_Algorithm.php883180644editdlrm
rewrite_Create_Schedule_Algorithm_2.php889000644editdlrm
save_schedule.php29700644editdlrm
save_schedule_group_course.php253670644editdlrm
schedulereportbygroup.php177310644editdlrm
schedulereportbyteacher.php191110644editdlrm
scheduleteacherbygroupreport - Copy.php319860644editdlrm
scheduleteacherbygroupreport.php365560644editdlrm
scheduleteacherreport.php281500644editdlrm
schedule_report.php176640644editdlrm
Schedule_Report_by_Group.php36470644editdlrm
Schedule_Report_by_Teacher.php924330644editdlrm
selectuser.php11720644editdlrm
swapcourses.php194690644editdlrm
teacher_preference.php181820644editdlrm
teacher_preference_by_course.php192440644editdlrm
teacher_unavailability.php178350644editdlrm
test.php138950644editdlrm
test1.php218370644editdlrm
transfer_reference.php272880644editdlrm
unassigncoursereport.php160290644editdlrm
unassign_course.php190110644editdlrm
Unassign_Course_Report.php16970644editdlrm
unscheduledgroupreport.php156750644editdlrm
Unscheduled_Group_Report.php20070644editdlrm
updateclient.php147650644editdlrm
updatecourse.php216260644editdlrm
updatecoursesessionhours.php181970644editdlrm
updatecoursetime.php218310644editdlrm
updategroup - Copy.php245340644editdlrm
updategroup.php180010644editdlrm
updateholiday.php224930644editdlrm
updateteacherlevel.php245320644editdlrm
updateteacherunavailability.php141840644editdlrm
UpdateUser.php182140644editdlrm
Update_Course_Hours.php21350644editdlrm
Update_Follow_Up.php46180644editdlrm
update_reserve_course.php19340644editdlrm
update_teacher_level25080644editdlrm
update_teacher_level.php24300644editdlrm
useraccesslist.php128750644editdlrm
users.php90490644editdlrm
view_swap_log.php8940644editdlrm
Edit: /home/techb158/workloadmatch.com/workloadmatch.com/BackUp/Manager/scheduleteacherreport.php (28150B)
Schedule Teacher Report

Schedule Teacher Report

prepare("SELECT Time_From, Time_To FROM Group_Slot_Mapping WHERE Group_ID = ? AND LOWER(TRIM(Time_Slot)) = LOWER(TRIM(?)) LIMIT 1"); $stmt->bind_param("is", $groupId, $slotFormatted); $stmt->execute(); $res = $stmt->get_result()->fetch_assoc(); $stmt->close(); if ($res) { return date('h:i A', strtotime($res['Time_From'])) . ' - ' . date('h:i A', strtotime($res['Time_To'])); } return '-'; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['Teacher_ID'])) { $teacherID = (int) $_POST['Teacher_ID']; $programID = (!empty($_POST['Program_ID']) && $_POST['Program_ID'] !== "all") ? (int) $_POST['Program_ID'] : null; // 1. Load all holidays relevant to this teacher’s scheduled sessions $holidays = []; $res = $mysqli->query(" SELECT Event_Title, Event_Start, Event_End, Event_Color FROM Events "); while ($row = $res->fetch_assoc()) { $start = new DateTime($row['Event_Start']); $end = new DateTime($row['Event_End']); while ($start <= $end) { $d = $start->format('Y-m-d'); $holidays[$d] = [ 'title' => $row['Event_Title'], 'color' => $row['Event_Color'] ?: '#FFD700' ]; $start->modify('+1 day'); } } // 2. Retake Records — pulled from all groups this teacher has $retakes = []; $stmt = $mysqli->prepare(" SELECT rr.Type, rr.Retake_Date FROM Retake_Records rr JOIN manager_group_name g ON rr.Group_ID = g.Group_ID JOIN Schedule_Course_for_Group scg ON rr.Group_ID = scg.Group_ID JOIN teacher_course_assignments tca ON tca.Schedule_ID = scg.Schedule_ID WHERE tca.Teacher_ID = ? "); $stmt->bind_param("i", $teacherID); $stmt->execute(); $stmt->bind_result($type, $retakeDate); while ($stmt->fetch()) { $retakes[$retakeDate] = $type; } $stmt->close(); // 3. Exam Dates $examDates = []; $query = " SELECT scg.Course_ID, MAX(scg.End_Date) FROM Schedule_Course_for_Group scg JOIN teacher_course_assignments tca ON scg.Schedule_ID = tca.Schedule_ID WHERE tca.Teacher_ID = ? "; if ($programID) { $query .= " AND scg.Program_ID = ?"; } $query .= " GROUP BY scg.Course_ID"; $stmt = $mysqli->prepare($query); if ($programID) { $stmt->bind_param("ii", $teacherID, $programID); } else { $stmt->bind_param("i", $teacherID); } $stmt->execute(); $stmt->bind_result($courseID, $examDate); while ($stmt->fetch()) { $examDates[$courseID] = $examDate; } $stmt->close(); // 4. Sessions Assigned to Teacher $scheduleRows = []; $query = " SELECT scg.Schedule_ID, scg.Course_ID, scg.Course_Name, scg.Reserve_Course, scg.Start_Date, scg.End_Date, gsm.Time_Slot, gsm.Time_From, gsm.Time_To, g.Group_Name FROM Schedule_Course_for_Group AS scg JOIN Group_Slot_Mapping AS gsm ON scg.Group_Slot_ID = gsm.Group_Slot_ID JOIN teacher_course_assignments AS tca ON scg.Schedule_ID = tca.Schedule_ID JOIN manager_group_name AS g ON scg.Group_ID = g.Group_ID WHERE tca.Teacher_ID = ? "; if ($programID) { $query .= " AND scg.Program_ID = ?"; } $query .= " ORDER BY scg.Start_Date, scg.Start_Time"; $stmt = $mysqli->prepare($query); if ($programID) { $stmt->bind_param("ii", $teacherID, $programID); } else { $stmt->bind_param("i", $teacherID); } $stmt->execute(); $stmt->bind_result( $scheduleID, $courseID, $courseName, $reserveCourse, $startDate, $endDate, $slotLabel, $slotFrom, $slotTo, $groupName ); while ($stmt->fetch()) { $scheduleRows[] = [ 'schedule_id' => $scheduleID, 'course_id' => $courseID, 'course_name' => $courseName, 'reserve' => $reserveCourse, 'start_date' => $startDate, 'end_date' => $endDate, 'slot' => $slotLabel, 'from' => $slotFrom, 'to' => $slotTo, 'teacher' => '-', // you can add name if needed 'group' => $groupName ]; } $stmt->close(); // 5. Group by Date $byDate = []; foreach ($scheduleRows as $r) { $period = new DatePeriod( new DateTime($r['start_date']), new DateInterval('P1D'), (new DateTime($r['end_date']))->modify('+1 day') ); foreach ($period as $dt) { $current = $dt->format('Y-m-d'); $byDate[$current][] = $r; } } // 6. Merge All Dates $allDates = array_unique(array_merge(array_keys($byDate), array_keys($holidays), array_keys($retakes))); sort($allDates); // 7. Render Table echo ""; echo ""; foreach ($allDates as $date) { $dayName = date('l', strtotime($date)); $isHoliday = isset($holidays[$date]); $isRetake = isset($retakes[$date]); if ($isHoliday && !isset($byDate[$date])) { $h = $holidays[$date]; echo ""; continue; } if ($isRetake && !isset($byDate[$date])) { echo ""; continue; } foreach ($byDate[$date] as $r) { $isExam = isset($examDates[$r['course_id']]) && $examDates[$r['course_id']] === $date; $type = $isExam ? 'Exam Day' : 'Regular'; $style = $isExam ? "style='background-color:#FFCCCC; font-weight:bold;'" : ""; $timeRange = date("h:i A", strtotime($r['from'])) . " – " . date("h:i A", strtotime($r['to'])); echo ""; } } echo "
Date Time Slot Course Group Time Type
($dayName) $date " . htmlspecialchars($h['title']) . " Holiday
($dayName) $date Retake Session " . htmlspecialchars($retakes[$date]) . "
($dayName) $date {$r['slot']} " . htmlspecialchars($r['course_name']) . " " . htmlspecialchars($r['group']) . " {$timeRange} {$type}
"; } /** if (isset($_POST["Teacher_ID"])) { $Teacher_ID = intval($_POST['Teacher_ID']); $Program_ID_Filter = (!empty($_POST['Program_ID']) && $_POST['Program_ID'] !== "all") ? intval($_POST['Program_ID']) : null; // 1. Assignments $whereAssignments = "WHERE tca.Teacher_ID = ?"; $params = ["i", $Teacher_ID]; if ($Program_ID_Filter) { $whereAssignments .= " AND tca.Program_ID = ?"; $params[0] .= "i"; $params[] = $Program_ID_Filter; } $query = "SELECT tca.*, c.Course_Name, scg.Group_ID, scg.Start_Date, scg.End_Date, scg.Time_Slot, scg.Start_Time, scg.End_Time, g.Group_Name, g.Weekend_Class, g.class_days FROM teacher_course_assignments tca JOIN Courses c ON tca.Course_ID = c.Course_ID JOIN Schedule_Course_for_Group scg ON tca.Schedule_ID = scg.Schedule_ID JOIN manager_group_name g ON scg.Group_ID = g.Group_ID $whereAssignments"; $stmt = $mysqli->prepare($query); if (!$stmt) { die("Prepare failed (Assignments): " . $mysqli->error . "\nQuery: $query"); } $stmt->bind_param(...$params); $stmt->execute(); $assignments = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); $stmt->close(); // 2. Replacements $whereReplacements = "WHERE tra.Replacing_Teacher_ID = ?"; $paramsRep = ["i", $Teacher_ID]; if ($Program_ID_Filter) { $whereReplacements .= " AND c.Program_ID = ?"; $paramsRep[0] .= "i"; $paramsRep[] = $Program_ID_Filter; } $query = "SELECT tra.*, c.Course_Name, scg.Group_ID, scg.Start_Date AS Replacement_From, scg.End_Date AS Replacement_To, scg.Time_Slot, scg.Start_Time, scg.End_Time, g.Group_Name, g.Weekend_Class, g.class_days FROM teacher_replacement_assignments tra JOIN Schedule_Course_for_Group scg ON tra.Schedule_ID = scg.Schedule_ID JOIN Courses c ON scg.Course_ID = c.Course_ID JOIN manager_group_name g ON scg.Group_ID = g.Group_ID $whereReplacements"; $stmt = $mysqli->prepare($query); if (!$stmt) { die("Prepare failed (Replacements): " . $mysqli->error . "\nQuery: $query"); } $stmt->bind_param(...$paramsRep); $stmt->execute(); $replacements = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); $stmt->close(); // 3. Absences $stmt = $mysqli->prepare("SELECT Absence_From, Absence_To FROM teacher_absences WHERE Teacher_ID = ?"); $stmt->bind_param("i", $Teacher_ID); $stmt->execute(); $absences = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); $stmt->close(); // 4. Retake Dates $groupIDs = array_unique(array_column($assignments, 'Group_ID')); $retakeMap = []; foreach ($groupIDs as $groupID) { $stmt = $mysqli->prepare(" SELECT rr.Retake_Date, tsp.Time_Slot, g.Group_Name FROM Retake_Records rr JOIN Time_Slot_Programs tsp ON rr.Time_Slot_Programs_ID = tsp.Time_Slot_Programs_ID JOIN manager_group_name g ON rr.Group_ID = g.Group_ID WHERE rr.Group_ID = ? "); $stmt->bind_param("i", $groupID); $stmt->execute(); $res = $stmt->get_result(); while ($r = $res->fetch_assoc()) { $retakeMap[$r['Retake_Date']][] = [ 'Time_Slot' => $r['Time_Slot'], 'Group_Name' => $r['Group_Name'] ]; } $stmt->close(); } // 5. Holidays $holidayMap = []; $res = $mysqli->query("SELECT Event_Title, Event_Start, Event_End, Event_Color FROM Events"); while ($event = $res->fetch_assoc()) { $start = new DateTime($event['Event_Start']); $end = (new DateTime($event['Event_End']))->modify('+1 day'); foreach (new DatePeriod($start, new DateInterval('P1D'), $end) as $dt) { $holidayMap[$dt->format('Y-m-d')] = [ 'title' => $event['Event_Title'], 'color' => $event['Event_Color'] ]; } } // 6. Build date range from real dates $dates = array_merge( array_column($assignments, 'Start_Date'), array_column($replacements, 'Replacement_From'), array_column($replacements, 'Replacement_To'), array_keys($retakeMap) ); if (empty($dates)) { echo "
No schedule found for this teacher.
"; exit; } $start = new DateTime(min($dates)); $end = (new DateTime(max($dates)))->modify('+1 day'); $range = new DatePeriod($start, new DateInterval('P1D'), $end); // 7. Display report echo "
"; echo ""; foreach ($range as $date) { $current = $date->format('Y-m-d'); $day = $date->format('l'); $shown = false; // Holiday if (isset($holidayMap[$current])) { echo ""; continue; } // Retake if (isset($retakeMap[$current])) { foreach ($retakeMap[$current] as $retake) { $slotLabel = format_time_slot_label($retake['Time_Slot'], $day); $time = ($day === 'Saturday') ? '09:00 AM - 01:00 PM' : get_group_slot_time($groupIDs[0], $retake['Time_Slot'], $mysqli); $groupName = $retake['Group_Name']; echo ""; } continue; } // Absences foreach ($absences as $abs) { if ($current >= $abs['Absence_From'] && $current <= $abs['Absence_To']) { echo ""; $shown = true; break; } } if ($shown) continue; // Replacements foreach ($replacements as $r) { if ($current >= $r['Replacement_From'] && $current <= $r['Replacement_To']) { $time = format_time_slot($r['Time_Slot'], $r['Start_Time'], $r['End_Time'], $day); $slotLabel = format_time_slot_label($r['Time_Slot'], $day); echo ""; $shown = true; } } if ($shown) continue; // Regular Assignments foreach ($assignments as $a) { if ($current == $a['Start_Date']) { $type = ($current == $a['End_Date']) ? 'Exam Day' : 'Regular'; $bg = ($type === 'Exam Day') ? "style='background-color:#ffeeba'" : ""; $time = format_time_slot($a['Time_Slot'], $a['Start_Time'], $a['End_Time'], $day); $slotLabel = format_time_slot_label($a['Time_Slot'], $day); echo ""; $shown = true; } } // Free day if (!$shown) { echo ""; } } echo "
DateCourseGroupTime SlotTimeType
$current{$holidayMap[$current]['title']}---Holiday
$current Retake $groupName $slotLabel $time Retake
$currentTeacher Absent---Absent
$current{$r['Course_Name']}{$r['Group_Name']}{$slotLabel}{$time}Replacement
$current{$a['Course_Name']}{$a['Group_Name']}{$slotLabel}{$time}{$type}
$currentNo Class---Free
"; } **/ ?>