| 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 : /simbada/application/modules/konfigurasi_penyusutan/models/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Konfigurasi_penyusutan_model extends Base_Model {
var $config_file;
var $tahun;
var $status;
var $lokasi;
var $ppkd;
var $mode;
function __construct()
{
parent::__construct();
$this->config_file = APPPATH.'config/appconfig.php';
}
function fill_data()
{
$this->periode = $this->input->post('konf_periode') ? $this->input->post('konf_periode') : 1;
$this->kelompok = $this->input->post('konf_kelompok') ? $this->input->post('konf_kelompok') : 1;
$this->tipe = $this->input->post('konf_tipe') ? $this->input->post('konf_tipe') : 1;
}
function get_setting()
{
return array(
'periode' => $this->app_config['periode_penyusutan'],
'kelompok' => $this->app_config['kelompok_penyusutan'],
'konfigurasi' => $this->app_config['konfigurasi_penyusutan']
);
}
function save_config()
{
$config_file = @file_get_contents($this->config_file);
$config = array(
'periode_penyusutan' => $this->periode,
'kelompok_penyusutan' => $this->kelompok,
'konfigurasi_penyusutan' => $this->tipe
);
foreach($config as $key => $val)
{
$val = '\''.$val.'\'';
$pattern = '%(config\[\''.$key.'\'\] = )(\'?.*\'?)(;)%';
$config_file = preg_replace($pattern, '${1}'.$val. '${3}', $config_file );
}
$ret = @file_put_contents($this->config_file, $config_file);
if ( !$ret)
{
return FALSE;
}
return TRUE;
}
}