/home/techb158/workloadmatch.com/Manager
Edit: /home/techb158/workloadmatch.com/Manager/teacher_report_visibility.php (15761B)
CMS | Teacher Report Visibility
verifyRequest();
$pages = ['reference_reports', 'accounting', 'secretarial', 'chat', 'unavailability', 'teacher_absence'];
foreach ($pages as $p) {
$visible = isset($_POST[$p]) ? 1 : 0;
$stmt = $mysqli->prepare("INSERT INTO teacher_report_visibility (Manager_ID, page_name, is_visible) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE is_visible = ?");
$stmt->bind_param('ssii', $Manager_ID, $p, $visible, $visible);
$stmt->execute();
$stmt->close();
}
set_flash_msg('Page visibility settings saved!', 'success');
header('Location: teacher_report_visibility.php');
exit();
}
// Handle dashboard visibility form
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_dashboard_visibility'])) {
$csrf->verifyRequest();
$dashSections = ['dashboard_welcome', 'dashboard_box_accounting', 'dashboard_box_secretarial', 'dashboard_box_assignments', 'dashboard_box_load', 'dashboard_upcoming_sessions'];
foreach ($dashSections as $ds) {
$visible = isset($_POST[$ds]) ? 1 : 0;
$stmt = $mysqli->prepare("INSERT INTO teacher_report_visibility (Manager_ID, page_name, is_visible) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE is_visible = ?");
$stmt->bind_param('ssii', $Manager_ID, $ds, $visible, $visible);
$stmt->execute();
$stmt->close();
}
set_flash_msg('Dashboard section visibility saved!', 'success');
header('Location: teacher_report_visibility.php');
exit();
}
?>
verifyRequest();
$profileFields = ['profile_note', 'preference_time'];
foreach ($profileFields as $pf) {
$visible = isset($_POST[$pf]) ? 1 : 0;
$stmt = $mysqli->prepare("INSERT INTO teacher_report_visibility (Manager_ID, page_name, is_visible) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE is_visible = ?");
$stmt->bind_param('ssii', $Manager_ID, $pf, $visible, $visible);
$stmt->execute();
$stmt->close();
}
set_flash_msg('Profile field visibility saved!', 'success');
header('Location: teacher_report_visibility.php');
exit();
}
?>
Enable or disable access to each page on the Teacher side. Disabled pages will show a "not available" message to teachers.
echoInputField(); ?>
['Reports', 'Schedule reports, assignment summaries, and workload hours'],
'accounting' => ['Accounting', 'Accounting course listings and preferences'],
'secretarial' => ['Secretarial', 'Secretarial course listings and preferences'],
'chat' => ['Chat', 'Teacher messaging and communication'],
'unavailability' => ['Unavailability', 'Allow teachers to submit unavailability requests for manager approval'],
'teacher_absence' => ['Absence / Leave', 'Allow teachers to submit absence/leave requests for manager approval'],
];
$current = [];
$stmt = $mysqli->prepare("SELECT page_name, is_visible FROM teacher_report_visibility WHERE Manager_ID = ?");
$stmt->bind_param('s', $Manager_ID);
$stmt->execute();
$res = $stmt->get_result();
while ($row = $res->fetch_assoc()) {
$current[$row['page_name']] = (int)$row['is_visible'];
}
$stmt->close();
foreach ($pages as $key => $info):
$checked = isset($current[$key]) ? $current[$key] : 1;
?>
Save Page Settings
Enable or disable each section on the Teacher dashboard. Disabled sections will be hidden entirely from the teacher's view.
echoInputField(); ?>
['Welcome Card', 'Teacher name, avatar, status, and semester stats overview'],
'dashboard_box_accounting' => ['Accounting Box', 'Accounting preferences count and link to Accounting page'],
'dashboard_box_secretarial' => ['Secretarial Box', 'Secretarial preferences count and link to Secretarial page'],
'dashboard_box_assignments' => ['Assignments Box', 'Total assignments count and link to Profile page'],
'dashboard_box_load' => ['Load Usage Box', 'Assigned hours progress bar and percentage'],
'dashboard_upcoming_sessions'=> ['Upcoming Sessions', 'List of upcoming course sessions'],
];
$dashCurrent = [];
$dsStmt = $mysqli->prepare("SELECT page_name, is_visible FROM teacher_report_visibility WHERE Manager_ID = ?");
$dsStmt->bind_param('s', $Manager_ID);
$dsStmt->execute();
$dsRes = $dsStmt->get_result();
while ($dsRow = $dsRes->fetch_assoc()) {
$dashCurrent[$dsRow['page_name']] = (int)$dsRow['is_visible'];
}
$dsStmt->close();
foreach ($dashSections as $key => $info):
$checked = isset($dashCurrent[$key]) ? $dashCurrent[$key] : 1;
?>
Save Dashboard Settings
Enable or disable individual fields on the Teacher's profile page. Disabled fields will be hidden from the teacher's view.
echoInputField(); ?>
['Profile Note', 'Notes about the teacher displayed on the profile page'],
'preference_time' => ['Preference Time', 'Preferred time slots (Morning, Afternoon, Evening)'],
];
$pfCurrent = [];
$pfStmt = $mysqli->prepare("SELECT page_name, is_visible FROM teacher_report_visibility WHERE Manager_ID = ?");
$pfStmt->bind_param('s', $Manager_ID);
$pfStmt->execute();
$pfRes = $pfStmt->get_result();
while ($pfRow = $pfRes->fetch_assoc()) {
$pfCurrent[$pfRow['page_name']] = (int)$pfRow['is_visible'];
}
$pfStmt->close();
foreach ($profileFields as $key => $info):
$checked = isset($pfCurrent[$key]) ? $pfCurrent[$key] : 1;
?>
Save Profile Settings
Page Visibility controls whether teachers can access entire feature pages. Disabled pages show an "unavailable" message to teachers.
Dashboard Sections controls which widgets appear on the Teacher's homepage dashboard. Disabled sections are completely hidden.
Profile Fields controls which fields are visible on the Teacher's profile page. When a field is disabled, it will only show on the info tab if existing data is present, and the edit field will be hidden.
Use these settings to gradually roll out features or to hide data while you are still working on schedules.