forked from rrifafauzikomara/SPK-AHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalisa-alternatif.php
190 lines (182 loc) · 6.42 KB
/
analisa-alternatif.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
<?php
include_once('includes/header.inc.php');
include_once('includes/skor.inc.php');
include_once('includes/alternatif.inc.php');
include_once('includes/kriteria.inc.php');
include_once('includes/nilai.inc.php');
$altObj = new Alternatif($db);
$skoObj = new Skor($db);
$kriObj = new Kriteria($db);
$nilObj = new Nilai($db);
$altCount = $altObj->countByFilter();
$no = 1; $r = []; $nid = [];
$alt1 = $altObj->readByFilter();
while ($row = $alt1->fetch(PDO::FETCH_ASSOC)){
$alt2 = $altObj->readByFilter();
while ($roww = $alt2->fetch(PDO::FETCH_ASSOC)) {
$nid[$row['id_alternatif']][] = $roww['id_alternatif'];
}
$total = $altCount-$no;
if ($total>=1) {
$r[$row['id_alternatif']] = $total;
}
$no++;
}
$ni=1;
foreach ($nid as $key => $value) {
array_splice($nid[$key], 0, $ni++);
}
$ne = count($nid)-1;
array_splice($nid, $ne, 1);
?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<ol class="breadcrumb">
<li><a href="index.php">Beranda</a></li>
<li class="active">Analisa Alternatif</li>
<li><a href="#" data-toggle="modal" data-target="#myModalalt">Tabel Analisa Alternatif</a></li>
</ol>
<table width="100%" class="table table-striped table-bordered">
<thead>
<tr>
<th width="50px"></th>
<th width="50px">No</th>
<th>ID</th>
<th>Nama</th>
<th>Nilai</th>
<th>Keterangan</th>
</tr>
</thead>
<tbody>
<?php $no=1; $alt1a = $altObj->readByFilter(); while($row = $alt1a->fetch(PDO::FETCH_ASSOC)): ?>
<tr>
<td class="text-center">
<button type="button" class="btn btn-xs btn-primary" data-toggle="modal" data-target="#modalNilaiDetail" data-id-alternatif="<?=$row["id_alternatif"]?>"><span class="fa fa-eye" aria-hidden="true"></span></button>
</td>
<td><?=$no++?></td>
<td><?=$row["id_alternatif"]?></td>
<td><?=$row["nama"]?></td>
<td><?=$row["nilai"]?></td>
<td><?php
if ($row['keterangan'] == "B") {
echo "Baik";
}elseif($row['keterangan'] == "C"){
echo "Cukup";
}else{
echo "Kurang";
}
?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<div class="panel panel-default">
<div class="panel-body">
<form method="post" action="analisa-alternatif-tabel.php">
<div class="row">
<div class="col-xs-12 col-md-3">
<div class="form-group">
<p style="padding:10px 0;"><label>Pilih Kriteria</label></p>
</div>
</div>
<div class="col-xs-12 col-md-9">
<div class="form-group">
<select class="form-control" id="kriteria" name="kriteria">
<?php $kri2 = $kriObj->readAll(); while ($row = $kri2->fetch(PDO::FETCH_ASSOC)): ?>
<option value="<?=$row['id_kriteria']?>"><?=$row['nama_kriteria']?></option>
<?php endwhile; ?>
</select>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12 col-md-3">
<div class="form-group">
<label>Kriteria Pertama</label>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label>Pernilaian</label>
</div>
</div>
<div class="col-xs-12 col-md-3">
<div class="form-group">
<label>Kriteria Kedua</label>
</div>
</div>
</div>
<?php $no=1; foreach ($r as $k => $v): ?>
<?php $j=0; for ($i=1; $i<=$v; $i++): ?>
<?php $rows = $altObj->readSatu($k); while ($row = $rows->fetch(PDO::FETCH_ASSOC)): ?>
<div class="row">
<div class="col-xs-12 col-md-3">
<div class="form-group">
<?php $rows = $skoObj->readAlternatif($k); while ($row = $rows->fetch(PDO::FETCH_ASSOC)): ?>
<input type="text" class="form-control" value="<?=$row['nama']?>" readonly />
<input type="hidden" name="<?=$k?><?=$no?>" value="<?=$row['id_alternatif']?>" />
<?php endwhile; ?>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<select class="form-control" name="nl<?=$no?>">
<?php $stmt1 = $nilObj->readAll(); while ($row2 = $stmt1->fetch(PDO::FETCH_ASSOC)): ?>
<option value="<?=$row2['jum_nilai']?>"><?=$row2['jum_nilai']?> - <?=$row2['ket_nilai']?></option>
<?php endwhile; ?>
</select>
</div>
</div>
<div class="col-xs-12 col-md-3">
<div class="form-group">
<?php $rows = $skoObj->readAlternatif($nid[$k][$j]); while ($row = $rows->fetch(PDO::FETCH_ASSOC)): ?>
<input type="text" class="form-control" value="<?=$row['nama']?>" readonly />
<input type="hidden" name="<?=$nid[$k][$j]?><?=$no?>" value="<?=$row['id_alternatif']?>" />
<?php endwhile;?>
</div>
</div>
</div>
<?php endwhile; $no++; $j++;?>
<?php endfor; ?>
<?php endforeach; ?>
<button type="submit" name="submit" class="btn btn-dark"> Selanjutnya <span class="fa fa-arrow-right"></span></button>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModalalt" tabindex="-1" role="dialog" aria-labelledby="myModalLabelalt">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabelalt">Pilih Kriteria</h4>
</div>
<div class="modal-body">
<div class="list-group">
<?php $kri1 = $kriObj->readAll(); while ($row = $kri1->fetch(PDO::FETCH_ASSOC)): ?>
<a href="analisa-alternatif-tabel.php?kriteria=<?=$row['id_kriteria']?>" class="list-group-item"><?=$row['nama_kriteria']?></a>
<?php endwhile; ?>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalNilaiDetail" tabindex="-1" role="dialog" aria-labelledby="modalNilaiDetailLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="modalNilaiDetailLabel">Nilai Detail</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
</div>
</div>
</div>
</div>
<?php include_once('includes/footer.inc.php'); ?>