-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpengaturan_sistem.php
127 lines (123 loc) · 4.86 KB
/
pengaturan_sistem.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
<?php include 'global_fungsi.php';
// Jika sudah login, arahkan ke dashboard
if (sudah_login() && $_SESSION["a2_level"]=="super_user") {
// Tambahkan header
include 'global_header.php';
?>
<div class="container">
<div class="row">
<?php // Tampilkan informasi jika ada!
if (isset($_SESSION["informasi"])) {
echo "<div class='alert alert-info'>".$_SESSION["informasi"]."</div>";
unset($_SESSION["informasi"]);
}
?>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 ">
<div class="panel panel-default">
<div class="panel-body">
<legend>Pengaturan Sistem</legend>
<?php
$daftar_pengaturan = ambil_data_global("aluni_pengaturan", "*", "aktif = 'ya'");
if (count($daftar_pengaturan)>0) {
?>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>No</th>
<th>Nama Pengaturan</th>
<th width="35%">Nilai</th>
<th width="35%">Keterangan</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 0;
foreach ($daftar_pengaturan as $data) {
$no++; ?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $data['nama_pengaturan'] ?></td>
<td><?php echo strip_tags($data['nilai_pengaturan']) ?></td>
<td><?php echo strip_tags($data['keterangan']) ?></td>
<input type="hidden" id="nilai_<?php echo $data['nama_pengaturan'] ?>" value="<?php echo $data['nilai_pengaturan'] ?>">
<input type="hidden" id="keterangan_<?php echo $data['nama_pengaturan'] ?>" value="<?php echo $data['keterangan'] ?>">
<td>
<div class="btn-group btn-group-sm">
<button class="btn btn-primary" onclick="ubah_pengaturan('<?php echo $data['nama_pengaturan'] ?>')">Ubah</button>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
else {
echo "<p class='text-center'>Tidak Ada Data!</p>";
}
?>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Detail Anggota -->
<div class="modal fade" tabindex="-1" role="dialog" id="modal_dialog_ubah_pengaturan">
<div class="modal-dialog">
<div class="modal-content">
<form action="proses.php" method="post">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<h4 class="modal-title" id="modal_title_ubah_pengaturan">Ubah Pengaturan</h4>
</div>
<div class="modal-body form-horizontal" id="modal_content_ubah_pengaturan">
<div class="form-group">
<label class="control-label col-sm-3">Nama</label>
<div class="col-sm-8 form-control-static" id="md_nama_pengaturan_v"></div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Nilai</label>
<div class="col-sm-8">
<textarea name="md_nilai_pengaturan" id="md_nilai_pengaturan" class="form-control" rows="5"></textarea>
<p class="help-block">Anda dapat menggunakan tag html disini.</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Keterangan</label>
<div class="col-sm-8">
<textarea name="md_keterangan" id="md_keterangan" class="form-control" rows="5"></textarea>
</div>
</div>
</div>
<div class="modal-footer" id="modal_footer_ubah_pengaturan">
<input type="hidden" name="md_nama_pengaturan" id="md_nama_pengaturan">
<input type="hidden" name="aksi" value="ubah_pengaturan">
<button type="submit" class="btn btn-primary" onclick="return confirm('Pastikan semua data sudah diisikan.\nProses simpan pengaturan ini?')">Simpan</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<script type="text/javascript">
function ubah_pengaturan (nama_pengaturan) {
// Set variabel
$("#md_nama_pengaturan_v").html(nama_pengaturan);
$("#md_nama_pengaturan").val(nama_pengaturan);
$("#md_nilai_pengaturan").html($("#nilai_"+nama_pengaturan).val());
$("#md_keterangan").html($("#keterangan_"+nama_pengaturan).val());
$("#modal_dialog_ubah_pengaturan").modal("show");
}
</script>
<?php
}
else {
header("Location: ./login.php");
die();
}
?>