-
Notifications
You must be signed in to change notification settings - Fork 3
/
admin_batch.php
381 lines (267 loc) · 10.3 KB
/
admin_batch.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
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!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">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Greendale College</title>
<link rel="icon" type="image/png" href="photos/header.png">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 210px;
background-color: #0b1f5f;
}
li a {
display: block;
color: white;
padding: 8px 16px;
text-decoration: none;
}
li a.active {
background-color:blue;
color: white;
}
li a:hover:not(.active) {
background-color:skyblue;
color: white;
}
* {box-sizing: border-box;}
body {font-family: Verdana, sans-serif;}
.mySlides {display: none;}
img {vertical-align: middle;}
/* Slideshow container */
.slideshow-container {
max-width: 1000px;
margin: auto;
}
/* Fading animation */
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 5.5s;
animation-name: fade;
animation-duration: 5.5s;
}
@-webkit-keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
/* On smaller screens, decrease text size */
@media only screen and (max-width: 300px) {
.text {font-size: 11px}
}
</style>
</head>
<body style="background-color: grey; margin-top: -20px">
<?php
session_start();
include "DBconnection.php";
if(!isset($_SESSION['email']))
{
header("location:adminloginindex.php");
}
else
{
$email = $_SESSION['email'];
$result = mysqli_query($conn,"SELECT * FROM admins WHERE admin_email='" . $email."'");
$row = mysqli_fetch_array($result);
if($row >0)
{
$name=$row['admin_name'];
$pic =$row['admin_picture'];
$password =$row['admin_password'];
$year =$row['admin_year'];
$birthday =$row['admin_birthday'];
$NIC =$row['admin_NIC'];
$id = $_SESSION['id'];
}
if($row >0)
{
$mysqli = new mysqli('localhost','root','','greendale') or die(mysqli_error($mysqli));
$result = $mysqli->query("SELECT * FROM student_batches ") or die ($mysqli->erorr);
}
}
?>
<div class="div_content_admin">
<div class="header_admin">
<div style="margin-right:10px;vertical-align:bottom;">
<table align="right" width="450">
<tr><td>
<div align="right" style="font-size:24px;padding-top:23px; ">
<a href="administratorindex.php" style="color: aliceblue">Home</a>
<a href="userLogoutadmin.php" style="color:blue">Logout</a>
<hr>
<div align="right" style="font-size:20px; padding: 10px; color: aliceblue">
Admin - <?php echo $name;?>
<img class="img-rounded" style="border-radius: 50%" width="50px" height="50px" src="adminImage/<?php echo $pic;?>"> </div>
</td></tr>
</table>
</div>
</div>
<div class="div_header_title_admin">
<div align="left" style="font-size:20px; padding: 10px; color: aliceblue">
Welcome
</div>
</div>
<div class="mainframe" style="background-color:#0b1f5f" >
<div class="section1_admin" >
<ul>
<li><div><a href="adminmyprofile.php">View Profile</a></div></li>
<li><div><a href="adminmanageadmins.php">Admins</a></div></li>
<li><div><a href="admin_students.php">Students</a></div></li>
<li><div><a href="admin_batch.php">Batches</a></div></li>
<li><div><a href="admin_assignments.php">Assignments</a></div></li>
<li><div><a href="admin_assignments_dates.php">Assignment Deadlines</a></div></li>
<li><div><a href="admin_course_details.php">Courses Details</a></div></li>
<li><div><a href="admin_course_payments_details.php">Course Payments</a></div></li>
<li><div><a href="admin_students_fees.php">Student Fees</a></div></li>
<li><div><a href="admin_students_results.php">Student Results </a></div></li>
<li><div><a href="admin_students_submittedassignments.php">Student Assignments</a></div></li>
</ul>
</div>
<div class="section2_admin" style="overflow-x: scroll" align="center">
<h1 align="center"> Batches</h1> <hr>
<div align="center" style="margin-top: 5px" >
<button type="button" data-toggle="modal" data-target="#model" class="btn btn-primary btn-md"><i class="fa fa-plus"></i> Add A New Batch </button>
<!-- insert model -->
<div id="model" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel1">Add A New Batch </h5>
<button type="button" class="close" data-dismiss="modal">close</i></button>
</div>
<form method="post" action="admin_batch_manage.php" enctype="multipart/form-data">
<div class="modal-body">
<input type="text" name="batch_id" class="form-control" placeholder="Batch ID" required />
<br>
<input type="text" name="batch_name" class="form-control" placeholder="Batch Name" required />
<br>
<input type="text" name="batch_code" class="form-control" placeholder="Batch Code" required />
<br>
<input type="text" name="course_id" class="form-control" placeholder="Course ID" required/>
<br>
<input type="text" name="assignment_id" class="form-control" placeholder="Assignment ID" required />
<div class="modal-footer">
<button type="submit" name="submit" class="btn btn-success"/>Insert Data</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- update model -->
<div align="left" class="col-md-12" style="margin-top: 5px" >
<div class="modal fade" id="editmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Update AN Exiting Batch </h5>
<form method="post" action="admin_batch_update.php" enctype="multipart/form-data">
<button type="button" class="close" data-dismiss="modal"> close</button>
</div>
<div class="modal-body">
<input type="hidden" name="update_id" id="update_id" class="form-control" required/>
<input type="text" name="batch_id" id="batch_id" class="form-control" placeholder="Batch ID" />
<br>
<input type="text" name="batch_name" id="batch_name" class="form-control" placeholder="Batch Name" />
<br>
<input type="text" name="batch_code" id="batch_code" class="form-control" placeholder="Batch Code" />
<br>
<input type="text" name="course_id" id="course_id" class="form-control" placeholder="Course ID" />
<br>
<input type="text" name="assignment_id" id="assignment_id" class="form-control" placeholder="Assignment ID" />
<br>
</div>
<div class="modal-footer">
<button type="submit" value="submit" id="update_id" name="updatedata" class="btn btn-info"> Update </button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
<table class="table table-bordered " style=" color: black; font-size: 20px; border:10px ">
<thead >
<tr>
<th scope="col"> Batch ID </th>
<th scope="col"> Batch Name</th>
<th scope="col">Batch Code</th>
<th scope="col">Course ID</th>
<th scope="col">Assignment ID</th>
<th scope="col">Edit</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
while ($row= $result->fetch_assoc()): ?>
<tr>
<td><?php echo $row['batch_id']; ?></td>
<td><?php echo $row['batch_name']; ?></td>
<td ><?php echo $row['batch_code']; ?></td>
<td><?php echo $row['course_id']; ?></td>
<td ><?php echo $row['assignment_id']; ?></td>
<td><button type="button" class="btn btn-success btn-xs editbtn"><i class="fa fa-cog" aria-hidden="true"></i></button></td>
<td><a href="admin_batch_manage.php?delete= <?php echo $row['batch_id']; ?> " class="btn btn-danger btn-xs"><i class="fa fa-trash"></a></td>
</tr>
</tbody>
<?php endwhile; ?>
</table>
<?php
function pre_r( $array ){
echo '<pre>';
print_r($array);
echo '</pre>';
}
?>
</div>
</div>
</div>
<div class="section3">
<p align="center" style="color: white; padding-top: 30px; font-size:20px " >© 2021 MAY / GREENDALE COLLEGE</p>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
$('.editbtn').on('click', function(){
$('#editmodal').modal('show');
$tr = $(this).closest('tr');
var data = $tr.children("td").map(function(){
return $(this).text();
}).get();
console.log(data);
$('#update_id').val(data[0]);
$('#batch_id').val(data[0]);
$('#batch_name').val(data[1]);
$('#batch_code').val(data[2]);
$('#course_id').val(data[3]);
$('#assignment_id').val(data[4]);
});
});
</script>
</body>
</html>