87 lines
1.8 KiB
PHP
87 lines
1.8 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ManageSsd extends CI_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('ModelSsd', 'MS');
|
|
$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()
|
|
{
|
|
|
|
$datSsd = $this->MS->getDataSsd();
|
|
|
|
$data = [
|
|
'sidebar' => "master data",
|
|
'navChild' => "",
|
|
'ssd' => $datSsd
|
|
];
|
|
|
|
$this->load->view('master/Ssd', $data);
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_ssd = $this->input->post('id');
|
|
$nama_ssd = $this->input->post('nama_ssd');
|
|
|
|
$input = [
|
|
'NAMA_SSD' => $nama_ssd
|
|
];
|
|
|
|
$action = $this->MS->create('ssd', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('flash', 'ditambah');
|
|
redirect('ManageSsd');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'ditambah');
|
|
redirect('ManageSsd');
|
|
}
|
|
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_ssd = $this->input->post('id_ssd');
|
|
$nama_ssd = $this->input->post('nama_ssded');
|
|
|
|
$update = [
|
|
'NAMA_SSD' => $nama_ssd
|
|
];
|
|
|
|
$action = $this->MS->update('ssd', $update,'ID_SSD',$id_ssd);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('flash', 'diedit');
|
|
redirect('ManageSsd');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'diedit');
|
|
redirect('ManageSsd');
|
|
}
|
|
|
|
}
|
|
|
|
public function hapus()
|
|
{
|
|
$id = $this->input->post('id');
|
|
if ($this->MS->delete('ssd', $id, 'ID_SSD')) {
|
|
$action = $this ->MS->delete('ssd',$id,'ID_SSD');
|
|
$this->session->set_flashdata('flash', 'dihapus');
|
|
redirect('ManageSsd');
|
|
}
|
|
}
|
|
|
|
}
|