-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestpage1.php
More file actions
249 lines (228 loc) · 7.5 KB
/
Copy pathtestpage1.php
File metadata and controls
249 lines (228 loc) · 7.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?php
session_start();
require "config.php";
$teachers = $pdo->query("SELECT id, full_name FROM users WHERE role='teacher' ORDER BY full_name")->fetchAll();
$courses = $pdo->query("SELECT id, code, title FROM courses ORDER BY code")->fetchAll();
$subjects = $pdo->query("SELECT id, subject_title FROM course_subjects ORDER BY subject_title")->fetchAll();
$levels = $pdo->query("SELECT id, level_name FROM levels")->fetchAll();
$departments = $pdo->query("SELECT id, name FROM departments")->fetchAll();
$msg = '';
if (isset($_POST['save_timetable'])) {
$stmt = $pdo->prepare("INSERT INTO timetables
(day,start_time,end_time,course_id,subject_id,teacher_id,level_id,department_id,venue,start_date,end_date,recurring,is_published)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,0)");
$stmt->execute([
$_POST['day'], $_POST['start_time'], $_POST['end_time'],
$_POST['course_id'], $_POST['subject_id'], $_POST['teacher_id'],
$_POST['level_id'], $_POST['department_id'], $_POST['venue'],
$_POST['tt_start'], $_POST['tt_end'], 'weekly'
]);
$msg = "Timetable saved as draft";
}
if (isset($_POST['save_calendar'])) {
$stmt = $pdo->prepare("INSERT INTO academic_calendar
(title,description,start_date,end_date,is_published)
VALUES (?,?,?,?,0)");
$stmt->execute([
$_POST['title'], $_POST['description'],
$_POST['cal_start'], $_POST['cal_end']
]);
$msg = "Calendar event saved as draft";
}
if (isset($_POST['publish_all'])) {
$pdo->query("UPDATE timetables SET is_published=1");
$pdo->query("UPDATE academic_calendar SET is_published=1");
$msg = "Academic content published successfully";
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Academic Scheduler</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
:root{
--primary:#1e40af; /* deep academic blue */
--accent:#3b82f6; /* modern blue accent */
--success:#16a34a;
--bg1:#f8fafc; /* light background */
--bg2:#e2e8f0; /* subtle blue-gray */
--glass:rgba(255,255,255,.85);
--border:rgba(30,64,175,.15);
--text:#0f172a; /* dark academic text */
--muted:#475569;
}
*{box-sizing:border-box}
body{
margin:0;
font-family:Inter,system-ui,Segoe UI,Arial;
background:linear-gradient(135deg,var(--bg1),var(--bg2));
color:var(--text);
}
.container{max-width:1500px;margin:auto;padding:34px}
.header{
display:flex;justify-content:space-between;align-items:center;
margin-bottom:34px
}
.header h1{margin:0;font-size:2.2rem}
.header p{margin-top:6px;color:var(--muted)}
.glass{
background:var(--glass);
border:1px solid var(--border);
border-radius:22px;
backdrop-filter:blur(18px);
-webkit-backdrop-filter:blur(18px);
}
.alert{
margin-bottom:24px;padding:14px 20px;
border-radius:14px;background:rgba(16,185,129,.15);
border:1px solid rgba(16,185,129,.35);
color:#a7f3d0;font-weight:600
}
.grid{
display:grid;grid-template-columns:2fr 1.2fr;gap:30px
}
.card{padding:28px}
.card h2{margin:0 0 6px;font-size:1.45rem}
.card small{color:var(--muted)}
.section{margin-top:26px}
.section-title{font-size:.85rem;font-weight:700;color:#c7d2fe;margin-bottom:10px}
.two{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.three{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px}
input,select,textarea{
width:100%;padding:12px 14px;border-radius:14px;
background:rgba(255,255,255,.08);
border:1px solid var(--border);color:var(--text);
}
textarea{resize:vertical}
.btn{
margin-top:28px;width:100%;padding:15px;
border:none;border-radius:16px;font-weight:800;
background:linear-gradient(135deg,var(--primary),var(--accent));
color:#fff;cursor:pointer
}
.btn-success{
background:linear-gradient(135deg,#1e40af,#3b82f6);
}
.publish{
margin-top:36px;text-align:center;padding:34px
}
.badges{margin:18px 0}
.badge{
display:inline-block;
padding:8px 18px;
border-radius:999px;
background:rgba(59,130,246,.15); /* light blue */
border:1px solid rgba(59,130,246,.4);
color:#1e40af; /* deep blue text */
font-size:.8rem;
font-weight:700;
margin:0 6px;
}
@media(max-width:1100px){
.grid{grid-template-columns:1fr}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div>
<h1>Academic Scheduler</h1>
<p>Modern administration of timetable & academic calendar</p>
</div>
</div>
<?php if($msg): ?>
<div class="alert glass"><?= htmlspecialchars($msg) ?></div>
<?php endif; ?>
<div class="grid">
<div class="card glass">
<h2>Lecture Timetable</h2>
<small>Weekly scheduling with conflict-free planning</small>
<form method="post">
<div class="section">
<div class="section-title">Academic Structure</div>
<div class="three">
<select name="department_id" required>
<option value="">Department</option>
<?php foreach($departments as $d): ?>
<option value="<?= $d['id'] ?>"><?= $d['name'] ?></option>
<?php endforeach; ?>
</select>
<select name="level_id" required>
<option value="">Level</option>
<?php foreach($levels as $l): ?>
<option value="<?= $l['id'] ?>"><?= $l['level_name'] ?></option>
<?php endforeach; ?>
</select>
<select name="course_id" required>
<option value="">Course</option>
<?php foreach($courses as $c): ?>
<option value="<?= $c['id'] ?>"><?= $c['code'] ?></option>
<?php endforeach; ?>
</select>
</div>
<select name="subject_id" style="margin-top:14px" required>
<option value="">Subject</option>
<?php foreach($subjects as $s): ?>
<option value="<?= $s['id'] ?>"><?= $s['subject_title'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="section">
<div class="section-title">Schedule</div>
<div class="three">
<select name="day" required>
<option>Monday</option><option>Tuesday</option><option>Wednesday</option>
<option>Thursday</option><option>Friday</option><option>Saturday</option>
</select>
<input type="time" name="start_time" required>
<input type="time" name="end_time" required>
</div>
<div class="three" style="margin-top:14px">
<input name="venue" placeholder="Venue">
<input type="date" name="tt_start" required>
<input type="date" name="tt_end" required>
</div>
</div>
<div class="section">
<div class="section-title">Lecturer</div>
<select name="teacher_id" required>
<option value="">Select Lecturer</option>
<?php foreach($teachers as $t): ?>
<option value="<?= $t['id'] ?>"><?= $t['full_name'] ?></option>
<?php endforeach; ?>
</select>
</div>
<button class="btn" name="save_timetable">Save Timetable Draft</button>
</form>
</div>
<div class="card glass">
<h2>Academic Calendar</h2>
<small>Key academic events and milestones</small>
<form method="post">
<input name="title" placeholder="Event title" required>
<textarea name="description" rows="4" placeholder="Short description" style="margin-top:14px"></textarea>
<div class="two section">
<input type="date" name="cal_start" required>
<input type="date" name="cal_end" required>
</div>
<button class="btn" name="save_calendar">Save Calendar Draft</button>
</form>
</div>
</div>
<div class="publish glass">
<h2>Publish Academic Information</h2>
<p>Make timetable and calendar visible institution-wide</p>
<div class="badges">
<span class="badge">Timetable Draft</span>
<span class="badge">Calendar Draft</span>
</div>
<form method="post">
<button class="btn btn-success" name="publish_all">Publish Now</button>
</form>
</div>
</div>
</body>
</html>