forked from ChristyBiju/Student-Result-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage-subjcomb.php
136 lines (125 loc) · 4.02 KB
/
manage-subjcomb.php
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
<?php
session_start();
$showAlert = false;
$showError = false;
include "includes/connection.php";
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin']!=true){
header("location: index.php");
exit;
}
if(isset($_GET['acid']))
{
$acid=intval($_GET['acid']);
$status=1;
$sql = "UPDATE subject_comb set status = $status where comb_id = $acid";
$result = mysqli_query($conn, $sql);
$showAlert = true;
}
if(isset($_GET['did']))
{
$did=intval($_GET['did']);
$status=0;
$sql = "UPDATE subject_comb set status = $status where comb_id = $did";
$result = mysqli_query($conn, $sql);
$showAlert = true;
}
?>
<!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>Manage Subject Combinations</title>
<link rel="stylesheet" type="text/css" href="css/fp1.css?version=51">
<!-- <link rel="stylesheet" href="css/fp1.css?parameter=1" type="text/css" /> -->
<!-- Datatable plugin CSS file -->
<link rel="stylesheet" href=
"https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css" />
<!-- jQuery library file -->
<script type="text/javascript"
src="https://code.jquery.com/jquery-3.5.1.js">
</script>
<!-- Datatable plugin JS library file -->
<script type="text/javascript" src=
"https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js">
</script>
</head>
<body>
<?php include "nav.php";?>
<?php
if($showAlert){
echo '<script>alert("Subject Activated successfully!")</script>';
}
if($showError){
echo '<script>alert("Subject Deactivated successfully!")</script>';
}
?>
<div class="m2">
<h1 style="text-align:center;">Manage Subject Combinations</h1>
<h3 style="margin : 20px; margin-bottom:50px">* View Subject Combinations</h3>
<table id="tableID" class="display">
<thead >
<tr >
<th >#</th>
<th>Branch</th>
<th>Semester</th>
<th>Subject</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th >#</th>
<th>Branch</th>
<th>Semester</th>
<th>Subject</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
<tbody>
<?php
$sql = "SELECT branch.branch, semester.semester, subjects.subj_name, subject_comb.comb_id as scid, subject_comb.status from subject_comb join branch on subject_comb.branch_id = branch.branch_id join semester on subject_comb.sem_id = semester.sem_id join subjects on subjects.subj_id = subject_comb.subj_id order by semester";
$result = mysqli_query($conn, $sql);
$c = 1;
$num = mysqli_num_rows($result);
if($num > 0){
while($row = mysqli_fetch_assoc($result)){
?>
<tr>
<td><?php echo $c;?></td>
<td><?php echo $row['branch'];?></td>
<td><?php echo $row['semester'];?></td>
<td><?php echo $row['subj_name'];?></td>
<td><?php if($row['status'] == 1){
echo "Active";
}
else{
echo "Blocked";
};?></td>
<td>
<?php if($row['status']=='0')
{ ?>
<a href="manage-subjcomb.php?acid=<?php echo $row['scid'];?>" onclick="confirm('Do you really want to ativate this subject');"><i class="fa fa-check" title="Acticvate Record"></i> </a><?php } else {?>
<a href="manage-subjcomb.php?did=<?php echo $row['scid'];?>" onclick="confirm('Do you really want to deativate this subject');"><i class="fa fa-times" title="Deactivate Record"></i> </a>
<?php }?>
</td>
</tr>
<?php
$c++;
}
}
?>
</tbody>
</table>
<script>
/* Initialization of datatable */
$(document).ready(function() {
$('#tableID').DataTable({ });
});
</script>
</div>
</body>
</html>