-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatusguru.php
322 lines (285 loc) · 12.7 KB
/
statusguru.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
<!DOCTYPE html>
<html>
<?php
// include "configuration/config_etc.php";
include "configuration/config_include.php";
// etc();
encryption();
session();
connect();
head();
body();
timing();
//alltotal();
pagination();
?>
<?php
if (!login_check()) {
?>
<meta http-equiv="refresh" content="0; url=logout" />
<?php
exit(0);
}
?>
<div class="wrapper">
<?php
theader();
menu();
?>
<div class="content-wrapper">
<section class="content-header">
</section>
<section class="content">
<div class="row">
<div class="col-lg-12">
<!-- SETTING START-->
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include "configuration/config_chmod.php";
$halaman = "statusguru"; // halaman
$dataapa = "Status Guru"; // data
$tabeldatabase = "statusguru"; // tabel database
$chmod = $chmenu3; // Hak akses Menu
// $forward = mysql_real_escape_string($tabeldatabase); // tabel database
// $forwardpage = mysql_real_escape_string($halaman); // halaman
$search = $_POST['search'];
?>
<!-- SETTING STOP -->
<!-- BREADCRUMB -->
<ol class="breadcrumb ">
<li><a href="<?php echo $_SESSION['baseurl']; ?>">Dashboard </a></li>
<li><a href="<?php echo $halaman; ?>"><?php echo $dataapa ?></a></li>
<?php
if ($search != null || $search != "") {
?>
<li> <a href="<?php echo $halaman; ?>">Data <?php echo $dataapa ?></a></li>
<li class="active"><?php
echo $search;
?></li>
<?php
} else {
?>
<li class="active">Data <?php echo $dataapa ?></li>
<?php
}
?>
</ol>
<!-- BREADCRUMB -->
<!-- BOX HAPUS BERHASIL -->
<script>
window.setTimeout(function() {
$("#myAlert").fadeTo(500, 0).slideUp(1000, function() {
$(this).remove();
});
}, 5000);
</script>
<?php
$hapusberhasil = $_POST['hapusberhasil'];
if ($hapusberhasil == 1) {
?>
<div id="myAlert" class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Berhasil!</strong> <?php echo $dataapa; ?> telah berhasil dihapus dari Data <?php echo $dataapa; ?>.
</div>
<!-- BOX HAPUS BERHASIL -->
<?php
} elseif ($hapusberhasil == 2) {
?>
<div id="myAlert" class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Gagal!</strong> <?php echo $dataapa; ?> tidak bisa dihapus dari Data <?php echo $dataapa; ?> karena telah melakukan transaksi sebelumnya, gunakan menu update untuk merubah informasi <?php echo $dataapa; ?> .
</div>
<?php
} elseif ($hapusberhasil == 3) {
?>
<div id="myAlert" class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Gagal!</strong> Hanya user tertentu yang dapat mengupdate Data <?php echo $dataapa; ?> .
</div>
<?php
}
?>
<!-- BOX INFORMASI -->
<?php
if ($chmod == '1' || $chmod == '2' || $chmod == '3' || $chmod == '4' || $chmod == '5' || $_SESSION['jabatan'] == 'admin') {
} else {
?>
<div class="callout callout-danger">
<h4>Info</h4>
<b>Hanya user tertentu yang dapat mengakses halaman <?php echo $dataapa; ?> ini .</b>
</div>
<?php
}
?>
<?php
if ($chmod >= 1 || $_SESSION['jabatan'] == 'admin') {
?>
<?php
$sqla = "SELECT no, COUNT( * ) AS totaldata FROM $forward";
$hasila = mysqli_query($conn, $sqla);
$rowa = mysqli_fetch_assoc($hasila);
$totaldata = $rowa['totaldata'];
?>
<div class="box">
<div class="box-header">
<h3 class="box-title">Data <?php echo $forward ?> <span class="label label-default"><?php echo $totaldata; ?></span>
</h3>
<form method="post">
<br />
<div class="input-group input-group-sm" style="width: 250px;">
<input type="text" name="search" class="form-control pull-right" placeholder="Cari">
<div class="input-group-btn">
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
</div>
<!-- /.box-header -->
<!-- /.Paginasi -->
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$sql = "select * from $forward order by no";
$result = mysqli_query($conn, $sql);
$rpp = 15;
$reload = "$halaman" . "?pagination=true";
$page = intval(isset($_GET["page"]) ? $_GET["page"] : 0);
if ($page <= 0)
$page = 1;
$tcount = mysqli_num_rows($result);
$tpages = ($tcount) ? ceil($tcount / $rpp) : 1;
$count = 0;
$i = ($page - 1) * $rpp;
$no_urut = ($page - 1) * $rpp;
?>
<div class="box-body table-responsive">
<table class="table table-hover ">
<thead>
<tr>
<th>No</th>
<th>Kode statusguru</th>
<th>Nama statusguru</th>
<?php if ($chmod >= 3 || $_SESSION['jabatan'] == 'admin') { ?>
<th>Opsi</th>
<?php } else {
} ?>
</tr>
</thead>
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
$search = $_POST['search'];
if ($search != null || $search != "") {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['search'])) {
$query1 = "SELECT * FROM $forward where kode like '%$search%' or nama like '%$search%' order by no limit $rpp";
$hasil = mysqli_query($conn, $query1);
$no = 1;
while ($fill = mysqli_fetch_assoc($hasil)) {
?>
<tbody>
<tr>
<td><?php echo ++$no_urut; ?></td>
<td><?php echo mysql_real_escape_string($fill['kode']); ?></td>
<td><?php echo mysql_real_escape_string($fill['nama']); ?></td>
<td>
<?php if ($chmod >= 3 || $_SESSION['jabatan'] == 'admin') { ?>
<button type="button" class="btn btn-success btn-xs btn-flat" onclick="window.location.href='add_<?php echo $halaman; ?>?no=<?php echo $fill['no']; ?>'">Edit</button>
<?php } else {
} ?>
<?php if ($chmod >= 4 || $_SESSION['jabatan'] == 'admin') { ?>
<button type="button" class="btn btn-danger btn-xs btn-flat" onclick="window.location.href='component/delete/delete_master?no=<?php echo $fill['no'] . '&'; ?>forward=<?php echo $forward . '&'; ?>forwardpage=<?php echo $forwardpage . '&'; ?>chmod=<?php echo $chmod; ?>'">Hapus</button>
<?php } else {
} ?>
</td>
</tr><? php;
}
?>
</tbody>
</table>
<div align="right"><?php if ($tcount >= $rpp) {
echo paginate_one($reload, $page, $tpages);
} else {
} ?></div>
<?php
}
}
} else {
while (($count < $rpp) && ($i < $tcount)) {
mysqli_data_seek($result, $i);
$fill = mysqli_fetch_array($result);
?>
<tbody>
<tr>
<td><?php echo ++$no_urut; ?></td>
<td><?php echo mysql_real_escape_string($fill['kode']); ?></td>
<td><?php echo mysql_real_escape_string($fill['nama']); ?></td>
<td>
<?php if ($chmod >= 3 || $_SESSION['jabatan'] == 'admin') { ?>
<button type="button" class="btn btn-success btn-xs btn-flat" onclick="window.location.href='add_<?php echo $halaman; ?>?no=<?php echo $fill['no']; ?>'">Edit</button>
<?php } else {
} ?>
<?php if ($chmod >= 4 || $_SESSION['jabatan'] == 'admin') { ?>
<button type="button" class="btn btn-danger btn-xs btn-flat" onclick="window.location.href='component/delete/delete_master?no=<?php echo $fill['no'] . '&'; ?>forward=<?php echo $forward . '&'; ?>forwardpage=<?php echo $forwardpage . '&'; ?>chmod=<?php echo $chmod; ?>'">Hapus</button>
<?php } else {
} ?>
</td>
</tr>
<?php
$i++;
$count++;
}
?>
</tbody>
</table>
<div align="right"><?php if ($tcount >= $rpp) {
echo paginate_one($reload, $page, $tpages);
} else {
} ?></div>
<?php } ?>
</div>
<!-- /.box-body -->
</div>
<?php } else {
} ?>
</div>
<!-- ./col -->
</div>
<!-- /.row -->
<!-- Main row -->
<div class="row">
</div>
<!-- /.row (main row) -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php footer(); ?>
<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<script src="dist/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<script src="dist/bootstrap/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="dist/plugins/morris/morris.min.js"></script>
<script src="dist/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="dist/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="dist/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="dist/plugins/knob/jquery.knob.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
<script src="dist/plugins/daterangepicker/daterangepicker.js"></script>
<script src="dist/plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="dist/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="dist/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="dist/plugins/fastclick/fastclick.js"></script>
<script src="dist/js/app.min.js"></script>
<script src="dist/js/pages/dashboard.js"></script>
<script src="dist/js/demo.js"></script>
<script src="dist/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="dist/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="dist/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="dist/plugins/fastclick/fastclick.js"></script>
</body>
</html>