1197 lines
47 KiB
PHP
1197 lines
47 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Dist extends CI_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$this->load->helper('url');
|
|
$this->load->helper('vic_helper');
|
|
$this->load->helper('my_helper');
|
|
$this->load->helper('vic_convert_helper');
|
|
$this->load->model('m_vic');
|
|
$this->load->library(array('excel', 'session'));
|
|
if ($this->session->userdata('login') != 'login') {
|
|
redirect('auth');
|
|
}
|
|
}
|
|
|
|
public function coba()
|
|
{
|
|
$data['combo1Options'] = $this->m_vic->getCombo1Options();
|
|
$data['combo2Options'] = $this->m_vic->getCombo2Options();
|
|
|
|
$this->load->view('dist/data_view', $data);
|
|
}
|
|
|
|
public function getFilteredData()
|
|
{
|
|
$selectedValue1 = $this->input->post('combo1');
|
|
$selectedValue2 = $this->input->post('combo2');
|
|
|
|
$data['selectedValue1'] = $selectedValue1;
|
|
$data['selectedValue2'] = $selectedValue2;
|
|
|
|
$data['filteredData'] = $this->m_vic->getFilteredData($selectedValue1, $selectedValue2);
|
|
|
|
$this->load->view('dist/data_view', $data);
|
|
}
|
|
|
|
public function import_excel()
|
|
{
|
|
if (isset($_FILES["fileExcel"]["name"])) {
|
|
$path = $_FILES["fileExcel"]["tmp_name"];
|
|
$object = PHPExcel_IOFactory::load($path);
|
|
foreach ($object->getWorksheetIterator() as $worksheet) {
|
|
$highestRow = $worksheet->getHighestRow();
|
|
$highestColumn = $worksheet->getHighestColumn();
|
|
for ($row = 2; $row <= $highestRow; $row++) {
|
|
$alternatif_id = $worksheet->getCellByColumnAndRow(0, $row)->getValue();
|
|
$c1c = $worksheet->getCellByColumnAndRow(1, $row)->getValue();
|
|
$c2c = $worksheet->getCellByColumnAndRow(2, $row)->getValue();
|
|
$c3c = $worksheet->getCellByColumnAndRow(3, $row)->getValue();
|
|
$tahun = $worksheet->getCellByColumnAndRow(4, $row)->getValue();
|
|
$temp_data[] = array(
|
|
'alternatif_id' => $alternatif_id,
|
|
'c1c' => $c1c,
|
|
'c2c' => $c2c,
|
|
'c3c' => $c3c,
|
|
'tahun' => $tahun,
|
|
);
|
|
}
|
|
}
|
|
$this->load->model('ImportModel');
|
|
$insert = $this->ImportModel->insert($temp_data);
|
|
if ($insert) {
|
|
$this->session->set_flashdata('status', '<span class="glyphicon glyphicon-ok"></span> Data Berhasil di Import ke Database');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('status', '<span class="glyphicon glyphicon-remove"></span> Terjadi Kesalahan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else {
|
|
echo "Tidak ada file yang masuk";
|
|
}
|
|
}
|
|
|
|
public function logout()
|
|
{
|
|
$this->session->sess_destroy();
|
|
redirect(base_url());
|
|
}
|
|
public function index()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
|
|
$data['hit'] = $this->m_vic->selectcount('alternatif');
|
|
$data['title'] = "Dashboard";
|
|
$this->mylib->view('dist/index-0', $data);
|
|
}
|
|
|
|
public function index_0()
|
|
{
|
|
$data = array(
|
|
|
|
'title' => "General Dashboard",
|
|
);
|
|
$this->load->view('dist/index-0', $data);
|
|
}
|
|
|
|
public function layout_default()
|
|
{
|
|
$data = array(
|
|
'title' => "Layout › Default",
|
|
);
|
|
$this->load->view('dist/layout-default', $data);
|
|
}
|
|
|
|
public function layout_transparent()
|
|
{
|
|
$data = array(
|
|
'title' => "Layout › Transparent Sidebar",
|
|
);
|
|
$this->load->view('dist/layout-transparent', $data);
|
|
}
|
|
|
|
public function layout_top_navigation()
|
|
{
|
|
$data = array(
|
|
'title' => "Layout › Top Navigation",
|
|
);
|
|
$this->load->view('dist/layout-top-navigation', $data);
|
|
}
|
|
public function isikriteria()
|
|
{
|
|
$data['tes'] = $this->m_vic->get_data('tes');
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Daftar Kriteria";
|
|
$this->load->view('dist/v_krit', $data);
|
|
}
|
|
|
|
public function tambah_krit()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Data Kriteria";
|
|
$this->mylib->view('dist/v_tambah_krit', $data);
|
|
}
|
|
|
|
public function edit_isikriteria($id)
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['tes'] = $this->m_vic->get_data('tes');
|
|
$data['title'] = "edit Kriteria ";
|
|
$w = array(
|
|
'id' => $id,
|
|
);
|
|
$data['tes'] = $this->m_vic->edit_data($w, 'tes')->row();
|
|
$this->mylib->view('dist/v_edit_krit', $data);
|
|
}
|
|
|
|
public function update_isikriteria($id)
|
|
{
|
|
$w = array(
|
|
'id' => $id,
|
|
);
|
|
$data = array(
|
|
|
|
'nama' => $this->input->post('nama'),
|
|
);
|
|
$this->m_vic->update_data($w, $data, 'tes');
|
|
$this->session->set_flashdata('suces', 'Data berhasil di update!');
|
|
redirect('dist/isikriteria?notif=suces');
|
|
}
|
|
|
|
public function datakecamatan()
|
|
{
|
|
$data['alternatif'] = $this->m_vic->get_data('alternatif');
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Data kecamatan";
|
|
$this->load->view('dist/v_datakecamatan', $data);
|
|
}
|
|
public function tambah_datakecamatan()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Data kecamatan";
|
|
$this->mylib->view('dist/v_tambah_datakecamatan', $data);
|
|
}
|
|
|
|
public function tambah_datakecamatan_act()
|
|
{
|
|
if ($_FILES['file']['name'] != "") {
|
|
$config['upload_path'] = './assets/geojson/';
|
|
$config['allowed_types'] = '*';
|
|
$config['max_size'] = 500;
|
|
$config['file_name'] = time();
|
|
$this->load->library('upload', $config);
|
|
if ($this->upload->do_upload('file')) {
|
|
$upload_data = $this->upload->data();
|
|
$data = array(
|
|
'alternatif_id' => $this->input->post('id'),
|
|
'alternatif_kode' => $this->input->post('kode'),
|
|
'alternatif_nama' => $this->input->post('nama'),
|
|
'alternatif_file' => $upload_data['file_name'],
|
|
);
|
|
$this->m_vic->insert_data($data, 'alternatif');
|
|
$this->session->set_flashdata('suces', 'Data berhasil di tambah!');
|
|
redirect('dist/datakecamatan?notif=suces');
|
|
} else {
|
|
$error = array('error' => $this->upload->display_errors());
|
|
$this->session->set_flashdata('error', $error['error']);
|
|
redirect('dist/tambah_datakecamatan?notif=error');
|
|
}
|
|
} else {
|
|
$this->session->set_flashdata('error', 'File wajib di upload!');
|
|
redirect('dist/tambah_datakecamatan?notif=error');
|
|
}
|
|
}
|
|
public function edit_datakecamatan($id)
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Dashboard";
|
|
$w = array(
|
|
'alternatif_id' => $id,
|
|
);
|
|
$data['alternatif'] = $this->m_vic->edit_data($w, 'alternatif')->row();
|
|
$this->mylib->view('dist/v_edit_datakecamatan', $data);
|
|
}
|
|
|
|
public function update_datakecamatan($id)
|
|
{
|
|
if ($_FILES['file']['name'] != "") {
|
|
$config['upload_path'] = './assets/geojson/';
|
|
$config['allowed_types'] = '*';
|
|
$config['max_size'] = 500;
|
|
$config['file_name'] = time();
|
|
$this->load->library('upload', $config);
|
|
if ($this->upload->do_upload('file')) {
|
|
$upload_data = $this->upload->data();
|
|
$data = array(
|
|
'alternatif_id' => $this->input->post('id'),
|
|
'alternatif_kode' => $this->input->post('kode'),
|
|
'alternatif_nama' => $this->input->post('nama'),
|
|
'alternatif_file' => $upload_data['file_name'],
|
|
);
|
|
$this->db->update('alternatif', $data, ['alternatif_id' => $id]);
|
|
$this->session->set_flashdata('suces', 'Data berhasil diubah!');
|
|
redirect('dist/datakecamatan/?notif=suces');
|
|
} else {
|
|
$error = array('error' => $this->upload->display_errors());
|
|
$this->session->set_flashdata('error', $error['error']);
|
|
redirect('dist/datakecamatan' . $id . '?notif=error');
|
|
}
|
|
} else {
|
|
$data = array(
|
|
'alternatif_kode' => $this->input->post('kode'),
|
|
'alternatif_nama' => $this->input->post('nama'),
|
|
);
|
|
$this->db->update('alternatif', $data, ['alternatif_id' => $id]);
|
|
$this->session->set_flashdata('suces', 'Data berhasil diubah!');
|
|
redirect('dist/datakecamatan?notif=suces');
|
|
}
|
|
}
|
|
|
|
public function delete_datakecamatan($id)
|
|
{
|
|
$w = array(
|
|
'alternatif_id' => $id,
|
|
);
|
|
$this->m_vic->delete_data($w, 'alternatif');
|
|
$this->session->set_flashdata('suces', 'Data user berhasil dihapus!');
|
|
redirect('dist/datakecamatan?notif=suces');
|
|
}
|
|
|
|
// kriteria
|
|
public function kriteria()
|
|
{
|
|
$d_tahun = $this->input->post('n_tahun');
|
|
if ($d_tahun == '') {
|
|
|
|
} else {
|
|
$this->db->query("delete from kriteria where tahun=$d_tahun");
|
|
$this->db->query("delete from normalisasi where tahun=$d_tahun");
|
|
$this->db->query("delete from predikat where tahun=$d_tahun");
|
|
}
|
|
|
|
$data_tahun = $this->m_vic->selecttahun('kriteria');
|
|
$data['data_tahun'] = $data_tahun;
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['tes'] = $this->m_vic->get_data('tes');
|
|
$data['title'] = "Kriteria ";
|
|
$data['kriteria'] = $this->m_vic->get_data('kriteria');
|
|
$this->load->model('ImportModel');
|
|
$data['list_data'] = $this->ImportModel->getData();
|
|
$this->mylib->view('dist/v_kriteria', $data);
|
|
}
|
|
public function hapus()
|
|
{
|
|
$d_tahun = $this->input->post('n_tahun');
|
|
|
|
$isi_t = $this->db->query("delete from kriteria where tahun=$d_tahun");
|
|
|
|
$data = $isi_t;
|
|
|
|
$data_tahun = $this->m_vic->selecttahun('kriteria');
|
|
|
|
$data['data_tahun'] = $data_tahun;
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Kriteria ";
|
|
$data['kriteria'] = $this->m_vic->get_data('kriteria');
|
|
$this->load->model('ImportModel');
|
|
$data['list_data'] = $this->ImportModel->getData();
|
|
$this->mylib->view('dist/v_kriteria', $data);
|
|
}
|
|
|
|
public function tambah_kriteria()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['alternatif'] = $this->m_vic->get_data('alternatif');
|
|
$data['tes'] = $this->m_vic->get_data('tes');
|
|
$data['title'] = "Edit Kriteria ";
|
|
$this->mylib->view('dist/v_tambah_kriteria', $data);
|
|
}
|
|
|
|
public function tambah_kriteria_act()
|
|
{
|
|
|
|
$data = array(
|
|
'alternatif_id' => $this->input->post('alternatif_id'),
|
|
'c1c' => $this->input->post('c1c'),
|
|
'c2c' => $this->input->post('c2c'),
|
|
'c3c' => $this->input->post('c3c'),
|
|
|
|
'tahun' => $this->input->post('tahun'),
|
|
);
|
|
$this->m_vic->insert_data($data, 'kriteria');
|
|
$this->session->set_flashdata('suces', 'Data berhasil di tambah!');
|
|
redirect('dist/kriteria?notif=suces');
|
|
}
|
|
|
|
public function edit_kriteria($id)
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['tes'] = $this->m_vic->get_data('tes');
|
|
$data['alternatif'] = $this->m_vic->get_data('alternatif');
|
|
$data['krit'] = $this->m_vic->get_datang('topografi');
|
|
$data['title'] = "edit Kriteria ";
|
|
$w = array(
|
|
'kriteria_id' => $id,
|
|
);
|
|
$data['kriteria'] = $this->m_vic->edit_data($w, 'kriteria')->row();
|
|
$this->mylib->view('dist/v_edit_kriteria', $data);
|
|
}
|
|
|
|
public function update_kriteria($id)
|
|
{
|
|
$w = array(
|
|
'kriteria_id' => $id,
|
|
);
|
|
$data = array(
|
|
'alternatif_id' => $this->input->post('alternatif_id'),
|
|
'c1c' => $this->input->post('c1c'),
|
|
'c2c' => $this->input->post('c2c'),
|
|
'c3c' => $this->input->post('c3c'),
|
|
'tahun' => $this->input->post('tahun'),
|
|
);
|
|
$this->m_vic->update_data($w, $data, 'kriteria');
|
|
$this->session->set_flashdata('suces', 'Data berhasil di update!');
|
|
redirect('dist/kriteria?notif=suces');
|
|
}
|
|
|
|
public function delete_kriteria($id)
|
|
{
|
|
$w = array(
|
|
'kriteria_id' => $id,
|
|
);
|
|
$this->m_vic->delete_data($w, 'kriteria');
|
|
$this->session->set_flashdata('suces', 'Data berhasil dihapus!');
|
|
redirect('dist/kriteria?notif=suces');
|
|
}
|
|
|
|
public function pengisian_data()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "pengisian data";
|
|
$data['alternatif'] = $this->m_vic->get_data('alternatif');
|
|
$data['kriteria'] = $this->m_vic->get_data('kriteria_tes');
|
|
$this->mylib->view('dist/v_pengisian_data', $data);
|
|
}
|
|
|
|
public function pengisian_data2()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "pengisian data";
|
|
$data['alternatif'] = $this->m_vic->get_data('alternatif');
|
|
$data['kriteria'] = $this->m_vic->get_data('kriteria');
|
|
$this->mylib->view('dist/v_pengisian_data2', $data);
|
|
}
|
|
|
|
public function tambah_data2()
|
|
{
|
|
// insert data
|
|
$alternatif = $this->m_vic->get_data('alternatif');
|
|
$kriteria = $this->m_vic->get_data('kriteria_tes');
|
|
foreach ($alternatif->result() as $a) {
|
|
foreach ($kriteria->result() as $k) {
|
|
|
|
$where = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->m_vic->edit_data($where, 'data');
|
|
$data_isi = $this->input->post('data-' . $a->alternatif_id . '' . $k->kriteria_id);
|
|
|
|
if ($data->num_rows() > 0) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data_pengisian = array(
|
|
'data_isi' => $data_isi,
|
|
);
|
|
$this->m_vic->update_data($w, $data_pengisian, 'data');
|
|
} else {
|
|
$data_pengisian = array(
|
|
'data_alternatif' => $a->alternatif_id,
|
|
'data_kriteria' => $k->kriteria_id,
|
|
'data_isi' => $data_isi,
|
|
);
|
|
$this->m_vic->insert_data($data_pengisian, 'data');
|
|
}
|
|
}
|
|
}
|
|
$this->session->set_flashdata('suces', 'Data berhasil diperbaharui!');
|
|
redirect('dist/pengisian_data?notif=suces');
|
|
}
|
|
|
|
public function normalisasi2()
|
|
{
|
|
$this->db->truncate('normalisasi_data');
|
|
$alternatif = $this->db->get('alternatif');
|
|
$kriteria = $this->db->get('kriteria');
|
|
|
|
$all_data_array = array();
|
|
foreach ($alternatif->result() as $alt) {
|
|
$data_krit = array();
|
|
foreach ($kriteria->result() as $k) {
|
|
$data_isi = $this->db->query("SELECT data_isi FROM data WHERE data_alternatif = '$alt->alternatif_id' AND data_kriteria = '$k->kriteria_id'")->row();
|
|
array_push($data_krit, $data_isi->data_isi);
|
|
}
|
|
array_push($all_data_array, $data_krit);
|
|
}
|
|
|
|
}
|
|
|
|
public function normalisasi()
|
|
{
|
|
$this->db->truncate('normalisasi_data');
|
|
$alternatif = $this->m_vic->get_data('alternatif');
|
|
$kriteria = $this->m_vic->get_data('kriteria');
|
|
$data_isi = [];
|
|
foreach ($kriteria->result() as $k) {
|
|
$data_isi_per_kriteria = $this->db->query("SELECT data_isi FROM data WHERE data_kriteria = $k->kriteria_id")->result_array();
|
|
array_push($data_isi, $data_isi_per_kriteria);
|
|
}
|
|
$jml_alternatif = count($data_isi);
|
|
// mencari min max
|
|
$all_data_isi = [];
|
|
for ($i = 0; $i < $jml_alternatif; $i++) {
|
|
$jml_kriteria = count($data_isi[$i]);
|
|
$kriteria_number = [];
|
|
for ($j = 0; $j < $jml_kriteria; $j++) {
|
|
$isi = $data_isi[$i][$j]['data_isi'];
|
|
array_push($kriteria_number, $isi);
|
|
}
|
|
array_push($all_data_isi, $kriteria_number);
|
|
}
|
|
|
|
$i = 0;
|
|
$result = array();
|
|
foreach ($kriteria->result() as $k) {
|
|
$j = 0;
|
|
foreach ($alternatif->result() as $alt) {
|
|
$min = min($all_data_isi[$i]);
|
|
$max = max($all_data_isi[$i]);
|
|
$hasil_normal = (($data_isi[$i][$j]['data_isi'] - $min) / ($max - $min));
|
|
if ($hasil_normal == 0) {
|
|
$hasil_normal = 0.00000000000001;
|
|
}
|
|
$result[] = array(
|
|
'data_alternatif' => $alt->alternatif_id,
|
|
'data_kriteria' => $k->kriteria_id,
|
|
'data_isi' => $hasil_normal,
|
|
);
|
|
// $this->db->insert('normalisasi_data',$data);
|
|
$j++;
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
$this->db->insert_batch('normalisasi_data', $result);
|
|
|
|
redirect('dist/mulai_perhitungan');
|
|
}
|
|
|
|
public function awal()
|
|
{
|
|
$this->db->truncate('normalisasi_data');
|
|
$alternatif = $this->m_vic->get_data('alternatif');
|
|
$kriteria = $this->m_vic->get_data('kriteria');
|
|
$data_isi = [];
|
|
foreach ($kriteria->result() as $k) {
|
|
$data_isi_per_kriteria = $this->db->query("SELECT data_isi FROM data WHERE data_kriteria = $k->kriteria_id")->result_array();
|
|
array_push($data_isi, $data_isi_per_kriteria);
|
|
}
|
|
$jml_alternatif = count($data_isi);
|
|
// mencari min max
|
|
$all_data_isi = [];
|
|
for ($i = 0; $i < $jml_alternatif; $i++) {
|
|
$jml_kriteria = count($data_isi[$i]);
|
|
$kriteria_number = [];
|
|
for ($j = 0; $j < $jml_kriteria; $j++) {
|
|
$isi = $data_isi[$i][$j]['data_isi'];
|
|
array_push($kriteria_number, $isi);
|
|
}
|
|
array_push($all_data_isi, $kriteria_number);
|
|
}
|
|
|
|
$i = 0;
|
|
$result = array();
|
|
foreach ($kriteria->result() as $k) {
|
|
$j = 0;
|
|
foreach ($alternatif->result() as $alt) {
|
|
$min = min($all_data_isi[$i]);
|
|
$max = max($all_data_isi[$i]);
|
|
$hasil_normal = (($data_isi[$i][$j]['data_isi'] - $min) / ($max - $min));
|
|
if ($hasil_normal == 0) {
|
|
$hasil_normal = 0.00000000000001;
|
|
}
|
|
$result[] = array(
|
|
'data_alternatif' => $alt->alternatif_id,
|
|
'data_kriteria' => $k->kriteria_id,
|
|
'data_isi' => $hasil_normal,
|
|
);
|
|
// $this->db->insert('normalisasi_data',$data);
|
|
$j++;
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
$this->db->insert_batch('normalisasi_data', $result);
|
|
|
|
redirect('dist/mulai_perhitungan');
|
|
}
|
|
|
|
public function mulai_perhitungan()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Perhitungan";
|
|
$this->mylib->view('dist/v_perhitungan', $data);
|
|
}
|
|
|
|
public function tampil_peta()
|
|
{
|
|
$t = $_GET['tahun'];
|
|
if ($t == 1) {
|
|
$tahun = '';
|
|
} else {
|
|
$tahun = "AND predikat.tahun='$t'";
|
|
}
|
|
$data['kriteria'] = $this->m_vic->get_data('kriteria');
|
|
$data['alternatif'] = $this->m_vic->selectal($tahun);
|
|
$data = array(
|
|
'tinggi' => $this->m_vic->selecttinggi($tahun),
|
|
'sedang' => $this->m_vic->selectsedang($tahun),
|
|
'rendah' => $this->m_vic->selectrendah($tahun),
|
|
'tes' => $this->m_vic->get_data('tes'),
|
|
);
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Peta";
|
|
|
|
$this->mylib->view('dist/v_peta', $data);
|
|
}
|
|
|
|
public function get_info()
|
|
{
|
|
$placeId = $this->input->post('placeId');
|
|
$alternatif = $this->db->query("SELECT alternatif_id FROM alternatif WHERE alternatif_kode = '$placeId'")->row();
|
|
$altId = $alternatif->alternatif_id;
|
|
$kriteria = $this->db->get('kriteria')->result();
|
|
$data = array();
|
|
foreach ($kriteria as $k) {
|
|
$kId = $k->kriteria_id;
|
|
$data_isi = $this->db->query("SELECT data_isi FROM data WHERE data_alternatif = $altId AND data_kriteria = $kId")->row();
|
|
$result = ['kriteria' => $k->kriteria_nama, 'data' => $data_isi->data_isi, 'altId' => $altId];
|
|
array_push($data, $result);
|
|
}
|
|
echo json_encode($data);
|
|
}
|
|
|
|
public function perhitungan()
|
|
{
|
|
|
|
if ($this->input->post('tahun') == 'all') {
|
|
$this->db->truncate('centroid');
|
|
$alternatif = $this->m_vic->get_data('alternatif');
|
|
$kriteria = $this->m_vic->get_data('kriteria');
|
|
if ($this->input->post('centroid_awal')) {
|
|
// $centreoid_terpilih = [31,32,44]; //2014
|
|
// $centreoid_terpilih = [27,28,66]; //2015
|
|
// $centreoid_terpilih = [38,39,40]; //2018
|
|
// $centreoid_terpilih = [36,38,40]; //2019
|
|
$centreoid_terpilih = explode(',', $this->input->post('centroid_awal'));
|
|
} else {
|
|
$centreoid_terpilih = array();
|
|
$alternatif_temp = array();
|
|
foreach ($alternatif->result() as $ad) {
|
|
$alternatif_temp[] = $ad->alternatif_id;
|
|
}
|
|
|
|
for ($z = 0; $z < 3; $z++) {
|
|
$rand_key = array_rand($alternatif_temp);
|
|
array_push($centreoid_terpilih, $alternatif_temp[$rand_key]);
|
|
unset($alternatif_temp[$rand_key]);
|
|
}
|
|
}
|
|
|
|
$center_rendah = array();
|
|
$center_sedang = array();
|
|
$center_tinggi = array();
|
|
$no = 0;
|
|
foreach ($centreoid_terpilih as $alt) {
|
|
$res_data = $this->db->query("SELECT data_kriteria,data_isi FROM normalisasi_data WHERE data_alternatif = $alt ORDER BY data_kriteria");
|
|
$nama = '';
|
|
switch ($no) {
|
|
case 0:
|
|
$nama = 'Rendah';
|
|
foreach ($res_data->result() as $t) {
|
|
$center_rendah[] = $t->data_isi;
|
|
}
|
|
break;
|
|
case 1:
|
|
$nama = 'Sedang';
|
|
foreach ($res_data->result() as $t) {
|
|
$center_sedang[] = $t->data_isi;
|
|
}
|
|
break;
|
|
case 2:
|
|
$nama = 'Tinggi';
|
|
foreach ($res_data->result() as $t) {
|
|
$center_tinggi[] = $t->data_isi;
|
|
}
|
|
break;
|
|
default:
|
|
$nama = '';
|
|
break;
|
|
}
|
|
foreach ($res_data->result() as $r_data) {
|
|
$data = array(
|
|
'centroid_alternatif' => $alt,
|
|
'centroid_kriteria' => $r_data->data_kriteria,
|
|
'centroid_isi' => $r_data->data_isi,
|
|
'centroid_nama' => $nama,
|
|
);
|
|
$this->m_vic->insert_data($data, 'centroid');
|
|
}
|
|
$no++;
|
|
}
|
|
|
|
$center_rendah_awal = $center_rendah;
|
|
$center_sedang_awal = $center_sedang;
|
|
$center_tinggi_awal = $center_tinggi;
|
|
|
|
//========================================================
|
|
|
|
$selesai = false;
|
|
$iterasi = 1;
|
|
while ($selesai == false) {
|
|
$i = 0;
|
|
$rendah = array();
|
|
$res_rendah = array();
|
|
$res2_rendah = array();
|
|
$sedang = array();
|
|
$res_sedang = array();
|
|
$res2_sedang = array();
|
|
$tinggi = array();
|
|
$res_tinggi = array();
|
|
$res2_tinggi = array();
|
|
foreach ($alternatif->result() as $a) {
|
|
${'_' . $i} = array();
|
|
$kj = 0;
|
|
foreach ($kriteria->result() as $k) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->db->get_where('normalisasi_data', $w)->row();
|
|
$rendah_ = pow(($data->data_isi - $center_rendah[$kj]), 2);
|
|
array_push($rendah, $rendah_);
|
|
$kj++;
|
|
}
|
|
array_push($res_rendah, $rendah);
|
|
$rendah = array();
|
|
|
|
$sj = 0;
|
|
foreach ($kriteria->result() as $k) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->db->get_where('normalisasi_data', $w)->row();
|
|
$sedang_ = pow(($data->data_isi - $center_sedang[$sj]), 2);
|
|
array_push($sedang, $sedang_);
|
|
$sj++;
|
|
}
|
|
array_push($res_sedang, $sedang);
|
|
$sedang = array();
|
|
|
|
$bj = 0;
|
|
foreach ($kriteria->result() as $k) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->db->get_where('normalisasi_data', $w)->row();
|
|
$tinggi_ = pow(($data->data_isi - $center_tinggi[$bj]), 2);
|
|
array_push($tinggi, $tinggi_);
|
|
$bj++;
|
|
}
|
|
array_push($res_tinggi, $tinggi);
|
|
$tinggi = array();
|
|
|
|
array_push($res2_rendah, sqrt(array_sum($res_rendah[$i])));
|
|
array_push($res2_sedang, sqrt(array_sum($res_sedang[$i])));
|
|
array_push($res2_tinggi, sqrt(array_sum($res_tinggi[$i])));
|
|
|
|
array_push(${'_' . $i}, sqrt(array_sum($res_rendah[$i])));
|
|
array_push(${'_' . $i}, sqrt(array_sum($res_sedang[$i])));
|
|
array_push(${'_' . $i}, sqrt(array_sum($res_tinggi[$i])));
|
|
|
|
$i++;
|
|
}
|
|
$no = 1;
|
|
$i = 0;
|
|
$clstr_rendah_ = array();
|
|
$clstr_sedang_ = array();
|
|
$clstr_tinggi_ = array();
|
|
foreach ($alternatif->result() as $a) {
|
|
$clstr = (array_search(min(${'_' . $i}), ${'_' . $i}) + 1);
|
|
|
|
switch ($clstr) {
|
|
case 1:
|
|
array_push($clstr_rendah_, $a->alternatif_id);
|
|
break;
|
|
case 2:
|
|
array_push($clstr_sedang_, $a->alternatif_id);
|
|
break;
|
|
case 3:
|
|
array_push($clstr_tinggi_, $a->alternatif_id);
|
|
break;
|
|
default:
|
|
array_push($clstr_rendah_, $a->alternatif_id);
|
|
break;
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
$clstr_rendah = array();
|
|
$clstr_sedang = array();
|
|
$clstr_tinggi = array();
|
|
foreach ($clstr_rendah_ as $v) {
|
|
$data = $this->db->query("SELECT data_isi FROM normalisasi_data WHERE data_alternatif = '$v'")->result_array();
|
|
array_push($clstr_rendah, $data);
|
|
}
|
|
foreach ($clstr_sedang_ as $v) {
|
|
$data = $this->db->query("SELECT data_isi FROM normalisasi_data WHERE data_alternatif = '$v'")->result_array();
|
|
array_push($clstr_sedang, $data);
|
|
}
|
|
foreach ($clstr_tinggi_ as $v) {
|
|
$data = $this->db->query("SELECT data_isi FROM normalisasi_data WHERE data_alternatif = '$v'")->result_array();
|
|
array_push($clstr_tinggi, $data);
|
|
}
|
|
|
|
$new_center_1 = array();
|
|
$new_center_2 = array();
|
|
$new_center_3 = array();
|
|
$jml_kriteria = count($kriteria->result_array());
|
|
|
|
$jml_kecil = count($clstr_rendah);
|
|
for ($i = 0; $i < $jml_kriteria; $i++) {
|
|
$new_ = array();
|
|
for ($j = 0; $j < $jml_kecil; $j++) {
|
|
$new = $clstr_rendah[$j][$i]['data_isi'];
|
|
array_push($new_, $new);
|
|
}
|
|
$means = (array_sum($new_) / $jml_kecil);
|
|
array_push($new_center_1, $means);
|
|
}
|
|
|
|
$jml_sedang = count($clstr_sedang);
|
|
for ($i = 0; $i < $jml_kriteria; $i++) {
|
|
$new_ = array();
|
|
for ($j = 0; $j < $jml_sedang; $j++) {
|
|
$new = $clstr_sedang[$j][$i]['data_isi'];
|
|
array_push($new_, $new);
|
|
}
|
|
$means = (array_sum($new_) / $jml_sedang);
|
|
array_push($new_center_2, $means);
|
|
}
|
|
|
|
$jml_besar = count($clstr_tinggi);
|
|
for ($i = 0; $i < $jml_kriteria; $i++) {
|
|
$new_ = array();
|
|
for ($j = 0; $j < $jml_besar; $j++) {
|
|
$new = $clstr_tinggi[$j][$i]['data_isi'];
|
|
array_push($new_, $new);
|
|
}
|
|
$means = (array_sum($new_) / $jml_besar);
|
|
array_push($new_center_3, $means);
|
|
}
|
|
if ($center_rendah == $new_center_1) {
|
|
if ($center_sedang == $new_center_2) {
|
|
if ($center_tinggi == $new_center_3) {
|
|
$selesai = true;
|
|
} else {
|
|
$iterasi++;
|
|
}
|
|
} else {
|
|
$iterasi++;
|
|
}
|
|
} else {
|
|
$iterasi++;
|
|
}
|
|
$center_rendah = $new_center_1;
|
|
$center_sedang = $new_center_2;
|
|
$center_tinggi = $new_center_3;
|
|
}
|
|
|
|
//========================================================
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['iterasi'] = $iterasi;
|
|
$data['tahun'] = $this->input->post('tahun');
|
|
$data['center_rendah_awal'] = $center_rendah_awal;
|
|
$data['center_sedang_awal'] = $center_sedang_awal;
|
|
$data['center_tinggi_awal'] = $center_tinggi_awal;
|
|
$data['kriteria'] = $kriteria;
|
|
$data['clstr_rendah_'] = $clstr_rendah_;
|
|
$data['clstr_sedang_'] = $clstr_sedang_;
|
|
$data['clstr_tinggi_'] = $clstr_tinggi_;
|
|
$this->mylib->view('dist/v_perhitungan_hasil', $data);
|
|
} else {
|
|
|
|
// Perhitungan berdasarkan ketentuan tahun
|
|
|
|
$this->db->truncate('centroid');
|
|
$alternatif = $this->m_vic->get_data('alternatif');
|
|
// $kriteria = $this->m_vic->get_data('kriteria');
|
|
if ($this->input->post('tahun') == 1) {
|
|
$arr = [0, 1, 2];
|
|
$kriteria = $this->db->query('SELECT * FROM kriteria WHERE kriteria_id = 1 OR kriteria_id = 2 OR kriteria_id = 3');
|
|
} elseif ($this->input->post('tahun') == 2) {
|
|
$arr = [3, 4, 5];
|
|
$kriteria = $this->db->query('SELECT * FROM kriteria WHERE kriteria_id = 5 OR kriteria_id = 6 OR kriteria_id = 7');
|
|
} elseif ($this->input->post('tahun') == 3) {
|
|
$arr = [6, 7, 8];
|
|
$kriteria = $this->db->query('SELECT * FROM kriteria WHERE kriteria_id = 9 OR kriteria_id = 10 OR kriteria_id = 11');
|
|
} elseif ($this->input->post('tahun') == 4) {
|
|
$arr = [9, 10, 11];
|
|
$kriteria = $this->db->query('SELECT * FROM kriteria WHERE kriteria_id = 13 OR kriteria_id = 14 OR kriteria_id = 15');
|
|
} elseif ($this->input->post('tahun') == 5) {
|
|
$arr = [12, 13, 14, 15];
|
|
$kriteria = $this->db->query('SELECT * FROM kriteria WHERE kriteria_id = 17 OR kriteria_id = 18 OR kriteria_id = 19');
|
|
}
|
|
if ($this->input->post('centroid_awal')) {
|
|
// $centreoid_terpilih = [31,32,44]; //2014
|
|
// $centreoid_terpilih = [27,28,66]; //2015
|
|
// $centreoid_terpilih = [38,39,40]; //2018
|
|
// $centreoid_terpilih = [36,38,40]; //2019
|
|
$centreoid_terpilih = explode(',', $this->input->post('centroid_awal'));
|
|
} else {
|
|
$centreoid_terpilih = array();
|
|
$alternatif_temp = array();
|
|
foreach ($alternatif->result() as $ad) {
|
|
$alternatif_temp[] = $ad->alternatif_id;
|
|
}
|
|
|
|
for ($z = 0; $z < 3; $z++) {
|
|
$rand_key = array_rand($alternatif_temp);
|
|
array_push($centreoid_terpilih, $alternatif_temp[$rand_key]);
|
|
unset($alternatif_temp[$rand_key]);
|
|
}
|
|
}
|
|
|
|
$center_rendah = array();
|
|
$center_sedang = array();
|
|
$center_tinggi = array();
|
|
$no = 0;
|
|
$kriteria2 = $kriteria->result_array();
|
|
$keri1 = $kriteria2[0]['kriteria_id'];
|
|
$keri2 = $kriteria2[1]['kriteria_id'];
|
|
$keri3 = $kriteria2[2]['kriteria_id'];
|
|
|
|
// $centreoid_terpilih = [31,32,44];
|
|
|
|
foreach ($centreoid_terpilih as $alt) {
|
|
$res_data1 = $this->db->query("SELECT data_kriteria,data_isi FROM normalisasi_data WHERE data_alternatif = $alt AND data_kriteria = '$keri1'")->row();
|
|
$res_data2 = $this->db->query("SELECT data_kriteria,data_isi FROM normalisasi_data WHERE data_alternatif = $alt AND data_kriteria = '$keri2'")->row();
|
|
$res_data3 = $this->db->query("SELECT data_kriteria,data_isi FROM normalisasi_data WHERE data_alternatif = $alt AND data_kriteria = '$keri3'")->row();
|
|
// $res_data = $this->db->query("SELECT data_kriteria,data_isi FROM data WHERE data_alternatif = $alt ORDER BY data_kriteria");
|
|
$nama = '';
|
|
switch ($no) {
|
|
case 0:
|
|
$nama = 'Rendah';
|
|
$center_rendah = [$res_data1->data_isi, $res_data2->data_isi, $res_data3->data_isi];
|
|
break;
|
|
case 1:
|
|
$nama = 'Sedang';
|
|
$center_sedang = [$res_data1->data_isi, $res_data2->data_isi, $res_data3->data_isi];
|
|
break;
|
|
case 2:
|
|
$nama = 'Tinggi';
|
|
$center_tinggi = [$res_data1->data_isi, $res_data2->data_isi, $res_data3->data_isi];
|
|
break;
|
|
default:
|
|
$nama = '';
|
|
break;
|
|
}
|
|
$data1 = array(
|
|
'centroid_alternatif' => $alt,
|
|
'centroid_kriteria' => $res_data1->data_kriteria,
|
|
'centroid_isi' => $res_data1->data_isi,
|
|
'centroid_nama' => $nama,
|
|
);
|
|
$this->m_vic->insert_data($data1, 'centroid');
|
|
$data2 = array(
|
|
'centroid_alternatif' => $alt,
|
|
'centroid_kriteria' => $res_data2->data_kriteria,
|
|
'centroid_isi' => $res_data2->data_isi,
|
|
'centroid_nama' => $nama,
|
|
);
|
|
$this->m_vic->insert_data($data2, 'centroid');
|
|
$data3 = array(
|
|
'centroid_alternatif' => $alt,
|
|
'centroid_kriteria' => $res_data3->data_kriteria,
|
|
'centroid_isi' => $res_data3->data_isi,
|
|
'centroid_nama' => $nama,
|
|
);
|
|
$this->m_vic->insert_data($data3, 'centroid');
|
|
|
|
$no++;
|
|
}
|
|
|
|
$center_rendah_awal = $center_rendah;
|
|
$center_sedang_awal = $center_sedang;
|
|
$center_tinggi_awal = $center_tinggi;
|
|
// echo "<pre>";
|
|
// print_r($center_rendah_awal);
|
|
// echo "</pre>";
|
|
// echo "<hr>";
|
|
// echo "<pre>";
|
|
// print_r($center_sedang_awal);
|
|
// echo "</pre>";
|
|
// echo "<hr>";
|
|
// echo "<pre>";
|
|
// print_r($center_tinggi_awal);
|
|
// echo "</pre>";
|
|
// echo "<hr>";
|
|
// die();
|
|
//========================================================
|
|
|
|
$selesai = false;
|
|
$iterasi = 1;
|
|
while ($selesai == false) {
|
|
$i = 0;
|
|
$rendah = array();
|
|
$res_rendah = array();
|
|
$res2_rendah = array();
|
|
$sedang = array();
|
|
$res_sedang = array();
|
|
$res2_sedang = array();
|
|
$tinggi = array();
|
|
$res_tinggi = array();
|
|
$res2_tinggi = array();
|
|
foreach ($alternatif->result() as $a) {
|
|
${'_' . $i} = array();
|
|
$kj = 0;
|
|
foreach ($kriteria->result() as $k) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->db->get_where('normalisasi_data', $w)->row();
|
|
$rendah_ = pow(($data->data_isi - $center_rendah[$kj]), 2);
|
|
array_push($rendah, $rendah_);
|
|
$kj++;
|
|
}
|
|
array_push($res_rendah, $rendah);
|
|
$rendah = array();
|
|
|
|
$sj = 0;
|
|
foreach ($kriteria->result() as $k) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->db->get_where('normalisasi_data', $w)->row();
|
|
$sedang_ = pow(($data->data_isi - $center_sedang[$sj]), 2);
|
|
array_push($sedang, $sedang_);
|
|
$sj++;
|
|
}
|
|
array_push($res_sedang, $sedang);
|
|
$sedang = array();
|
|
|
|
$bj = 0;
|
|
foreach ($kriteria->result() as $k) {
|
|
$w = array('data_alternatif' => $a->alternatif_id, 'data_kriteria' => $k->kriteria_id);
|
|
$data = $this->db->get_where('normalisasi_data', $w)->row();
|
|
$tinggi_ = pow(($data->data_isi - $center_tinggi[$bj]), 2);
|
|
array_push($tinggi, $tinggi_);
|
|
$bj++;
|
|
}
|
|
array_push($res_tinggi, $tinggi);
|
|
$tinggi = array();
|
|
|
|
array_push($res2_rendah, sqrt(array_sum($res_rendah[$i])));
|
|
array_push($res2_sedang, sqrt(array_sum($res_sedang[$i])));
|
|
array_push($res2_tinggi, sqrt(array_sum($res_tinggi[$i])));
|
|
|
|
array_push(${'_' . $i}, sqrt(array_sum($res_rendah[$i])));
|
|
array_push(${'_' . $i}, sqrt(array_sum($res_sedang[$i])));
|
|
array_push(${'_' . $i}, sqrt(array_sum($res_tinggi[$i])));
|
|
|
|
$i++;
|
|
}
|
|
$no = 1;
|
|
$i = 0;
|
|
$clstr_rendah_ = array();
|
|
$clstr_sedang_ = array();
|
|
$clstr_tinggi_ = array();
|
|
foreach ($alternatif->result() as $a) {
|
|
$clstr = (array_search(min(${'_' . $i}), ${'_' . $i}) + 1);
|
|
|
|
switch ($clstr) {
|
|
case 1:
|
|
array_push($clstr_rendah_, $a->alternatif_id);
|
|
break;
|
|
case 2:
|
|
array_push($clstr_sedang_, $a->alternatif_id);
|
|
break;
|
|
case 3:
|
|
array_push($clstr_tinggi_, $a->alternatif_id);
|
|
break;
|
|
default:
|
|
array_push($clstr_rendah_, $a->alternatif_id);
|
|
break;
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
$clstr_rendah = array();
|
|
$clstr_sedang = array();
|
|
$clstr_tinggi = array();
|
|
foreach ($clstr_rendah_ as $v) {
|
|
$data = $this->db->query("SELECT data_isi FROM normalisasi_data WHERE data_alternatif = '$v'")->result_array();
|
|
array_push($clstr_rendah, $data);
|
|
}
|
|
foreach ($clstr_sedang_ as $v) {
|
|
$data = $this->db->query("SELECT data_isi FROM normalisasi_data WHERE data_alternatif = '$v'")->result_array();
|
|
array_push($clstr_sedang, $data);
|
|
}
|
|
foreach ($clstr_tinggi_ as $v) {
|
|
$data = $this->db->query("SELECT data_isi FROM normalisasi_data WHERE data_alternatif = '$v'")->result_array();
|
|
array_push($clstr_tinggi, $data);
|
|
}
|
|
|
|
$new_center_1 = array();
|
|
$new_center_2 = array();
|
|
$new_center_3 = array();
|
|
$jml_kriteria = count($kriteria->result_array());
|
|
|
|
// echo "<pre>";
|
|
// print_r($clstr_rendah);
|
|
// echo "</pre>";
|
|
// die();
|
|
|
|
$jml_kecil = count($clstr_rendah);
|
|
for ($i = 0; $i < $jml_kriteria; $i++) {
|
|
$new_ = array();
|
|
for ($j = 0; $j < $jml_kecil; $j++) {
|
|
$new = $clstr_rendah[$j][$arr[$i]]['data_isi'];
|
|
array_push($new_, $new);
|
|
}
|
|
$means = round((array_sum($new_) / $jml_kecil), 4);
|
|
array_push($new_center_1, $means);
|
|
}
|
|
|
|
$jml_sedang = count($clstr_sedang);
|
|
for ($i = 0; $i < $jml_kriteria; $i++) {
|
|
$new_ = array();
|
|
for ($j = 0; $j < $jml_sedang; $j++) {
|
|
$new = $clstr_sedang[$j][$arr[$i]]['data_isi'];
|
|
array_push($new_, $new);
|
|
}
|
|
$means = round((array_sum($new_) / $jml_sedang), 4);
|
|
array_push($new_center_2, $means);
|
|
}
|
|
|
|
$jml_besar = count($clstr_tinggi);
|
|
for ($i = 0; $i < $jml_kriteria; $i++) {
|
|
$new_ = array();
|
|
for ($j = 0; $j < $jml_besar; $j++) {
|
|
$new = $clstr_tinggi[$j][$arr[$i]]['data_isi'];
|
|
array_push($new_, $new);
|
|
}
|
|
$means = round((array_sum($new_) / $jml_besar), 4);
|
|
array_push($new_center_3, $means);
|
|
}
|
|
// if ($iterasi == 2) {
|
|
// $selesai = TRUE;
|
|
// }
|
|
|
|
if ($center_rendah == $new_center_1) {
|
|
if ($center_sedang == $new_center_2) {
|
|
if ($center_tinggi == $new_center_3) {
|
|
$selesai = true;
|
|
} else {
|
|
$iterasi++;
|
|
}
|
|
} else {
|
|
$iterasi++;
|
|
}
|
|
} else {
|
|
$iterasi++;
|
|
}
|
|
$center_rendah = $new_center_1;
|
|
$center_sedang = $new_center_2;
|
|
$center_tinggi = $new_center_3;
|
|
// echo "ITERASI ".$iterasi;
|
|
// echo "<pre>";
|
|
// print_r($new_center_1);
|
|
// echo "</pre>";
|
|
// echo "<pre>";
|
|
// print_r($new_center_2);
|
|
// echo "</pre>";
|
|
// echo "<pre>";
|
|
// print_r($new_center_3);
|
|
// echo "</pre>";
|
|
// echo "<br>=================================================<br>";
|
|
}
|
|
|
|
// die();
|
|
|
|
// echo "<pre>";
|
|
// print_r($new_center_1);
|
|
// echo "</pre>";
|
|
// echo "<hr>";
|
|
// echo "<pre>";
|
|
// print_r($new_center_2);
|
|
// echo "</pre>";
|
|
// echo "<hr>";
|
|
// echo "<pre>";
|
|
// print_r($new_center_3);
|
|
// echo "</pre>";
|
|
// echo "<hr>";
|
|
// die();
|
|
//========================================================
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Perhitungan";
|
|
$data['iterasi'] = $iterasi;
|
|
$data['tahun'] = $this->input->post('tahun');
|
|
$data['center_rendah_awal'] = $center_rendah_awal;
|
|
$data['center_sedang_awal'] = $center_sedang_awal;
|
|
$data['center_tinggi_awal'] = $center_tinggi_awal;
|
|
$data['kriteria'] = $kriteria;
|
|
$data['clstr_rendah_'] = $clstr_rendah_;
|
|
$data['clstr_sedang_'] = $clstr_sedang_;
|
|
$data['clstr_tinggi_'] = $clstr_tinggi_;
|
|
$this->mylib->view('dist/v_perhitungan_hasil', $data);
|
|
}
|
|
|
|
}
|
|
|
|
public function b3()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Import";
|
|
$this->load->view('dist/b3', $data);
|
|
}
|
|
public function b4()
|
|
{
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Clustering";
|
|
$this->load->view('dist/b4', $data);
|
|
}
|
|
public function profile()
|
|
{
|
|
|
|
$data['user'] = $this->m_vic->get_data('admin');
|
|
$data['title'] = "Profile";
|
|
$this->mylib->view('dist/features-profile', $data);
|
|
}
|
|
|
|
public function update_user($id)
|
|
{
|
|
$w = array(
|
|
'admin_id' => $id,
|
|
);
|
|
|
|
$data = array(
|
|
'admin_nama' => $this->input->post('nama'),
|
|
'jurusan' => $this->input->post('jurusan'),
|
|
'nim' => $this->input->post('nim'),
|
|
'admin_username' => $this->input->post('admin_username'),
|
|
'admin_password' => md5($this->input->post('admin_password')),
|
|
'trust' => $this->input->post('admin_password'),
|
|
'alamat' => $this->input->post('alamat'),
|
|
'bio' => $this->input->post('bio'),
|
|
|
|
);
|
|
$this->m_vic->update_data($w, $data, 'admin');
|
|
$this->session->set_flashdata('suces', 'Data berhasil di update!');
|
|
redirect('dist/profile?notif=suces');
|
|
|
|
}
|
|
|
|
}
|