95 lines
2.8 KiB
PHP
95 lines
2.8 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class IMT extends CI_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model("ModelIMT");
|
|
}
|
|
|
|
function index()
|
|
{
|
|
$imt = $this->ModelIMT->get_data();
|
|
$data = array(
|
|
'body' => 'IMT/list',
|
|
'imt' => $imt
|
|
);
|
|
$this->load->view("index", $data);
|
|
}
|
|
|
|
public function input()
|
|
{
|
|
$imt = $this->ModelIMT->get_data();
|
|
$data = array(
|
|
'body' => 'IMT/input',
|
|
'form' => 'IMT/form',
|
|
'imt' => $imt,
|
|
);
|
|
$this->load->view('index', $data);
|
|
}
|
|
|
|
public function insert()
|
|
{
|
|
$data = array(
|
|
'klasifikasi' => $this->input->post('klasifikasi'),
|
|
'nilai_awal' => $this->input->post('nilai_awal'),
|
|
'nilai_akhir' => $this->input->post('nilai_akhir'),
|
|
);
|
|
if ($this->db->insert("imt", $data)) {
|
|
// $this->session->set_flashdata("notif", $this->Notif->berhasil("Berhasil Input Data"));
|
|
redirect(base_url() . "IMT");
|
|
} else {
|
|
$this->session->set_flashdata("notif", $this->Notif->gagal("gagal Input Data"));
|
|
redirect(base_url() . "IMT");
|
|
}
|
|
}
|
|
|
|
function edit()
|
|
{
|
|
$id = $this->uri->segment(3);
|
|
$imt = $this->ModelIMT->get_data_edit($id);
|
|
$data = array(
|
|
'form' => 'IMT/form_edit',
|
|
'body' => 'IMT/edit',
|
|
'imt' => $imt,
|
|
);
|
|
$this->load->view('index', $data);
|
|
}
|
|
|
|
function update()
|
|
{
|
|
$id = $this->uri->segment(3);
|
|
$data = array(
|
|
'klasifikasi' => $this->input->post('klasifikasi'),
|
|
'nilai_awal' => $this->input->post('nilai_awal'),
|
|
'nilai_akhir' => $this->input->post('nilai_akhir'),
|
|
);
|
|
$this->db->where("id_imt", $id);
|
|
if ($this->db->update("imt", $data)) {
|
|
// code...
|
|
// $this->session->set_flashdata("notif", $this->Notif->berhasil("Berhasil Input Data"));
|
|
redirect(base_url() . "IMT");
|
|
} else {
|
|
$this->session->set_flashdata("notif", $this->Notif->gagal("gagal Input Data"));
|
|
redirect(base_url() . "IMT");
|
|
}
|
|
}
|
|
|
|
function delete()
|
|
{
|
|
$id = $this->input->post("id_imt");
|
|
$this->db->where_in("id_imt", $id);
|
|
if ($this->db->delete("imt")) {
|
|
// $this->session->set_flashdata("notif", $this->Notif->berhasil("Berhasil Input Data"));
|
|
redirect(base_url() . "IMT");
|
|
// code...
|
|
} else {
|
|
$this->session->set_flashdata("notif", $this->Notif->gagal("gagal Input Data"));
|
|
redirect(base_url() . "IMT");
|
|
}
|
|
}
|
|
}
|