Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunakan config_model untuk pemanggilan config, cont. #264 #265

Merged
merged 12 commits into from
Nov 19, 2022
8 changes: 4 additions & 4 deletions donjo-app/controllers/Area.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public function __construct()
{
parent::__construct();

$this->load->model('user_model');

$this->load->model('config_model');
$this->load->model('header_model');
$this->load->model('plan_area_model');
$this->load->model('user_model');

$this->load->database();
}
Expand Down Expand Up @@ -75,7 +75,7 @@ public function form($p = 1, $o = 0, $id = '')
$data['p'] = $p;
$data['o'] = $o;

$data['desa'] = $this->plan_area_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['list_polygon'] = $this->plan_area_model->list_polygon();
$data['dusun'] = $this->plan_area_model->list_dusun();

Expand Down Expand Up @@ -106,7 +106,7 @@ public function ajax_area_maps($p = 1, $o = 0, $id = '')
$data['area'] = null;
}

$data['desa'] = $this->plan_area_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['form_action'] = site_url("area/update_maps/{$p}/{$o}/{$id}");
view('area/maps', $data);
}
Expand Down
6 changes: 3 additions & 3 deletions donjo-app/controllers/Garis.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function __construct()
parent::__construct();

$this->load->model('user_model');

$this->load->model('config_model');
$this->load->model('header_model');
$this->load->model('plan_garis_model');

Expand Down Expand Up @@ -72,7 +72,7 @@ public function index($p = 1, $o = 0)

public function form($p = 1, $o = 0, $id = '')
{
$data['desa'] = $this->plan_garis_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['list_line'] = $this->plan_garis_model->list_line();
$data['dusun'] = $this->plan_garis_model->list_dusun();

Expand Down Expand Up @@ -103,7 +103,7 @@ public function ajax_garis_maps($p = 1, $o = 0, $id = '')
$data['garis'] = null;
}

