-
Notifications
You must be signed in to change notification settings - Fork 28
/
hasil.php
116 lines (116 loc) · 3.49 KB
/
hasil.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
<?php
require 'connect.php';
require 'class/saw.php';
$cookiePilih=@$_COOKIE['pilih'];
if (isset($cookiePilih) and !empty($cookiePilih)) {
$saw=new saw();
$saw->setconfig($konek,$cookiePilih);
?>
<div id="Matriks Keputusan">
<h3>Matriks Keputusan</h3>
<table>
<thead>
<tr>
<th rowspan="2">Alternative</th>
<th colspan="<?php echo count($saw->getKriteria()) ?>">Kriteria</th>
</tr>
<tr>
<?php
foreach ($saw->getKriteria() as $key) {
echo "<th>$key</th>";
}
?>
</tr>
</thead>
<tbody>
<?php
foreach ($saw->getAlternative() as $key) {
echo "<tr id='data'>";
echo "<td>".$key['namaSupplier']."</td>";
$no=0;
foreach ($saw->getNilaiMatriks($key['id_supplier']) as $data) {
echo "<td>$data[nilai]</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<div id="Normalisasi Matriks Keputusan">
<h3>Normalisasi Matriks Keputusan</h3>
<table>
<thead>
<tr>
<th rowspan="2">Alternative</th>
<th colspan="<?php echo count($saw->getKriteria()) ?>">Kriteria</th>
</tr>
<tr>
<?php
foreach ($saw->getKriteria() as $key) {
echo "<th>$key</th>";
}
?>
</tr>
</thead>
<tbody>
<?php
//foreach data supplier
foreach ($saw->getAlternative() as $key) {
echo "<tr id='data'>";
echo "<td>".$key['namaSupplier']."</td>";
$no=0;
//foreach nilai supplier
foreach ($saw->getNilaiMatriks($key['id_supplier']) as $data) {
//menghitung normalisasi
$hasil=$saw->Normalisasi($saw->getArrayNilai($data['id_kriteria']),$data['sifat'],$data['nilai']);
echo "<td>$hasil</td>";
$hitungbobot[$key['id_supplier']][$no]=$hasil*$saw->getBobot($data['id_kriteria']);
$no++;
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<div id="Perangkingan">
<h3>Perangkingan</h3>
<table>
<thead>
<tr>
<th rowspan="2">Alternative</th>
<th colspan="<?php echo count($saw->getKriteria()) ?>">Kriteria</th>
<th rowspan="2">Hasil</th>
</tr>
<tr>
<?php
foreach ($saw->getKriteria() as $key) {
echo "<th>$key</th>";
}
?>
</tr>
</thead>
<tbody>
<?php
foreach ($saw->getAlternative() as $key) {
echo "<tr id='data'>";
echo "<td>".$key['namaSupplier']."</td>";
$no=0;$hasil=0;
foreach ($hitungbobot[$key['id_supplier']] as $data) {
echo "<td>$data</td>";
//menjumlahkan
$hasil+=$data;
}
$saw->simpanHasil($key['id_supplier'],$hasil);
echo "<td>".$hasil."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<?php
//cetak hasil
$saw->getHasil();
}