This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-kriteria.php
118 lines (90 loc) · 2.97 KB
/
single-kriteria.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
<?php require_once('includes/init.php'); ?>
<?php
$ada_error = false;
$result = '';
$id_kriteria = (isset($_GET['id'])) ? trim($_GET['id']) : '';
if(!$id_kriteria) {
$ada_error = 'Maaf, data tidak dapat diproses.';
} else {
$query = $pdo->prepare('SELECT * FROM kriteria WHERE kriteria.id_kriteria = :id_kriteria');
$query->execute(array('id_kriteria' => $id_kriteria));
$result = $query->fetch();
if(empty($result)) {
$ada_error = 'Maaf, data tidak dapat diproses.';
}
}
?>
<?php
$judul_page = 'Detail Kriteria';
require_once('template-parts/header.php');
?>
<div class="main-content-row">
<div class="container clearfix">
<?php include_once('template-parts/sidebar-kriteria.php'); ?>
<div class="main-content the-content">
<h1><?php echo $judul_page; ?></h1>
<?php if($ada_error): ?>
<?php echo '<p>'.$ada_error.'</p>'; ?>
<?php elseif(!empty($result)): ?>
<h4>Nama Kriteria</h4>
<p><?php echo $result['nama']; ?></p>
<h4>Type Kriteria</h4>
<p><?php
if($result['type'] == 'c1') {
echo 'C-1';
} elseif($result['type'] == 'c2') {
echo 'C-2';
} elseif($result['type'] == 'c3') {
echo 'C-3';
} elseif($result['type'] == 'c4') {
echo 'C-4';
} elseif($result['type'] == 'c5') {
echo 'C-5';
}
?></p>
<h4>Bobot Kriteria</h4>
<p><?php echo $result['bobot']; ?></p>
<h4>Urutan Order</h4>
<p><?php echo $result['urutan_order']; ?></p>
<h4>Cara Penilaian</h4>
<p><?php
if($result['ada_pilihan'] == 1) {
echo 'Menggunakan Pilihan Variabel';
} else {
echo 'Inputan Langsung';
}
?></p>
<?php if($result['ada_pilihan'] == 1): ?>
<h4>Pilihan Variabel</h4>
<table id="pilihan-var" class="pure-table pure-table-striped">
<thead>
<tr>
<th>Nama Variabel</th>
<th>Nilai</th>
</tr>
</thead>
<tbody>
<?php
$query = $pdo->prepare('SELECT * FROM pilihan_kriteria WHERE id_kriteria = :id_kriteria ORDER BY urutan_order ASC');
$query->execute(array(
'id_kriteria' => $result['id_kriteria']
));
// menampilkan berupa nama field
$query->setFetchMode(PDO::FETCH_ASSOC);
if($query->rowCount() > 0): while($hasile = $query->fetch()):
?>
<tr>
<td><?php echo $hasile['nama']; ?></td>
<td><?php echo $hasile['nilai']; ?></td>
</tr>
<?php endwhile; endif;?>
</tbody>
</table>
<?php endif; ?>
<p><a href="edit-kriteria.php?id=<?php echo $id_kriteria; ?>" class="button"><span class="fa fa-pencil"></span> Edit</a> <a href="hapus-kriteria.php?id=<?php echo $id_kriteria; ?>" class="button button-red yaqin-hapus"><span class="fa fa-times"></span> Hapus</a></p>
<?php endif; ?>
</div>
</div><!-- .container -->
</div><!-- .main-content-row -->
<?php
require_once('template-parts/footer.php');