$data['desa'] = $this->plan_garis_model->get_desa();
$data['desa'] = $this->config->get_data();
$data['form_action'] = site_url("garis/update_maps/{$p}/{$o}/{$id}");
view('garis/maps', $data);
}
Expand Down
10 changes: 5 additions & 5 deletions donjo-app/controllers/Gis.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public function __construct()
{
parent::__construct();

$this->load->model('user_model');

$this->load->model('config_model');
$this->load->model('header_model');
$this->load->model('penduduk_model');
$this->load->model('plan_lokasi_model');
$this->load->model('plan_area_model');
$this->load->model('plan_garis_model');
$this->load->model('header_model');
$this->load->model('plan_lokasi_model');
$this->load->model('user_model');

$grup = $this->user_model->sesi_grup($_SESSION['sesi']);
if ($grup !== '1') {
Expand Down Expand Up @@ -121,7 +121,7 @@ public function index()
$data['wilayah'] = $this->penduduk_model->list_wil();
$data['list_agama'] = $this->penduduk_model->list_agama();
$data['list_pendidikan'] = $this->penduduk_model->list_pendidikan();
$data['desa'] = $this->penduduk_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['lokasi'] = $this->plan_lokasi_model->list_data();
$data['garis'] = $this->plan_garis_model->list_data();
$data['area'] = $this->plan_area_model->list_data();
Expand Down
9 changes: 5 additions & 4 deletions donjo-app/controllers/Keluarga.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public function __construct()
{
parent::__construct();

$this->load->model('user_model');
$this->load->model('config_model');
$this->load->model('keluarga_model');
$this->load->model('penduduk_model');
$this->load->model('user_model');
$grup = $this->user_model->sesi_grup($_SESSION['sesi']);
if ($grup !== '1' && $grup !== '2') {
redirect('siteman');
Expand Down Expand Up @@ -744,7 +745,7 @@ public function kartu_keluarga($p = 1, $o = 0, $id = 0)
$data['hubungan'] = $this->keluarga_model->list_hubungan();
$data['main'] = $this->keluarga_model->list_anggota($id);
$kk = $this->keluarga_model->get_kepala_kk($id);
$data['desa'] = $this->keluarga_model->get_desa();
$data['desa'] = $this->config_model->get_data();

if ($kk) {
$data['kepala_kk'] = $kk;
Expand All @@ -768,7 +769,7 @@ public function cetak_kk($id = 0)
$data['id_kk'] = $id;
$data['main'] = $this->keluarga_model->list_anggota($id);
$kk = $this->keluarga_model->get_kepala_kk($id);
$data['desa'] = $this->keluarga_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['kepala_kk'] = $kk;
$nav['act'] = 1;
$header = $this->header_model->get_data();
Expand All @@ -777,7 +778,7 @@ public function cetak_kk($id = 0)

public function doc_kk($id = 0)
{
$data['desa'] = $this->keluarga_model->get_desa();
$data['desa'] = $this->config_model->get_data();

$data['id_kk'] = $id;
$data['main'] = $this->keluarga_model->list_anggota($id);
Expand Down
7 changes: 4 additions & 3 deletions donjo-app/controllers/Laporan.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function __construct()
if ($grup !== '1' && $grup !== '2' && $grup !== '3') {
redirect('siteman');
}
$this->load->model('config_model');
$this->load->model('header_model');

$_SESSION['success'] = 0;
Expand Down Expand Up @@ -56,7 +57,7 @@ public function index($lap = 0, $p = 1, $o = 0)

$data['bulan'] = $data['bulanku'];
$data['tahun'] = $data['tahunku'];
$data['config'] = $this->laporan_bulanan_model->configku();
$data['config'] = $this->config_model->get_data(true);
$data['penduduk_awal'] = $this->laporan_bulanan_model->penduduk_awal();
$data['penduduk_akhir'] = $this->laporan_bulanan_model->penduduk_akhir();
$data['kelahiran'] = $this->laporan_bulanan_model->kelahiran();
Expand All @@ -75,7 +76,7 @@ public function index($lap = 0, $p = 1, $o = 0)

public function cetak($lap = 0)
{
$data['config'] = $this->laporan_bulanan_model->configku();
$data['config'] = $this->config_model->get_data(true);
$data['bulan'] = $_SESSION['bulanku'];
$data['tahun'] = $_SESSION['tahunku'];
$data['bln'] = $this->laporan_bulanan_model->bulan($data['bulan']);
Expand All @@ -92,7 +93,7 @@ public function cetak($lap = 0)

public function excel($lap = 0)
{
$data['config'] = $this->laporan_bulanan_model->configku();
$data['config'] = $this->config_model->get_data(true);
$data['bulan'] = $_SESSION['bulanku'];
$data['tahun'] = $_SESSION['tahunku'];
$data['bln'] = $this->laporan_bulanan_model->bulan($data['bulan']);
Expand Down
7 changes: 4 additions & 3 deletions donjo-app/controllers/Laporan_rentan.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function __construct()
if ($grup !== '1' && $grup !== '2' && $grup !== '3') {
redirect('siteman');
}
$this->load->model('config_model');
$this->load->model('header_model');

$_SESSION['success'] = 0;
Expand All @@ -40,7 +41,7 @@ public function index()
}

$data['list_dusun'] = $this->laporan_bulanan_model->list_dusun();
$data['config'] = $this->laporan_bulanan_model->configku();
$data['config'] = $this->config_model->get_data(true);

$data['main'] = $this->laporan_bulanan_model->list_data();

Expand All @@ -54,14 +55,14 @@ public function index()

public function cetak()
{
$data['config'] = $this->laporan_bulanan_model->configku();
$data['config'] = $this->config_model->get_data(true);
$data['main'] = $this->laporan_bulanan_model->list_data();
view('laporan/kelompok_print', $data);
}

public function excel()
{
$data['config'] = $this->laporan_bulanan_model->configku();
$data['config'] = $this->config_model->get_data(true);
$data['main'] = $this->laporan_bulanan_model->list_data();
view('laporan/kelompok_excel', $data);
}
Expand Down
9 changes: 7 additions & 2 deletions donjo-app/controllers/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ public function init($out = null)
public function auth()
{
$this->user_model->login();
$header = $this->header_model->get_config();
$header = [
'desa' => $this->config_model->get_data(),
];
view('siteman', $header);
}

public function logout()
{
$this->config_model->opt();
$this->user_model->logout();
$header = $this->header_model->get_config();
$header = [
'desa' => $this->config_model->get_data(),
];

view('siteman', $header);
}
}
5 changes: 3 additions & 2 deletions donjo-app/controllers/Penduduk.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public function __construct()
redirect('siteman');
}

$this->load->model('penduduk_model');
$this->load->model('config_model');
$this->load->model('header_model');
$this->load->model('penduduk_model');
}

public function clear()
Expand Down Expand Up @@ -603,7 +604,7 @@ public function ajax_penduduk_maps($p = 1, $o = 0, $id = '')
$data['o'] = $o;

$data['penduduk'] = $this->penduduk_model->get_penduduk_map($id);
$data['desa'] = $this->penduduk_model->get_desa();
$data['desa'] = $this->config_model->get_data();

$data['form_action'] = site_url("penduduk/update_maps/{$p}/{$o}/{$id}");

Expand Down
8 changes: 4 additions & 4 deletions donjo-app/controllers/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public function __construct()
{
parent::__construct();

$this->load->model('user_model');

$this->load->model('config_model');
$this->load->model('header_model');
$this->load->model('plan_lokasi_model');
$this->load->model('user_model');
$grup = $this->user_model->sesi_grup($_SESSION['sesi']);
if ($grup !== '1') {
redirect('siteman');
Expand Down Expand Up @@ -82,7 +82,7 @@ public function form($p = 1, $o = 0, $id = '')
$data['p'] = $p;
$data['o'] = $o;

$data['desa'] = $this->plan_lokasi_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['list_point'] = $this->plan_lokasi_model->list_point();
$data['dusun'] = $this->plan_lokasi_model->list_dusun();

Expand Down Expand Up @@ -113,7 +113,7 @@ public function ajax_lokasi_maps($p = 1, $o = 0, $id = '')
$data['lokasi'] = null;
}

$data['desa'] = $this->plan_lokasi_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['form_action'] = site_url("plan/update_maps/{$p}/{$o}/{$id}");
view('lokasi/maps', $data);
}
Expand Down
5 changes: 3 additions & 2 deletions donjo-app/controllers/Rtm.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct()
redirect('siteman');
}
$this->load->model('header_model');
$this->load->model('config_model');
}

public function clear()
Expand Down Expand Up @@ -344,7 +345,7 @@ public function kartu_rtm($p = 1, $o = 0, $id = 0)
$data['hubungan'] = $this->rtm_model->list_hubungan();
$data['main'] = $this->rtm_model->list_anggota($id);
$kk = $this->rtm_model->get_kepala_kk($id);
$data['desa'] = $this->rtm_model->get_desa();
$data['desa'] = $this->config_model->get_data();

if ($kk) {
$data['kepala_kk'] = $kk;
Expand All @@ -368,7 +369,7 @@ public function cetak_kk($id = 0)
$data['id_kk'] = $id;
$data['main'] = $this->rtm_model->list_anggota($id);
$kk = $this->rtm_model->get_kepala_kk($id);
$data['desa'] = $this->rtm_model->get_desa();
$data['desa'] = $this->config_model->get_data();
$data['kepala_kk'] = $kk;
$nav['act'] = 3;
$header = $this->header_model->get_data();
Expand Down
4 changes: 3 additions & 1 deletion donjo-app/controllers/Siteman.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public function __construct()
public function index()
{
$this->user_model->logout();
$header = $this->header_model->get_config();
$header = [
'desa' => $this->config_model->get_data(),
];

if (! isset($_SESSION['siteman'])) {
$_SESSION['siteman'] = 0;
Expand Down
9 changes: 5 additions & 4 deletions donjo-app/controllers/Statistik.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ public function __construct()
$_SESSION['status_dasar'] = 1;
unset($_SESSION['cari'], $_SESSION['duplikat'], $_SESSION['sex'], $_SESSION['warganegara'], $_SESSION['cacat'], $_SESSION['menahun'], $_SESSION['cacatx'], $_SESSION['menahunx'], $_SESSION['golongan_darah'], $_SESSION['dusun'], $_SESSION['rw'], $_SESSION['rt'], $_SESSION['hubungan'], $_SESSION['agama'], $_SESSION['umur_min'], $_SESSION['umur_max'], $_SESSION['pekerjaan_id'], $_SESSION['status'], $_SESSION['pendidikan_id'], $_SESSION['pendidikan_sedang_id'], $_SESSION['pendidikan_kk_id'], $_SESSION['umurx'], $_SESSION['status_penduduk'], $_SESSION['judul_statistik'], $_SESSION['hamil']);

$this->load->model('user_model');
$this->load->model('config_model');
$this->load->model('laporan_penduduk_model');
$this->load->model('user_model');
$grup = $this->user_model->sesi_grup($_SESSION['sesi']);
if ($grup !== '1' && $grup !== '2' && $grup !== '3') {
redirect('siteman');
Expand Down Expand Up @@ -261,7 +262,7 @@ public function cetak($lap = 0)
default:$data['stat'] = 'Pendidikan';
}

$data['config'] = $this->laporan_penduduk_model->get_config();
$data['config'] = $this->config_model->get_data();
$data['main'] = $this->laporan_penduduk_model->list_data($lap);
view('statistik/penduduk_print', $data);
}
Expand Down Expand Up @@ -316,7 +317,7 @@ public function excel($lap = 0)
default:$data['stat'] = 'Pendidikan';
}

$data['config'] = $this->laporan_penduduk_model->get_config();
$data['config'] = $this->config_model->get_data();
$data['main'] = $this->laporan_penduduk_model->list_data($lap);
view('statistik/penduduk_excel', $data);
}
Expand Down Expand Up @@ -371,7 +372,7 @@ public function warga($lap = '', $data = '')
default:$data['stat'] = 'Pendidikan';
}

$data['config'] = $this->laporan_penduduk_model->get_config();
$data['config'] = $this->config_model->get_data();
$data['main'] = $this->laporan_penduduk_model->list_data($lap);

$_SESSION['per_page'] = 100;
Expand Down
5 changes: 3 additions & 2 deletions donjo-app/controllers/Surat.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public function __construct()
if ($grup !== '1' && $grup !== '2' && $grup !== '3') {
redirect('siteman');
}
$this->load->model('config_model');
$this->load->model('header_model');
$this->load->model('penduduk_model');
$this->load->model('surat_model');
$this->load->model('surat_keluar_model');
$this->load->model('surat_model');
}

public function index()
Expand Down Expand Up @@ -107,7 +108,7 @@ public function cetak($url = '')
$data['pribadi'] = $this->surat_model->get_data_pribadi($id);
$data['kk'] = $this->surat_model->get_data_kk($id);

$data['desa'] = $this->surat_model->get_data_desa();
$data['desa'] = $this->config_model->get_data();
$data['pamong'] = $this->surat_model->get_pamong($_POST['pamong']);

$data['pengikut'] = $this->surat_model->pengikut();
Expand Down
2 changes: 1 addition & 1 deletion donjo-app/helpers/donjolib_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function view(string $view, array $data = [], bool $return = false)
}
}

/* -------------------------------------------------------------------------- */
// --------------------------------------------------------------------------

function Rpt($str = 0)
{
Expand Down
6 changes: 5 additions & 1 deletion donjo-app/models/Config_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,15 @@ public function initsurat()
}
}

public function get_data()
public function get_data(bool $return_array = false)
{
$sql = 'SELECT * FROM config WHERE 1';
$query = $this->db->query($sql);

if ($return_array) {
return $query->result_array();
}

return $query->row_array();
}

Expand Down
Loading