-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsubject.php
More file actions
120 lines (114 loc) · 4.22 KB
/
Copy pathsubject.php
File metadata and controls
120 lines (114 loc) · 4.22 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
<?php
ob_start();
include("partials/header.php");
include("partials/adminOnly.php");
// notification
if(isset($_SESSION['delete_subject'])){
echo '
<script type="text/javascript">
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "3000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
Command: toastr["error"]("'.$_SESSION['delete_subject'].'");
</script>';
unset($_SESSION['delete_subject']);
}
if(isset($_SESSION['update_subject'])){
echo '
<script type="text/javascript">
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "3000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
Command: toastr["success"]("'.$_SESSION['update_subject'].'");
</script>';
unset($_SESSION['update_subject']);
}
?>
<div class="container-fluid">
<div class="row g-0 my-2">
<div class="col-lg-4 col-md-4 col-sm-12">
<a href="<?php echo SITEURL ?>add_subject.php" class="btn text-capitalize text-white btn-success fs-6">
add subject
<i class="fa-solid fa-pen-to-square"></i>
</a>
</div>
</div>
<h4 class="text-uppercase fw-bold text-center mb-3 bg-primary text-white py-2 rounded">
SUBJECTS TAUGHT AT <?php echo htmlspecialchars($school_name); ?> PRIMARY SCHOOL
</h4>
<div class="row">
<div class="col-lg-12">
<table id="example" class="display">
<thead>
<tr>
<th>Sn</th>
<th>Subject Name</th>
<th>Short Code</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
// select data from subjects
$sql = "SELECT * FROM subjects";
$res = mysqli_query($conn, $sql);
if($res && mysqli_num_rows($res) > 0){
$sn = 1;
while($row = mysqli_fetch_assoc($res)){
$subject_id = $row['subject_id'];
$subject_name = $row['subject_name'];
$short_code = $row['short_code'] ?? ''; // fallback if null
?>
<tr>
<td><?php echo $sn++ ?></td>
<td><?php echo htmlspecialchars($subject_name) ?></td>
<td><?php echo htmlspecialchars($short_code) ?></td>
<td>
<a href="<?php echo SITEURL ?>edit_subject.php?subject_id=<?php echo $subject_id ?>" class="btn btn-primary">
<i class="fa-solid fa-pen-to-square"></i>
</a>
<a href="<?php echo SITEURL ?>delete_subject.php?subject_id=<?php echo $subject_id ?>"
class="btn btn-danger"
onclick="return confirm('Do you want to delete subject?')">
<i class="fa-solid fa-trash"></i>
</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php include("partials/footer.php"); ?>