-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutine.php
More file actions
106 lines (95 loc) · 3.53 KB
/
routine.php
File metadata and controls
106 lines (95 loc) · 3.53 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
<?php
include_once "./dbconn.php";
$query = "SELECT * FROM routine";
$stmt = $pdo->prepare($query);
$stmt->execute();
$periods = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Routine</title>
<link rel="stylesheet" href="./css/style.css">
<!-- font awesome cdn for icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
body {
font-family: 'Poppins', sans-serif;
}
th {
background-color: #131313;
color: #d0d0d0;
padding: 7.5px 20px;
}
tr {
transition: all 300ms ease-out;
}
table tr:hover {
background-color: hsl(203, 92%, 93%);
}
</style>
</head>
<body>
<center>
<h2>Routine</h2>
<div class="search">
<form action="./search.php" method="post">
<label for="search">Search: </label>
<input type="number" name="period" id="period">
<button type="submit">
<i class="fa-solid fa-magnifying-glass"></i>
</button>
</form>
</div>
<table>
<tr class="table-heading">
<th>Period</th>
<th>Subject Name</th>
<th>Teacher</th>
<th>Time</th>
<th>Action</th>
</tr>
<?php foreach ($periods as $p) {
// NOTE: 'H' gives the time in 24-hour format whereas 'h' gives the time in 12-hour format && 'A' gives AM and PM...
$formatted_start_time = date('h:i A', strtotime($p['Start_time']));
$formatted_end_time = date('h:i A', strtotime($p['End_time']));
?>
<tr>
<td align="center">
<?php echo $p['Period'] ?>
</td>
<td>
<?php echo $p['Subject_name'] ?>
</td>
<td>
<?php echo $p['Teacher'] ?>
</td>
<td>
<?php echo $formatted_start_time ?> -
<?php echo $formatted_end_time ?>
</td>
<td>
<a href="./form.php?period=<?php echo $p['Period'] ?>"><button class="btn btn-edit btn-for-row"
title="Edit this row"><i class="fas fa-edit"></i></button></a>
<!-- passing current period of the row from the table to the 'delete_row.php' file -->
<a href="./delete_row.php?period=<?php echo $p['Period'] ?>">
<button class="btn btn-del btn-for-row"><i class="fas fa-trash"
title="Delete this row"></i></button>
</a>
</td>
<?php } ?>
</tr>
</table>
</center>
<div class="btn-container">
<a href="./form.php?period=<?php 0 ?>"><button class="btn btn-add">Update</button></a>
<!-- <a href="./edit.php"><button class="btn btn-edit">Edit</button></a> -->
<a href="./delete.php"><button class="btn btn-del">Delete</button></a>
</div>
</body>
</html>