-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathassign_roles.php
More file actions
116 lines (115 loc) · 4.58 KB
/
Copy pathassign_roles.php
File metadata and controls
116 lines (115 loc) · 4.58 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
<?php ob_start();
include("partials/header.php");
include("partials/adminOnly.php") ?>
<?php
if(isset($_SESSION['delete_assign'])){
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['delete_assign'].'");
</script>
';
unset($_SESSION['delete_assign']);
}
if(isset($_SESSION['success'])){
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['success'].'");
</script>
';
unset($_SESSION['success']);
}
?>
<div class="container-fluid">
<!-- button to add class -->
<div class="row g-0 my-2">
<div class="col-lg-4 col-md-4 col-sm-12">
<a href="<?php echo SITEURL ?>addTeacher_assignment.php" class="btn text-capitalize text-white btn-success fs-6">
Asign Class
<i class="fa-solid fa-pen-to-square"></i>
</a>
</div>
<div class="col-12 mt-2">
<h4 class="text-uppercase fw-bold text-center mb-3 bg-primary text-white py-2 rounded">CLASS TEACHER ROLES AT <?php echo htmlspecialchars($school_name); ?> PRIMARY SCHOOL</h4>
</div>
<table id="example" class="display">
<thead>
<tr>
<th>Sn</th>
<th class="text-capitalize">teacher's Name</th>
<th class="text-capitalize">class</th>
<th class="text-capitalize">stream</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<!-- select data to populate table -->
<?php
$sql = "SELECT teacher_assignments.*,
users.username AS username,
classes.class_name AS className,
streams.stream_name AS streamName
FROM teacher_assignments
JOIN users ON users.user_id = teacher_assignments.user_id
JOIN classes ON classes.id = teacher_assignments.class_id
JOIN streams ON streams.id = teacher_assignments.stream_id
";
$res = mysqli_query($conn, $sql);
if($res && mysqli_num_rows($res) > 0){
$sn = 1;
while($row = mysqli_fetch_assoc($res)){
$assignment_id = $row['id'];
$userName = $row['username'];
$className = $row['className'];
$streamName = $row['streamName'];
?>
<tr>
<td><?php echo $sn++ ?></td>
<td><?php echo $userName ?></td>
<td><?php echo $className ?></td>
<td><?php echo $streamName ?></td>
<td>
<a href="<?php echo SITEURL ?>update_role.php?id=<?php echo $assignment_id ?>" class="btn btn-primary"><i class="fa-solid fa-pen-to-square"></i></a>
<a onclick="return confirm('Do you want to delete?')" href="<?php echo SITEURL ?>delete_assign.php?id=<?php echo $assignment_id?>" class="btn btn-danger"><i class="fa-solid fa-trash"></i></a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
<?php include('partials/footer.php') ?>