199 lines
7.9 KiB
PHP
199 lines
7.9 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
$this->load->view('dist/_partials/header');
|
|
?>
|
|
<!-- Main Content -->
|
|
<div class="main-content">
|
|
<section class="section">
|
|
<div class="section-header">
|
|
<h1>Pengelompokan Data Dengan K-Means</h1>
|
|
<div class="section-header-breadcrumb">
|
|
<div class="breadcrumb-item active"><a href="#">Dashboard</a></div>
|
|
<div class="breadcrumb-item">Cluster</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-body">
|
|
<?php echo form_open('cluster/iterasi_kmeans'); ?>
|
|
<div class="form-group">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div id="body">
|
|
<button type="submit" name="proses" class="btn btn-primary">Mulai Perhitungan</button>
|
|
<!-- <a class="btn btn-warning" href="<?php echo base_url(); ?>cluster/generate_rata">Generate Nilai</a> -->
|
|
<select style="width:100px;margin:10px 0;border-radius:5px;font-size:14px;height:100%;padding:6px;color:#6c757d;"
|
|
name="k_tahun">
|
|
<!-- <option value="1">Semua</option> -->
|
|
<option value="<?php echo $n_tahun; ?>"><?php echo $n_tahun; ?></option>
|
|
</select>
|
|
</br>
|
|
</br>
|
|
<!-- -->
|
|
|
|
|
|
</h3>
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<?php
|
|
if ($coba == 1) { ?>
|
|
<div class="table-responsive">
|
|
<table align="center" class="table-sm-5">
|
|
<tr>
|
|
<h3>centroid awal/titik pusat</h3>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C1</label></td>
|
|
</tr>
|
|
<?php
|
|
$datapertahun = "SELECT c1c as b, c2c as k, c3c as j from kriteria WHERE tahun='$n_tahun' AND alternatif_id=$n_c1";
|
|
$ta1 = $this->db->query($datapertahun);
|
|
$datapertahun2 = "SELECT c1c as b, c2c as k, c3c as j from kriteria WHERE tahun='$n_tahun' AND alternatif_id=$n_c2";
|
|
$ta2 = $this->db->query($datapertahun2);
|
|
$datapertahun3 = "SELECT c1c as b, c2c as k, c3c as j from kriteria WHERE tahun='$n_tahun' AND alternatif_id=$n_c3";
|
|
$ta3 = $this->db->query($datapertahun3);
|
|
$no = 1;
|
|
foreach ($ta1->result_array() as $s) { ?>
|
|
<tr>
|
|
<td><input type="number" name="x1" class="form-control" value="<?php echo $s['b']; ?>" step="any"
|
|
required></td>
|
|
<td><input type="number" name="y1" class="form-control" value="<?php echo $s['k']; ?>" step="any"
|
|
required></td>
|
|
<td><input type="number" name="z1" class="form-control" value="<?php echo $s['j']; ?>" step="any"
|
|
required></td>
|
|
</tr> <?php } ?>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C2</label></td>
|
|
</tr>
|
|
<?php foreach ($ta2->result_array() as $s2) { ?>
|
|
<tr>
|
|
<td><input type="number" name="x2" class="form-control" value="<?php echo $s2['b']; ?>" step="any"
|
|
required></td>
|
|
<td><input type="number" name="y2" class="form-control" value="<?php echo $s2['k']; ?>" step="any"
|
|
required></td>
|
|
<td><input type="number" name="z2" class="form-control" value="<?php echo $s2['j']; ?>" step="any"
|
|
required></td>
|
|
</tr><?php } ?>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C3</label></td>
|
|
</tr>
|
|
<?php foreach ($ta3->result_array() as $s3) { ?>
|
|
<tr>
|
|
<td><input type="number" name="x3" class="form-control" value="<?php echo $s3['b']; ?>" step="any"
|
|
required></td>
|
|
<td><input type="number" name="y3" class="form-control" value="<?php echo $s3['k']; ?>" step="any"
|
|
required></td>
|
|
<td><input type="number" name="z3" class="form-control" value="<?php echo $s3['j']; ?>" step="any"
|
|
required></td>
|
|
</tr><?php } ?>
|
|
|
|
</table>
|
|
</div>
|
|
<?php
|
|
} elseif ($coba == 2) { ?>
|
|
<div class="table-responsive">
|
|
<table align="center" class="table-sm-5">
|
|
<tr>
|
|
<h3>centroid awal/titik pusat</h3>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C1</label></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><input type="number" name="x1" class="form-control" value="<?php echo $x1; ?>" step="any" required>
|
|
</td>
|
|
<td><input type="number" name="y1" class="form-control" value="<?php echo $y1; ?>" step="any" required>
|
|
</td>
|
|
<td><input type="number" name="z1" class="form-control" value="<?php echo $z1; ?>" step="any" required>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C2</label></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><input type="number" name="x2" class="form-control" value="<?php echo $x2; ?>" step="any" required>
|
|
</td>
|
|
<td><input type="number" name="y2" class="form-control" value="<?php echo $y2; ?>" step="any" required>
|
|
</td>
|
|
<td><input type="number" name="z2" class="form-control" value="<?php echo $z2; ?>" step="any" required>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C3</label></td>
|
|
</tr>
|
|
|
|
<td><input type="number" name="x3" class="form-control" value="<?php echo $x3; ?>" step="any" required>
|
|
</td>
|
|
<td><input type="number" name="y3" class="form-control" value="<?php echo $y3; ?>" step="any" required>
|
|
</td>
|
|
<td><input type="number" name="z3" class="form-control" value="<?php echo $z3; ?>" step="any" required>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
<?php echo form_close(); ?>
|
|
|
|
|
|
<?php if (isset($_GET['notif'])):
|
|
_notif($this->session->flashdata($_GET['notif']));
|
|
endif; ?>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped" id="table-1">
|
|
<tr align="center">
|
|
<td>Kode kecamatan</td>
|
|
<td>Nama Kecamatan</td>
|
|
<?php foreach ($tes->result() as $tes_t) { ?>
|
|
<td><?php echo $tes_t->nama; ?></td>
|
|
<?php } ?>
|
|
|
|
<td>Tahun</td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
foreach ($kriteria->result_array() as $s) { ?>
|
|
<tr align="center">
|
|
<td><?php echo $s['alternatif_kode']; ?></td>
|
|
<td><?php echo $s['alternatif_nama']; ?></td>
|
|
<td><?php echo $s['c1c']; ?></td>
|
|
<td><?php echo $s['c2c']; ?></td>
|
|
<td><?php echo $s['c3c']; ?></td>
|
|
<td><?php echo $s['tahun']; ?></td>
|
|
|
|
</tr>
|
|
<?php
|
|
}
|
|
$delete = "delete from centroid_data where tahun='$n_tahun'";
|
|
$this->db->query($delete);
|
|
?>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<?php $this->load->view('dist/_partials/footer'); ?>
|