-
Notifications
You must be signed in to change notification settings - Fork 3
/
ranking.php
185 lines (179 loc) · 6.08 KB
/
ranking.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
<?php
include_once('includes/header.inc.php');
include_once('includes/alternatif.inc.php');
include_once('includes/kriteria.inc.php');
include_once('includes/ranking.inc.php');
$altObj = new Alternatif($db);
$kriObj = new Kriteria($db);
$ranObj = new Ranking($db);
$stmt = $ranObj->readKhusus();
$stmty = $ranObj->readKhusus();
$count = $ranObj->countAll();
$stmtx1y = $ranObj->readBob();
$stmtx2y = $ranObj->readBob();
?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<br/>
<div class="row">
<div class="col-md-6 text-left">
<h3>Data Bobot</h3>
</div>
<div class="col-md-6 text-right">
<button type="button" onclick="location.href='index.php'" class="btn btn-primary"><i class="fa fa-arrow-left"></i> Kembali</button>
</div>
</div>
<br/>
<table width="100%" class="table table-striped table-bordered">
<thead>
<tr>
<th rowspan="3" class="text-center active">Alternatif</th>
<th colspan="<?php $kri1a = $kriObj->readAll(); echo $kri1a->rowCount(); ?>" class="text-center">Kriteria</th>
</tr>
<tr>
<?php $kri2a = $kriObj->readAll(); while ($row = $kri2a->fetch(PDO::FETCH_ASSOC)): ?>
<th><?=$row['nama_kriteria']?></th>
<?php endwhile; ?>
</tr>
<tr class="success">
<?php $bobot1 = $ranObj->readBob(); while ($row = $bobot1->fetch(PDO::FETCH_ASSOC)): ?>
<td><?=number_format($row['bobot_kriteria'], 4, '.', ',')?></td>
<?php endwhile; ?>
</tr>
</thead>
<tbody>
<?php $alt1a = $altObj->readAll(); while ($row1 = $alt1a->fetch(PDO::FETCH_ASSOC)): ?>
<tr>
<th class="active"><?=$row1['nama']?></th>
<?php $a = $row1['id_alternatif']; ?>
<?php $kri2a = $kriObj->readAll(); while ($row2 = $kri2a->fetch(PDO::FETCH_ASSOC)): ?>
<?php $b = $row2['id_kriteria']; ?>
<?php $ran1a = $ranObj->readR($a, $b); while ($row3 = $ran1a->fetch(PDO::FETCH_ASSOC)): ?>
<td>
<?php
echo $nor = number_format($row3['skor_alt_kri'], 4, '.', ',');
/*
pow($rowr['skor_alt_kri'],$bobot);
$ranObj->ia = $a;
$ranObj->ik = $b;
$ranObj->nn4 = $nor;
$ranObj->normalisasi1();
*/
?>
</td>
<?php endwhile; ?>
<?php endwhile; ?>
</tr>
<?php endwhile; ?>
<!-- <tr class="info">
<th>Jumlah</th>
<?php //$bobot2 = $ranObj->readBob(); while ($row = $bobot2->fetch(PDO::FETCH_ASSOC)): ?>
<td>
<?php
// $rmax1 = $ranObj->readMax($row['id_kriteria']);
// $max = $rmax1->fetch(PDO::FETCH_ASSOC);
// echo number_format($max['mnr1'], 4, '.', ',');
?>
</td>
<?php //endwhile; ?>
</tr> -->
</tbody>
</table>
<hr>
<h3>Hasil Akhir</h3>
<br/>
<table width="100%" class="table table-striped table-bordered">
<thead>
<tr>
<th rowspan="2" class="text-center active">Alternatif</th>
<th colspan="<?php $kri1b = $kriObj->readAll(); echo $kri1b->rowCount(); ?>" class="text-center">Kriteria</th>
<th rowspan="2" class="text-center warning">Hasil Akhir</th>
</tr>
<tr>
<?php $kri2b = $kriObj->readAll(); while ($row = $kri2b->fetch(PDO::FETCH_ASSOC)): ?>
<th><?=$row['nama_kriteria']?></th>
<?php endwhile; ?>
</tr>
</thead>
<tbody>
<?php $alt1b = $altObj->readAll(); while ($row1 = $alt1b->fetch(PDO::FETCH_ASSOC)): ?>
<tr>
<th class="active"><?=$row1['nama']?></th>
<?php $a1 = $row1['id_alternatif']; ?>
<?php $kri2b = $kriObj->readAll(); while ($row2 = $kri2b->fetch(PDO::FETCH_ASSOC)): ?>
<?php $b2 = $row2['id_kriteria']; ?>
<?php $ran1b = $ranObj->readR($a1, $b2); while ($row3 = $ran1b->fetch(PDO::FETCH_ASSOC)): ?>
<td>
<?php
$norx = $row3['skor_alt_kri'] * $row2['bobot_kriteria'];
//pow($row3['skor_alt_kri'],$bobot);
echo number_format($norx, 4, '.', ',');
$ranObj->ia = $a1;
$ranObj->ik = $b2;
$ranObj->nn4 = $norx;
$ranObj->normalisasi1();
?>
</td>
<?php endwhile; ?>
<?php endwhile; ?>
<td class="warning">
<?php
$stmthasil = $ranObj->readHasil1($a1);
$hasil = $stmthasil->fetch(PDO::FETCH_ASSOC);
echo number_format($hasil['bbn'], 4, '.', ',');
$ranObj->ia = $a1;
$ranObj->has1 = $hasil['bbn'];
$ranObj->hasil1();
?>
</td>
</tr>
<?php endwhile; ?>
<!-- <tr>
<th>Jumlah</th>
<?php //while ($rowx2 = $stmtx2y->fetch(PDO::FETCH_ASSOC)): ?>
<td>
<?php
// $stmtx3y = $ranObj->readMax($rowx2['id_kriteria']);
// $rowx3 = $stmtx3y->fetch(PDO::FETCH_ASSOC);
// echo number_format($rowx3['mnr1'], 5, '.', ',');
?>
</td>
<?php //endwhile; ?>
<td>
<?php
// $stmtx4y = $ranObj->readMax2();
// $rowx4 = $stmtx4y->fetch(PDO::FETCH_ASSOC);
// echo number_format($rowx4['mnr2'], 5, '.', ',');
?>
</td>
</tr> -->
</tbody>
</table>
<hr>
<h3>Hasil Perankingan</h3>
<br>
<table width="100%" class="table table-striped table-bordered">
<thead>
<tr>
<th>No</th>
<th>NIM</th>
<th>Nama</th>
<th>Hasil Akhir</th>
<th class="success">Ranking</th>
</tr>
</thead>
<tbody>
<?php $no = 1; $rank = 1; $alt1c = $altObj->readByRank(); while ($row = $alt1c->fetch(PDO::FETCH_ASSOC)): ?>
<tr>
<td><?=$no++?></td>
<td><?=$row["nim"]?></td>
<td><?=$row["nama"]?></td>
<td><?=number_format($row["hasil_akhir"], 4, '.', ',')?></td>
<td class="success"><?=$rank++?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
<?php include_once('includes/footer.inc.php'); ?>