199 lines
7.8 KiB
PHP
199 lines
7.8 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
$this->load->view('dist/_partials/header');
|
|
$deleteee = "delete from centroid_data where tahun='$tahun'";
|
|
$this->db->query($deleteee);
|
|
?>
|
|
|
|
<!-- 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>
|
|
</section>
|
|
<div class="section-body">
|
|
<div id="popupContainer" class="popup-container">
|
|
<div id="popup" class="popup">
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
<li class="nav-item">
|
|
<a class="nav-link active" href="#data" role="tab" data-toggle="tab">Pilih Berdasarkan Data</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#manual" role="tab" data-toggle="tab">Isi Sendiri</a>
|
|
</li>
|
|
|
|
</ul>
|
|
<!-- Tabs navs -->
|
|
<div class="tab-content">
|
|
<div role="tabpanel" class="tab-pane fade show active" id="data">
|
|
<?php echo form_open('cluster/cluster'); ?>
|
|
<h3>Pilih Centroid Awal </h3>
|
|
<p>memilih centroid awal dengan data kecamatan</p>
|
|
<input type="hidden" name="coba" value="1" />
|
|
<div class="table-responsive">
|
|
<table class="table table-striped" id="table-1">
|
|
<tr>
|
|
<td> Tahun</td>
|
|
<td>
|
|
<select class="form-control" name="n_tahun" id="">
|
|
|
|
<option value="<?php echo $tahun; ?>"><?php echo $tahun; ?></option>
|
|
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
|
|
<td>C1</td>
|
|
<td>
|
|
<select class="form-control" name="n_c1" id="dropdown" required>
|
|
<option value="">pilih</option>
|
|
<?php
|
|
$tahunt = "SELECT alternatif_nama,alternatif_id from alternatif";
|
|
$ta1 = $this->db->query($tahunt);
|
|
$no = 1;
|
|
foreach ($ta1->result_array() as $o) { ?>
|
|
<option value="<?php echo $o['alternatif_id']; ?>">
|
|
<?php echo $no++ . ' | ' . $o['alternatif_nama']; ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td>C2</td>
|
|
<td>
|
|
<select class="form-control" name="n_c2" id="" required>
|
|
<option value="">pilih</option>
|
|
<?php
|
|
$tahunt = "SELECT alternatif_nama,alternatif_id from alternatif";
|
|
$ta1 = $this->db->query($tahunt);
|
|
$no = 1;
|
|
foreach ($ta1->result_array() as $o) { ?>
|
|
<option value="<?php echo $o['alternatif_id']; ?>">
|
|
<?php echo $no++ . ' | ' . $o['alternatif_nama']; ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>C3</td>
|
|
<td>
|
|
<select class="form-control" name="n_c3" id="">
|
|
<option value="">pilih</option>
|
|
<?php
|
|
$tahunt = "SELECT alternatif_nama,alternatif_id from alternatif";
|
|
$ta1 = $this->db->query($tahunt);
|
|
$no = 1;
|
|
foreach ($ta1->result_array() as $o) { ?>
|
|
<option value="<?php echo $o['alternatif_id']; ?>">
|
|
<?php echo $no++ . ' | ' . $o['alternatif_nama']; ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<button type="submit" name="proses" class="btn btn-primary">Submit</button>
|
|
<?php echo form_close(); ?>
|
|
</div>
|
|
|
|
<div role="tabpanel" class="tab-pane fade" id="manual">
|
|
|
|
<?php echo form_open('cluster/cluster'); ?>
|
|
<input type="hidden" name="coba" value="2" />
|
|
<input type="hidden" name="n_tahun" value="<?php echo $tahun; ?>" />
|
|
<div class="table-responsive">
|
|
<table align="center" class="table-sm-5">
|
|
<tr>
|
|
<h3>Isi Centroid Awal</h3>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C1</label></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><input type="number" name="x1" class="form-control" step="any" required></td>
|
|
<td><input type="number" name="y1" class="form-control" step="any" required></td>
|
|
<td><input type="number" name="z1" class="form-control" 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" step="any" required></td>
|
|
<td><input type="number" name="y2" class="form-control" step="any" required></td>
|
|
<td><input type="number" name="z2" class="form-control" step="any" required></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><label for="">C3</label></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><input type="number" name="x3" class="form-control" step="any" required></td>
|
|
<td><input type="number" name="y3" class="form-control" step="any" required></td>
|
|
<td><input type="number" name="z3" class="form-control" step="any" required></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
<button type="submit" name="proses" class="btn btn-primary">Submit</button>
|
|
<?php echo form_close(); ?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped" id="table-1">
|
|
<tr align="center">
|
|
<td>#</td>
|
|
<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
|
|
$datapertahun = "SELECT alternatif.alternatif_kode, alternatif.alternatif_nama, kriteria.c1c, kriteria.c2c, kriteria.c3c, kriteria.tahun FROM `alternatif`INNER JOIN kriteria ON alternatif.alternatif_id = kriteria.alternatif_id WHERE tahun='$tahun'";
|
|
$ta1 = $this->db->query($datapertahun);
|
|
$no = 1;
|
|
foreach ($ta1->result_array() as $s) { ?>
|
|
<tr align="center">
|
|
<td>
|
|
<?php echo $no++; ?>
|
|
</td>
|
|
<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 } ?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php $this->load->view('dist/_partials/footer'); ?>
|