-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtahun_ajaran.php
257 lines (240 loc) · 10 KB
/
tahun_ajaran.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
<!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 = "admin"; // halaman
$dataapa = "Admin"; // data
$tabeldatabase = "tahun_ajaran"; // tabel database
$chmod = $chmenu1; // Hak akses Menu
$forward = mysqli_real_escape_string($conn, $tabeldatabase); // tabel database
$forwardpage = mysqli_real_escape_string($conn, $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 ($_SESSION['jabatan'] == 'admin' || $_SESSION['jabatan'] == 'guru') {
?>
<div class="box">
<div class="box-header d-flex">
<h3 class="box-title">Data <?php echo $forward ?> <span class="label label-default"><?php echo $totaldata; ?></span>
</h3>
<br>
<?php
if ($_SESSION['jabatan'] == 'admin') {
?>
<a href="add_ajaran" class="ml-auto">
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Tambah Tahun Ajaran
</button>
</a>
<?php } ?>
</div>
<!-- /.box-header -->
<!-- /.Paginasi -->
<div class="box-body table-responsive">
<table class="table table-hover ">
<thead>
<tr>
<th>No</th>
<th>Tahun Ajaran</th>
<th>Jumlah Siswa</th>
<?php
if ($_SESSION['jabatan'] == 'admin') {
?>
<th style="text-align: center;" colspan=2>Action</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$sql = "SELECT id_tahun_ajaran, tahun_ajaran FROM tahun_ajaran";
$result = mysqli_query($conn, $sql);
$no_urut = 1;
$arr = [];
while ($fill = mysqli_fetch_array($result)) {
$tahun_ajar = $fill['tahun_ajaran'];
$sql_siswa = "SELECT COUNT(id_siswa) as JumlahSiswa FROM siswa
JOIN tahun_ajaran ON siswa.id_tahun_ajaran = tahun_ajaran.id_tahun_ajaran
WHERE tahun_ajaran.tahun_ajaran = '$tahun_ajar' GROUP BY siswa.id_tahun_ajaran";
$query = mysqli_query($conn, $sql_siswa);
$ajaran = mysqli_fetch_array($query);
if (isset($ajaran['JumlahSiswa'])) {
$jml_siswa = $ajaran['JumlahSiswa'];
} else if (empty($ajaran['JumlahSiswa'])) {
$jml_siswa = '0';
}
$fill['jumlah_siswa'] = @$jml_siswa;
array_push($arr, $fill);
}
?>
<!-- <pre>
<?php print_r($arr) ?>
</pre> -->
<tr>
<?php
foreach ($arr as $item) {
?>
<td><?php echo $no_urut++; ?></td>
<td><?php echo $item['tahun_ajaran'] ?></td>
<td><?php echo $item['jumlah_siswa'] ?> Siswa</td>
<?php
if ($_SESSION['jabatan'] == 'admin') {
?>
<td style="text-align: center;"><a href="edit_tahun_ajar?id=<?= $data['id_tahun_ajaran'] ?>"><i class="fa fa-pencil"></i> Edit</a></td>
<td style="text-align: center"><a href="delete_ajaran?id=<?= $data['id_tahun_ajaran'] ?>" style="color:red;"><i class="fa fa-trash"></i> Hapus</a></td>
<?php } ?>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</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>