public function getDelete($id) { $penduduk = Penduduk::find($id); if ($penduduk->delete()) { return Redirect::to('penduduk')->with('succes', 'Anda Berhasi Menghapus data Penduduk'); } else { return Redirect::to('penduduk')->with('error', 'Anda gagal menghapus data ini'); } }
<?php require_once "component/Penduduk.php"; require_once "component/List.php"; // get parameter $kStat = $postVars_kStat; $next = $postVars_next; if ($next) { $penduduk = new Penduduk($ADODB); switch ($kStat) { case 1: $stat = $penduduk->statUsia(); if ($stat) { // loop stat for ($i = 0; $i < count($stat); $i++) { for ($j = 0; $j < count($GROUP_USIA); $j++) { if ($stat[$i]["UMUR"] >= $GROUP_USIA[$j][0] && $stat[$i]["UMUR"] <= $GROUP_USIA[$j][1]) { $newStat[$j] += $stat[$i]["JUMLAH"]; break; } } } } unset($stat); for ($i = 0; $i < count($GROUP_USIA); $i++) { $stat[$i]["KELOMPOK UMUR"] = "Usia dari " . $GROUP_USIA[$i][0] . ($GROUP_USIA[$i][1] != 1000 ? " hingga " . $GROUP_USIA[$i][1] : " keatas"); $stat[$i]["JUMLAH"] = (int) $newStat[$i]; } break; case 2: $stat = $penduduk->statJenisKelamin();
function hapus_penduduk($nik) { $penduduk = new Penduduk(); return $penduduk->hapus_penduduk($nik); }
$M_DUSUN = $list->getMDusun(); $M_AGAMA = $list->getMAgama(); $M_WARGA = $list->getMWarga(); $M_KERJA = $list->getMKerja(); $M_PENDIDIDKAN = $list->getMPendidikan(); $M_KAWIN = array('x' => 'Seluruh Status') + $M_KAWIN; $M_DUSUN = array('x' => 'Seluruh Dusun') + $M_DUSUN; $M_AGAMA = array('x' => 'Seluruh Agama') + $M_AGAMA; $M_KERJA = array('x' => 'Seluruh Pekerjaan') + $M_KERJA; $M_PENDIDIDKAN = array('x' => 'Seluruh Pendidikan') + $M_PENDIDIDKAN; foreach ($M_FIELD as $key => $field) { $fieldOptions[$key] = $field[1]; } if ($next || $download) { if (!$errorCode) { $penduduk = new Penduduk($ADODB); $result = $penduduk->searchAdvance($kField, $keyword, $limit, $page, $kAgama, $kKerja, $kDusun, $kKawin, $kPendidikan, $download); if ($download) { require_once 'component/psxlsgen.php'; $myxls = new PhpSimpleXlsGen(); $myxls->filename = "download"; $myxls->WriteText_pos(0, 0, 'No'); $myxls->WriteText_pos(0, 1, 'NIK'); $myxls->WriteText_pos(0, 2, 'No. KTP'); $myxls->WriteText_pos(0, 3, 'Nama'); $myxls->WriteText_pos(0, 4, 'Agama'); $myxls->WriteText_pos(0, 5, 'Pekerjaan'); $myxls->WriteText_pos(0, 6, 'Alamat'); $myxls->WriteText_pos(0, 7, 'Dusun'); $myxls->WriteText_pos(0, 8, 'No. RT'); $myxls->WriteText_pos(0, 9, 'No. RW');
function voteCalon($noktp, $idcalon) { $obj = new Penduduk(); $result = $obj->voteCalon($noktp, $idcalon); return $result; }
<?php require_once "component/Penduduk.php"; require_once "component/List.php"; // get parameter $page = 0; $limit = 10; $keyword = $getVars_keyword ? $getVars_keyword : $postVars_keyword; if ($keyword) { $list = new Lists($ADODB); $M_KAWIN = $list->getMKawin(); $M_AGAMA = $list->getMAgama(); $M_WARGA = $list->getMWarga(); $M_KERJA = $list->getMKerja(); $M_PENDIDIDKAN = $list->getMPendidikan(); $penduduk = new Penduduk($ADODB); $result = $penduduk->search($keyword, $limit, $page); for ($i = 0; $i < $result["numPage"]; $i++) { $pageOptions[$i] = $i + 1; } if (!$result) { $errorCode = "notFound"; } } include_once "template/penduduk.lookup.php";
<?php require_once 'penduduk.php'; $data = new Penduduk(); $d = $data->get_penduduk(); echo '<pre>'; print_r($d); echo '</pre>';
<?php require_once "component/Penduduk.php"; require_once "component/List.php"; // get parameter $id = (int) $getVars_id; $delete = $getVars_delete; if (!$id) { header("Location:index.php?form=B.06"); } $penduduk = new Penduduk($ADODB); if ($delete) { $penduduk->id = $id; $penduduk->delete(); header("Location:index.php?form=B.06"); } if ($id) { $list = new Lists($ADODB); $M_KAWIN = $list->getMKawin(); $M_AGAMA = $list->getMAgama(); $M_WARGA = $list->getMWarga(); $M_KERJA = $list->getMKerja(); $M_DUSUN = $list->getMDusun(); $M_PENDIDIDKAN = $list->getMPendidikan(); $penduduk->id = $id; if (!$penduduk->detail()) { $errorCode = "notFound"; } } include_once "template/penduduk.detail.php";
<?php require_once "component/Penduduk.php"; require_once "component/List.php"; $penduduk = new Penduduk($ADODB); $list = new Lists($ADODB); // get parameter $id = $postVars_id ? $postVars_id : $getVars_id; $nik = $postVars_nik; $noKTP = $postVars_noKTP; $nama = $postVars_nama; $kAgama = $postVars_kAgama; $kKerja = $postVars_kKerja; $pekerjaan = $postVars_pekerjaan; $alamat = $postVars_alamat; $kDusun = $postVars_kDusun; $rt = $postVars_rt; $rw = $postVars_rw; $tempatLahir = $postVars_tempatLahir; $kelamin = $postVars_kelamin; $kWarga = $postVars_kWarga; $kKawin = $postVars_kKawin; $kPendidikan = $postVars_kPendidikan; $pendidikan = $postVars_pendidikan; $suku = $postVars_suku; $next = $postVars_next; $M_KAWIN = $list->getMKawin(); $M_AGAMA = $list->getMAgama(); $M_WARGA = $list->getMWarga(); $M_KERJA = $list->getMKerja(); $M_DUSUN = $list->getMDusun();