-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_tahun_ajar.php
325 lines (289 loc) · 11.1 KB
/
edit_tahun_ajar.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
<!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>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-lg-12">
<!-- ./col -->
<!-- SETTING START-->
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include "configuration/config_chmod.php";
$halaman = "ajaran"; // halaman
$dataapa = "Tahun Ajaran"; // data
$tabeldatabase = "ajaran"; // tabel database
$chmod = $chmenu2; // Hak akses Menu
$forward = mysqli_real_escape_string($conn, $tabeldatabase); // tabel database
$forwardpage = mysqli_real_escape_string($conn, $halaman); // halaman
$search = $_POST['search'];
$insert = $_POST['insert'];
function autoNumber()
{
global $forward;
global $conn;
$query = "SELECT MAX(RIGHT(kode, 4)) as max_id FROM $forward ORDER BY kode";
$result = mysqli_query($conn, $query);
$data = mysqli_fetch_array($conn, $result);
$id_max = $data['max_id'];
$sort_num = (int) substr($id_max, 1, 4);
$sort_num++;
$new_code = sprintf("%04s", $sort_num);
return $new_code;
}
?>
<!-- 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 INSERT BERHASIL -->
<script>
window.setTimeout(function() {
$("#myAlert").fadeTo(500, 0).slideUp(1000, function() {
$(this).remove();
});
}, 5000);
</script>
<!-- BOX INFORMASI -->
<?php
if ($chmod >= 2 || $_SESSION['jabatan'] == 'admin') {
?>
<!-- KONTEN BODY AWAL -->
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Data <?php echo $dataapa; ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<!----------------KONTEN------------------->
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
$id_tahun_ajaran = $_GET["id"];
if ($_SESSION['jabatan'] == 'admin') {
$sql = "SELECT * FROM tahun_ajaran WHERE id_tahun_ajaran = '$id_tahun_ajaran'";
$hasil2 = mysqli_query($conn, $sql);
$fill = mysqli_fetch_assoc($hasil2);
}
?>
<div id="main">
<div class="container-fluid">
<form class="form-horizontal" method="POST" action="" id="Myform">
<div class="box-body">
<div class="row">
<div class="form-group col-md-6 col-xs-12">
<label for="nama" class="col-sm-3 control-label">Tahun Ajaran :</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="nama" name="tahun_ajar" value="<?php echo $fill['tahun_ajaran']; ?>" placeholder="Masukan Tahun Ajaran" maxlength="50">
</div>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button type="submit" class="btn btn-default pull-left btn-flat" name="simpan"><span class="glyphicon glyphicon-floppy-disk"></span> Simpan</button>
</div>
<!-- /.box-footer -->
</form>
<?php
if (isset($_POST['simpan'])) {
$tahun_ajar = $_POST['tahun_ajar'];
$sql = "UPDATE tahun_ajaran SET tahun_ajaran = '$tahun_ajar' WHERE id_tahun_ajaran = '$id_tahun_ajaran'";
$run_sql = mysqli_query($conn, $sql);
if ($run_sql) {
echo "<script>alert('Update Berhasil');location.href='tahun_ajaran'</script>";
}
}
?>
</div>
<?php
?>
<!-- KONTEN BODY AKHIR -->
</div>
</div>
<!-- /.box-body -->
</div>
</div>
<?php
} else {
?>
<div class="callout callout-danger">
<h4>Info</h4>
<b>Hanya user tertentu yang dapat mengakses halaman <?php echo $dataapa; ?> ini .</b>
</div>
<?php
}
?>
<!-- ./col -->
</div>
<!-- /.row -->
<!-- Main row -->
<div class="row">
<!-- Left col -->
<!-- /.Left col -->
</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/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>
<script src="dist/plugins/select2/select2.full.min.js"></script>
<script src="dist/plugins/input-mask/jquery.inputmask.js"></script>
<script src="dist/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="dist/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<script src="dist/plugins/timepicker/bootstrap-timepicker.min.js"></script>
<script src="dist/plugins/iCheck/icheck.min.js"></script>
<script>
$(function() {
//Initialize Select2 Elements
$(".select2").select2();
//Datemask dd/mm/yyyy
$("#datemask").inputmask("yyyy-mm-dd", {
"placeholder": "yyyy/mm/dd"
});
//Datemask2 mm/dd/yyyy
$("#datemask2").inputmask("yyyy-mm-dd", {
"placeholder": "yyyy/mm/dd"
});
//Money Euro
$("[data-mask]").inputmask();
//Date range picker
$('#reservation').daterangepicker();
//Date range picker with time picker
$('#reservationtime').daterangepicker({
timePicker: true,
timePickerIncrement: 30,
format: 'YYYY/MM/DD h:mm A'
});
//Date range as a button
$('#daterange-btn').daterangepicker({
ranges: {
'Hari Ini': [moment(), moment()],
'Kemarin': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Akhir 7 Hari': [moment().subtract(6, 'days'), moment()],
'Akhir 30 Hari': [moment().subtract(29, 'days'), moment()],
'Bulan Ini': [moment().startOf('month'), moment().endOf('month')],
'Akhir Bulan': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
startDate: moment().subtract(29, 'days'),
endDate: moment()
},
function(start, end) {
$('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
);
//Date picker
$('#datepicker').datepicker({
autoclose: true
});
$('.datepicker').datepicker({
dateFormat: 'yyyy-mm-dd'
});
//Date picker 2
$('#datepicker2').datepicker('update', new Date());
$('#datepicker2').datepicker({
autoclose: true
});
$('.datepicker2').datepicker({
dateFormat: 'yyyy-mm-dd'
});
//iCheck for checkbox and radio inputs
$('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
//Red color scheme for iCheck
$('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
checkboxClass: 'icheckbox_minimal-red',
radioClass: 'iradio_minimal-red'
});
//Flat red color scheme for iCheck
$('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
checkboxClass: 'icheckbox_flat-green',
radioClass: 'iradio_flat-green'
});
//Colorpicker
$(".my-colorpicker1").colorpicker();
//color picker with addon
$(".my-colorpicker2").colorpicker();
//Timepicker
$(".timepicker").timepicker({
showInputs: false
});
});
</script>
</body>
</html>