| 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 : /wamp/www/sipapbd_2017_sekolah/application/modules/pengumuman/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Pengumuman extends Admin_Controller {
public function __construct()
{
parent::__construct();
$this->modul_display = 'Pengumuman';
$this->load->model('pengumuman_model', 'data_model');
}
public function index()
{
$data['breadcrumbs'] = 'Pengumuman';
$data['modul'] = $this->modul_display;
$data['data'] = $this->data_model->get_setting();
$data['main_content'] = 'pengumuman_view';
$this->load->view('layout/template_admin', $data);
}
protected function validasi_form()
{
$this->form_validation->set_rules('pengumuman_aktif', 'Mode Pengumuman', 'trim|integer');
$this->form_validation->set_message('integer', '%s tidak valid.');
}
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);
}
}