copy dari repo om Irfan

This commit is contained in:
2026-06-13 16:02:07 +10:00
commit db327c0305
5376 changed files with 2770667 additions and 0 deletions
@@ -0,0 +1,89 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageOperator extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelOperator', 'MO');
$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()
{
$datOperator = $this->MO->getDataOperator();
$data = [
'sidebar' => "data master service",
'navChild' => "data master operator",
'operator' => $datOperator
];
$this->load->view('master/Operator', $data);
}
public function save()
{
$method = $this->input->post('method');
$id_operator = $this->input->post('id');
$id_teknisi = $this->input->post('id');
$nama = $this->input->post('nama');
$this->form_validation->set_rules('nama', 'Nama', 'required');
if ($this->form_validation->run() == FALSE) {
$data = [
'status' => false,
'errors' => [
'nama' => form_error('nama')
]
];
$this->output_json($data);
} else {
$input = [
'NAMA_OPERATOR' => $nama
];
$inputteknisi = [
'NAMA_TEKNISI' => $nama
];
if ($method === 'add') {
$action = $this->MO->create('operator', $input);
$actionteknisi = $this->MO->create('teknisi', $inputteknisi);
} else if ($method === 'edit') {
$action = $this->MO->update('operator', $input, 'ID_OPERATOR', $id_operator);
$actionteknisi = $this->MO->update('teknisi', $inputteknisi, 'ID_TEKNISI', $id_teknisi);
}
if ($action) {
$this->session->set_flashdata('flash', 'ditambah');
redirect('ManageOperator');
} else {
$this->session->set_flashdata('flashgagal', 'ditambah');
redirect('ManageOperator');
}
}
}
public function hapus()
{
$id = $this->input->post('id');
if ($this->MO->delete('operator', $id, 'ID_OPERATOR')) {
$action = $this ->MO->delete('teknisi',$id,'ID_TEKNISI');
$this->session->set_flashdata('flash', 'dihapus');
redirect('ManageOperator');
}
}
}