School Settings
+ + + + + + + + +Working Days
+Select the days your school operates. This will affect timetable generation.
+ +diff --git a/admin_school_settings.php b/admin_school_settings.php new file mode 100644 index 0000000..9efcea6 --- /dev/null +++ b/admin_school_settings.php @@ -0,0 +1,104 @@ +prepare("UPDATE schools SET working_days = ? WHERE id = ?"); + if ($stmt->execute([$working_days, $school_id])) { + $message = 'Settings updated successfully!'; + } else { + $error = 'Failed to update settings.'; + } + } catch (PDOException $e) { + $error = 'Database error: ' . $e->getMessage(); + } + } +} + +// Fetch school settings +$school_settings = null; +try { + $stmt = $pdo->prepare("SELECT * FROM schools WHERE id = ?"); + $stmt->execute([$school_id]); + $school_settings = $stmt->fetch(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $error = 'Database error: ' . $e->getMessage(); +} + +$current_working_days = $school_settings ? explode(',', $school_settings['working_days']) : []; +$all_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; + +?> + + +
+ + +Select the days your school operates. This will affect timetable generation.
+ +