91 lines
2.9 KiB
PHP
91 lines
2.9 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class DataKriteria extends CI_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model("ModelDataKriteria");
|
|
}
|
|
|
|
function index()
|
|
{
|
|
$datakriteria = $this->ModelDataKriteria->get_data();
|
|
$data = array(
|
|
'body' => 'DataKriteria/list',
|
|
'datakriteria' => $datakriteria
|
|
);
|
|
$this->load->view('index', $data);
|
|
}
|
|
public function input()
|
|
{
|
|
$datakriteria = $this->ModelDataKriteria->get_data();
|
|
$data = array(
|
|
'body' => 'DataKriteria/input',
|
|
'form' => 'DataKriteria/form',
|
|
'datakriteria' => $datakriteria,
|
|
);
|
|
$this->load->view('index', $data);
|
|
}
|
|
public function insert()
|
|
{
|
|
$data = array(
|
|
'kode_kriteria' => $this->input->post('kode_kriteria'),
|
|
'nama_kriteria' => $this->input->post('nama_kriteria'),
|
|
'nilai_kriteria' => $this->input->post('nilai_kriteria'),
|
|
);
|
|
if ($this->db->insert("data_kriteria", $data)) {
|
|
// $this->session->set_flashdata("notif", $this->Notif->berhasil("Berhasil Input Data"));
|
|
redirect(base_url() . "DataKriteria/input");
|
|
} else {
|
|
$this->session->set_flashdata("notif", $this->Notif->gagal("gagal Input Data"));
|
|
redirect(base_url() . "DataKriteria/input");
|
|
}
|
|
// echo json_encode($data);
|
|
}
|
|
|
|
function edit(){
|
|
$id = $this->uri->segment(3);
|
|
$datakriteria = $this->ModelDataKriteria->get_data_edit($id);
|
|
$data = array(
|
|
'body' => 'DataKriteria/edit',
|
|
'form' => 'DataKriteria/form',
|
|
'datakriteria' => $datakriteria,
|
|
);
|
|
$this->load->view('index', $data);
|
|
}
|
|
function update()
|
|
{
|
|
$id = $this->uri->segment(3);
|
|
$data = array(
|
|
'kode_kriteria' => $this->input->post('kode_kriteria'),
|
|
'nama_kriteria' => $this->input->post('nama_kriteria'),
|
|
'nilai_kriteria' => $this->input->post('nilai_kriteria'),
|
|
);
|
|
$this->db->where("id_kriteria", $id);
|
|
if ($this->db->update("data_kriteria", $data)) {
|
|
// code...
|
|
// $this->session->set_flashdata("notif", $this->Notif->berhasil("Berhasil Input Data"));
|
|
redirect(base_url() . "DataKriteria");
|
|
} else {
|
|
$this->session->set_flashdata("notif", $this->Notif->gagal("gagal Input Data"));
|
|
redirect(base_url() . "DataKriteria");
|
|
}
|
|
}
|
|
|
|
function delete()
|
|
{
|
|
$id = $this->input->post("id_kriteria");
|
|
$this->db->where_in("id_kriteria", $id);
|
|
if ($this->db->delete("data_kriteria")) {
|
|
// $this->session->set_flashdata("notif", $this->Notif->berhasil("Berhasil Input Data"));
|
|
redirect(base_url() . "DataKrteria");
|
|
// code...
|
|
} else {
|
|
$this->session->set_flashdata("notif", $this->Notif->gagal("gagal Input Data"));
|
|
redirect(base_url() . "DataKrteria");
|
|
}
|
|
}
|
|
} |