| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/ADMINISTRATOR/simbada_2017/simbada_2017/application/modules/setting/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Setting extends Admin_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('setting_model', 'data_model');
}
public function index()
{
$data['conf'] = $this->data_model->get_setting();
$data['main_content'] = 'pengaturan_umum';
$this->load->view('layout/template_admin', $data);
}
protected function validasi_form()
{
$this->form_validation->set_rules('tahun', 'Tahun Anggaran', 'required|trim|integer|');
$this->form_validation->set_rules('status', 'Status Anggaran', 'required|trim|max_length[20]');
$this->form_validation->set_rules('ppkd', 'SKPD sebagai PPKD', 'required|trim|integer|');
$this->form_validation->set_rules('exp_pass', 'Masa Berlaku Password', 'required|max_length[3]');
$this->form_validation->set_message('required', '%s belum dipilih.');
$this->form_validation->set_message('max_length', '%s tidak boleh melebihi %s karakter.');
}
public function proses()
{
$response = (object) NULL;
$this->load->library('form_validation');
$this->validasi_form();
if($this->form_validation->run() == TRUE)
{
$this->data_model->fill_data();
$success = $this->data_model->save_setting();
if($success){
$response->isSuccess = TRUE;
$response->message = 'Data berhasil disimpan';
$response->sql = $this->db->queries;
}
else
{
$response->isSuccess = FALSE;
$response->message = 'Data gagal disimpan';
$response->error = $this->data_model->last_error_message;
$response->sql = $this->db->queries;
}
}
else
{
$response->isSuccess = FALSE;
$response->message = validation_errors();
}
echo json_encode($response);
}
}