-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlist_kriteria_seleksi.php
142 lines (130 loc) · 6.36 KB
/
list_kriteria_seleksi.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
<script type="text/javascript" src="assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap-growl.min.js"></script>
<script type="text/javascript">
function notify(message) {
$.growl(message, {
placement: {from: 'top', align: 'center'},
ele: 'body', // which element to append to
type: 'info', // (null, 'info', 'danger', 'success')
offset: {x: 30, y: 20}, // 'top', or 'bottom'
align: 'center', // ('left', 'right', or 'center')
width: 250, // (integer, or 'auto')
delay: 2500, // Time while the message will be displayed. It's not equivalent to the *demo* timeOut!
// timer: 5000,
allow_dismiss: true, // If true then will display a cross to close the popup.
stackup_spacing: 40 // spacing between consecutively stacked growls.
});
}
</script>
<?php
$seleksi = antiinjec(@$_GET['seleksi']);
$stat = @$_GET['stat'];
$id = antiinjec(@$_GET['id']);
if ($stat == "hapus" && $id != "") {
$check = querydb("SELECT * FROM ahp_kriteria_seleksi WHERE id_kriteria_seleksi='$id'");
if (!empty($check->num_rows)) {
querydb("DELETE FROM ahp_kriteria_seleksi WHERE id_kriteria_seleksi='$id'");
querydb("DELETE FROM ahp_nilai_eigen WHERE id_node IN ('$id')");
querydb("DELETE FROM ahp_nilai_pasangan WHERE id_node_2 IN ('$id')");
?>
<script language="JavaScript">
notify('Data berhasil dihapus  ');
</script>
<?php
}
}
?>
<div class="card">
<div class="card-header">
<h5>Daftar Kriteria Setiap Seleksi</h5>
<span> Seleksi
<form method="get" enctype="multipart/form-data" action="">
<input type="hidden" name="h" value="kriteria-seleksi">
<select class="required" name="seleksi">
<option value="0"></option>
<?php
$hseleksi = querydb("SELECT id_seleksi, seleksi, tahun, catatan FROM ahp_seleksi ORDER BY tahun DESC, id_seleksi DESC");
while ($dseleksi = mysqli_fetch_array($hseleksi)) {
?>
<option value="<?php echo $dseleksi['id_seleksi']; ?>" <?php
if ($dseleksi['id_seleksi'] == $seleksi) {
echo "selected";
}
?>><?php echo $dseleksi['tahun'] . " - " . $dseleksi['seleksi']; ?></option>
<?php } ?>
</select>  
<button type='submit' class="btn btn-primary btn-sm btn-round">Cari</button>
</form>
</span>
</div>
<div class="card-block table-border-style">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>No</th>
<th>Nama Kriteria</th>
<th class="text-center">
<form method="post" enctype="multipart/form-data" action="?h=kriteria-seleksi-input&stat=tambah">
<input type="hidden" name="seleksi" value="<?php echo $seleksi; ?>" />
<?php echo!empty($seleksi) ? "<button type='submit' name='btn_tambah' class='btn btn-primary btn-sm btn-round'>Tambah</button>" : null ?>
</form>
</th>
</tr>
</thead>
<tbody>
<?php
$no = 0;
$hquery = querydb("SELECT b.id_kriteria_seleksi, a.id_kriteria, a.kriteria, a.keterangan
FROM ahp_kriteria as a, ahp_kriteria_seleksi as b
WHERE a.id_kriteria=b.id_kriteria AND b.id_seleksi='$seleksi' ORDER BY b.id_kriteria_seleksi ASC");
$jml_baris = mysqli_num_rows($hquery);
while ($data = mysqli_fetch_array($hquery)) {
$no++;
?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $data['kriteria']; ?></td>
<td style="text-align:center;">
<a href="#" class="btn btn-danger btn-sm btn-round" onclick="konfirmasi(<?php echo $data[0] ?>, '<?php echo $data['kriteria'] ?>', '<?php echo $seleksi ?>')">Hapus</a>
</td>
</tr>
<?php } if (@$_GET['con'] != "" && !empty($_POST['seleksi'])) { ?>
<tr>
<td><img src="images/ico_cek.png" width="22"></td>
<td colspan="7" style="color:#360; font-weight:600; font-size:14px;">
<?php
if (@$_GET['con'] == 1) {
echo "Data berhasil ditambahkan.";
} elseif (@$_GET['con'] == 2) {
echo "Data berhasil diubah.";
} elseif (@$_GET['con'] == 3) {
echo "Data berhasil dihapus.";
}
?>
</td>
</tr>
<?php } if (empty($seleksi)) { ?>
<tr>
<td><img src="images/ico_alert.png" width="22"></td>
<td colspan="7" style="color:#F30; font-weight:600; font-size:14px;">Silahkan pilih seleksi</td>
</tr>
<?php } elseif ($jml_baris == 0) { ?>
<tr>
<td><img src="images/ico_alert.png" width="22"></td>
<td colspan="7" style="color:#F30; font-weight:600; font-size:14px;">Belum ada data</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript">
function konfirmasi(id, kriteria, seleksi) {
var answer = confirm("Anda yakin akan menghapus data " + kriteria + " ini ?");
if (answer) {
window.location = "?h=kriteria-seleksi&seleksi=" + seleksi + "&stat=hapus&id=" + id;
}
}
</script>