copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageVga extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelVga', 'MV');
|
||||
$this->load->library(['datatables', 'form_validation']);
|
||||
$this->form_validation->set_error_delimiters('', '');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
|
||||
$datVga = $this->MV->getDataVga();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'vga' => $datVga
|
||||
];
|
||||
|
||||
$this->load->view('master/Vga', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_vga = $this->input->post('id');
|
||||
$nama_vga = $this->input->post('nama_vga');
|
||||
$type_vga = $this->input->post('type_vga');
|
||||
|
||||
$input = [
|
||||
'NAMA_VGA' => $nama_vga,
|
||||
'TYPE_VGA' => $type_vga
|
||||
];
|
||||
|
||||
$action = $this->MV->create('vga', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageVga');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageVga');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_vga = $this->input->post('id_vga');
|
||||
$nama_vga = $this->input->post('nama_vgaed');
|
||||
$type_vga = $this->input->post('type_vgaed');
|
||||
|
||||
$update = [
|
||||
'NAMA_VGA' => $nama_vga,
|
||||
'TYPE_VGA' => $type_vga
|
||||
];
|
||||
|
||||
$action = $this->MV->update('vga', $update,'ID_VGA',$id_vga);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageVga');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageVga');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MV->delete('vga', $id, 'ID_VGA')) {
|
||||
$action = $this ->MV->delete('vga',$id,'ID_VGA');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageVga');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user