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,132 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageUnitProyek extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
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() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datUnitProyek = $this->Dashboard->getData_UnitProyek();
$no = 0;
foreach ($datUnitProyek as $key) {
$datDak = $this->Dashboard->getData_DaftarAkuntansi_byUNITPROYEK($key['ID_UNITPROYEK']);
if ($datDak==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datUnitProyek[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['UNITPROYEK_SHM']==0) {
$akses = "Tidak Berhak";
$datUnitProyek = NULL;
} else if ($datShm[0]['UNITPROYEK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['UNITPROYEK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'hak' => $datShm[0]['UNITPROYEK_SHM'],
'akses' => $akses,
'unitproyek' => $datUnitProyek,
];
$this->load->view('master/UnitProyek', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_unitproyek = $this->input->post('id');
$nama_unitproyek = $this->input->post('nama_unitproyek');
$nama_unitproyek = strtoupper($nama_unitproyek);
$datUnitProyek = $this->Dashboard->getData_UnitProyek_byNAMA($nama_unitproyek);
if ($datUnitProyek==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageUnitProyek');
}
$input = [
'NAMA_UNITPROYEK' => $nama_unitproyek,
];
$action = $this->Dashboard->create('unitproyek', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageUnitProyek');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageUnitProyek');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_unitproyek = $this->input->post('id_unitproyeked');
$nama_unitproyek = $this->input->post('nama_unitproyeked');
$nama_unitproyek = strtoupper($nama_unitproyek);
$datUnitProyek = $this->Dashboard->getData_UnitProyek_byNAMA($nama_unitproyek, $id_unitproyek);
if ($datUnitProyek==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageUnitProyek');
}
$update = [
'NAMA_UNITPROYEK' => $nama_unitproyek,
];
$action = $this->Dashboard->update('unitproyek', $update, 'ID_UNITPROYEK', $id_unitproyek);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageUnitProyek');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageUnitProyek');
}
}
public function hapus() {
$id_unitproyek = $this->input->post('id_unitproyekdel');
$datUnitProyek = $this->Dashboard->getData_DaftarAkuntansi_byUNITPROYEK($id_unitproyek);
if ($datUnitProyek==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageUnitProyek');
}
$action = $this ->Dashboard->delete('unitproyek', $id_unitproyek, 'ID_UNITPROYEK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageUnitProyek');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageUnitProyek');
}
}
}