-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_term.php
299 lines (238 loc) · 13.4 KB
/
manage_term.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
<?php
session_start();
error_reporting(0);
include('includes/config.php');
include('includes/db.php');
if (strlen($_SESSION['alogin']) == "") {
header("Location: index.php");
} else {
if (isset($_POST['submit'])) {
global $con;
$name = $_POST['name'];
$author = $_SESSION['alogin'];
$query = "INSERT INTO `term`(`name`, `created_at`,`created_by` )
VALUES ('$name',CURRENT_TIMESTAMP(),'$author')";
$execute = mysqli_query($con, $query);
if ($execute) {
$msg = "Term added successfully";
} else {
$error = (mysqli_error($con));
}
}
?>
<!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">
<title>Admin Manage Terms</title>
<link rel="stylesheet" href="css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="css/font-awesome.min.css" media="screen">
<link rel="stylesheet" href="css/animate-css/animate.min.css" media="screen">
<link rel="stylesheet" href="css/lobipanel/lobipanel.min.css" media="screen">
<link rel="stylesheet" href="css/prism/prism.css" media="screen"> <!-- USED FOR DEMO HELP - YOU CAN REMOVE IT -->
<link rel="stylesheet" type="text/css" href="js/DataTables/datatables.min.css" />
<link rel="stylesheet" href="css/main.css" media="screen">
<style>
.errorWrap {
padding: 10px;
margin: 0 0 20px 0;
background: #fff;
border-left: 4px solid #dd3d36;
-webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
}
.succWrap {
padding: 10px;
margin: 0 0 20px 0;
background: #fff;
border-left: 4px solid #5cb85c;
-webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
}
</style>
</head>
<body class="top-navbar-fixed">
<div class="main-wrapper">
<!-- ========== TOP NAVBAR ========== -->
<?php include('includes/topbar.php'); ?>
<!-- ========== WRAPPER FOR BOTH SIDEBARS & MAIN CONTENT ========== -->
<div class="content-wrapper">
<div class="content-container">
<?php include('includes/leftbar.php'); ?>
<div class="main-page">
<div class="container-fluid">
<div class="row page-title-div">
<div class="col-md-6">
<h2 class="title">Manage Term</h2>
</div>
<!-- /.col-md-6 text-right -->
</div>
<!-- /.row -->
<div class="row breadcrumb-div">
<div class="col-md-6">
<ul class="breadcrumb">
<li><a href="dashboard.php"><i class="fa fa-home"></i> Home</a></li>
<li> Terms</li>
<li class="active">Manage Term</li>
</ul>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
<section class="section">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-heading">
<div class="panel-title">
<div class="container-fluid">
<a style="float: right" class="btn btn-info" data-toggle="modal" data-target="#exampleModalCenter">
<i class="fa fa-plus">
</i>Add Term
</a>
<h5>View Terms</h5>
</div>
<!-- Modal -->
</div>
</div>
<?php if ($msg) { ?>
<div class="alert alert-success alert-dismissible left-icon-alert" role="alert">
<strong>Well done!</strong><?php echo htmlentities($msg); ?>
<button type="button" class="close" data-dismiss="alert" aria-label="close">
<span aria-hidden="true"> × </span>
</button>
</div>
<?php } else if ($error) { ?>
<div class="alert alert-danger alert-dismissible left-icon-alert" role="alert">
<strong>Oh snap!</strong> <?php echo htmlentities($error); ?>
<button type="button" class="close" data-dismiss="alert" aria-label="close">
<span aria-hidden="true"> × </span>
</button>
</div>
<?php } ?>
<div class="panel-body p-20">
<table id="example" class="display table table-hover table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>#</th>
<th>Term</th>
<th>Creation Date</th>
<th>Added By</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $sql = "SELECT * from term";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
if ($query->rowCount() > 0) {
foreach ($results as $result) { ?>
<tr>
<td><?php echo htmlentities($cnt); ?></td>
<td>
<a href="class_subjects.php?cid=<?php echo htmlentities($result->id) ?>">
<?php echo htmlentities($result->name); ?>
</a>
</td>
<td><?php echo htmlentities($result->created_at); ?></td>
<td><?php echo htmlentities($result->created_by); ?></td>
<td>
<a href="edit-class.php?classid=<?php echo htmlentities($result->id); ?>">
<i class="btn-sm btn-info">Edit</i>
</a>
<a href="delete-term.php?term_id=<?php echo htmlentities($result->id); ?>">
<i class="btn-sm btn-danger">Delete</i>
</a>
</td>
</tr>
<?php $cnt = $cnt + 1;
}
} ?>
</tbody>
</table>
<!-- /.col-md-12 -->
</div>
</div>
</div>
<!-- /.col-md-6 -->
</div>
<!-- /.col-md-12 -->
</div>
</div>
<!-- /.panel -->
</div>
<!-- /.col-md-6 -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</section>
<!-- /.section -->
</div>
<!-- /.main-page -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Add Term</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form method="post">
<div class="form-group has-success">
<label for="success" class="control-label">Term Name</label>
<div class="">
<input type="text" name="name" class="form-control" required="required" id="success">
<span class="help-block">Eg- Term 1, Term 2 etc</span>
</div>
</div>
<div class="form-group has-success">
<div class="">
<button type="submit" name="submit" class="btn btn-success btn-labeled">Submit
<span class="btn-label btn-label-right"><i class="fa fa-check"></i></span>
</button>
<button class="close"> <a href="manage_term.php"> Back </a> </button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- /.content-container -->
</div>
<!-- /.content-wrapper -->
</div>
<!-- /.main-wrapper -->
<!-- ========== COMMON JS FILES ========== -->
<script src="js/jquery/jquery-2.2.4.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script>
<script src="js/pace/pace.min.js"></script>
<script src="js/lobipanel/lobipanel.min.js"></script>
<script src="js/iscroll/iscroll.js"></script>
<!-- ========== PAGE JS FILES ========== -->
<script src="js/prism/prism.js"></script>
<script src="js/DataTables/datatables.min.js"></script>
<!-- ========== THEME JS ========== -->
<script src="js/main.js"></script>
<script>
$(function($) {
$('#example').DataTable();
$('#example2').DataTable({
"scrollY": "300px",
"scrollCollapse": true,
"paging": false
});
$('#example3').DataTable();
});
</script>
</body>
</html>
<?php } ?>