Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Data RTLH per Fasilitator
- function listbyfasilitator_get() {
- $username = trim($this->get('username'));
- $Data_rtlh = array();
- if ($username == '') { // Jika Username Kosong
- $Data_rtlh[] = array(
- 'resp_error' => TRUE,
- 'resp_msg' => 'ID Fasilitator Masih Kosong.'
- );
- $this->response($Data_rtlh, 200);
- } else { // Jika NPWRD Ada
- $this->db->select('r.*, p.penduduk_no_kk, p.penduduk_nama, p.penduduk_jk, p.penduduk_alamat,
- p.penduduk_rt, p.penduduk_rw, c.nama_kec, k.nama_kel, p.penduduk_tmpt_lhr, p.penduduk_tgl_lahir');
- $this->db->from('rtlh_rtlh r');
- $this->db->join('rtlh_penduduk_dukcapil p', 'r.penduduk_nik = p.penduduk_nik');
- $this->db->join('rtlh_kec c', 'p.no_kec = c.no_kec');
- $this->db->join('rtlh_kel k', 'p.no_kel = k.no_kel');
- $this->db->where('k.no_kec = c.no_kec');
- $this->db->where('r.rtlh_aktif', 1); // Aktif
- $this->db->where('r.rtlh_step >=', 3); // Verifikasi ke Atas
- $this->db->where('r.user_pengampu', $username);
- $listRTLH = $this->db->get()->result();
- if (count($listRTLH) > 0) {
- $response = [
- 'resp_error' => FALSE,
- 'resp_msg' => "Success",
- 'items' => []
- ];
- foreach ($listRTLH as $r) {
- $rtlh_id = $r->rtlh_id;
- // 0 Persen
- $this->db->select('*');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '0');
- $this->db->order_by('foto_id', 'asc');
- $listFoto = $this->db->get()->result();
- if (count($listFoto) == 0) {
- $foto_rmh_0 = '';
- $foto_atap_0 = '';
- $foto_dinding_0 = '';
- $foto_lantai_0 = '';
- $is_valid_0 = false;
- } else {
- foreach($listFoto as $f) {
- $foto_nama = trim($f->foto_nama);
- switch ($foto_nama) {
- case 'Rumah': // Rumah
- $foto_rmh_0 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Atap': // Atap
- $foto_atap_0 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Dinding': // Dinding
- $foto_dinding_0 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Lantai': // Lantai
- $foto_lantai_0 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- }
- }
- $is_valid_0 = true;
- }
- // 50 Persen
- $this->db->select('*');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '50');
- $this->db->order_by('foto_id', 'asc');
- $listFoto1 = $this->db->get()->result();
- if (count($listFoto1) == 0) {
- $foto_rmh_50 = '';
- $foto_atap_50 = '';
- $foto_dinding_50 = '';
- $foto_lantai_50 = '';
- $is_valid_50 = false;
- } else {
- foreach($listFoto1 as $f) {
- $foto_nama = trim($f->foto_nama);
- switch ($foto_nama) {
- case 'Rumah': // Rumah
- $foto_rmh_50 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Atap': // Atap
- $foto_atap_50 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Dinding': // Dinding
- $foto_dinding_50 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Lantai': // Lantai
- $foto_lantai_50 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- }
- }
- $is_valid_50 = true;
- }
- // 100 Persen
- $this->db->select('*');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '100');
- $this->db->order_by('foto_id', 'asc');
- $listFoto2 = $this->db->get()->result();
- if (count($listFoto2) == 0) {
- $foto_rmh_100 = '';
- $foto_atap_100 = '';
- $foto_dinding_100 = '';
- $foto_lantai_100 = '';
- $is_valid_100 = false;
- } else {
- foreach($listFoto2 as $f) {
- $foto_nama = trim($f->foto_nama);
- switch ($foto_nama) {
- case 'Rumah': // Rumah
- $foto_rmh_100 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Atap': // Atap
- $foto_atap_100 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Dinding': // Dinding
- $foto_dinding_100 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- case 'Lantai': // Lantai
- $foto_lantai_100 = base_url('img/foto_rumah/'.$f->foto_file);
- break;
- }
- }
- $is_valid_100 = true;
- }
- $response['items'][] = [
- 'rtlh_id' => $r->rtlh_id,
- 'kd_wilayah'=> trim($r->rtlh_kode_wilayah),
- 'nik' => trim($r->penduduk_nik),
- 'no_rtlh' => trim($r->rtlh_no_urut),
- 'nama' => trim($r->penduduk_nama),
- 'alamat' => $r->penduduk_alamat.' RT. '.$r->penduduk_rt.' RW. '.$r->penduduk_rw.' DESA '.$r->nama_kel.' KEC. '.$r->nama_kec,
- 'jk' => trim($r->penduduk_jk),
- 'tmpt_lahir'=> trim($r->penduduk_tmpt_lhr),
- 'tgl_lahir' => $r->penduduk_tgl_lahir,
- 'pbdt' => trim($r->rtlh_pbdt),
- 'status' => trim($r->rtlh_prioritas),
- 'data' => [
- 'data_pendukung' => [
- 'is_form_valid' => true,
- 'penghasilan_perbulan' => $r->penghasilan_id,
- 'pengeluaran_perbulan' => $r->pengeluaran_id,
- 'status_kepemilikan_tanah' => $r->status_tanah_id,
- 'bukti_kepemilikan_tanah' => $r->bukti_tanah_id,
- 'status_kepemilikan_rumah' => $r->pemilik_rumah_id,
- 'aset_rumah_lain' => $r->rtlh_rumah_lain,
- 'aset_tanah_lain' => $r->rtlh_tanah_lain,
- 'imb' => $r->rtlh_imb,
- 'bantuan_perumahan' => $r->bantuan_id
- ],
- 'data_kondisi_fisik_rumah' => [
- 'is_form_valid' => true,
- 'pondasi_bangunan' => $r->bantuan_id,
- 'kondisi_balok_kolom' => $r->rtlh_kondisi_balok,
- 'kondisi_konstruksi_atap' => $r->rtlh_kondisi_atap,
- 'jendela_lubang_cahaya' => $r->rtlh_jendela,
- 'ventilasi' => $r->ventilasi_id,
- 'sanitasi' => $r->rtlh_sanitasi,
- 'kondisi_sanitasi' => $r->rtlh_kondisi_sanitasi,
- 'jenis_sanitasi' => $r->sanitasi_id,
- 'septitank' => $r->rtlh_septitank,
- 'kondisi_septitank' => $r->rtlh_kondisi_septitank,
- 'sumber_air_minum' => $r->air_minum_id,
- 'sumber_listrik' => $r->listrik_id
- ],
- 'aspek_persyaratan' => [
- 'is_form_valid' => true,
- 'luas_rumah' => $r->rtlh_luas,
- 'jumlah_penghuni' => $r->rtlh_jml_orang,
- 'no_kk_lain' => $r->rtlh_no_kk_lain,
- 'jml_kk' => $r->rtlh_jml_kk,
- 'tinggi_bangunan' => $r->tinggi_id,
- 'rg_keluarga' => $r->rtlh_ruang_keluarga
- ],
- 'aspek_komponen' => [
- 'is_form_valid' => true,
- 'material_atap' => $r->material_atap_id,
- 'kondisi_atap' => $r->kondisi_atap_id,
- 'material_dinding_terluas' => $r->material_dinding_id,
- 'kondisi_dinding' => $r->kondisi_dinding_id,
- 'material_lantai' => $r->material_lantai_id,
- 'luas_lantai' => $r->luas_lantai_id
- ],
- 'foto_pemilik' => [
- "foto_pemilik" => [
- 'type' => 'online',
- 'source' => base_url('img/foto/'.$r->rtlh_foto),
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 800,
- 'width' => 600
- ],
- 'is_form_valid' => true
- ],
- "foto_ktp_kk" => [
- "ktp" => [
- 'type' => 'online',
- 'source' => base_url('img/foto_ktp_kk/'.$r->rtlh_foto_ktp),
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 0,
- 'width' => 300
- ],
- "ktp" => [
- 'type' => 'online',
- 'source' => base_url('img/foto_ktp_kk/'.$r->rtlh_foto_kk),
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 0,
- 'width' => 300
- ],
- 'is_form_valid' => true
- ],
- "lokasi_rumah" => [
- 'is_form_valid' => true,
- 'latitude' => $r->rtlh_lat,
- 'longitude' => $r->rtlh_long,
- 'batas_utara' => $r->rtlh_bts_utara,
- 'batas_timur' => $r->rtlh_bts_timur,
- 'batas_selatan' => $r->rtlh_bts_selatan,
- 'batas_barat' => $r->rtlh_bts_barat
- ],
- "foto_bangunan_0" => [
- "bangunan" => [
- 'type' => 'online',
- 'source' => $foto_rmh_0,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "atap" => [
- 'type' => 'online',
- 'source' => $foto_atap_0,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "dinding" => [
- 'type' => 'online',
- 'source' => $foto_dinding_0,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "lantai" => [
- 'type' => 'online',
- 'source' => $foto_lantai_0,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- 'is_form_valid' => $is_valid_0
- ],
- "foto_bangunan_50" => [
- "bangunan" => [
- 'type' => 'online',
- 'source' => $foto_rmh_50,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "atap" => [
- 'type' => 'online',
- 'source' => $foto_atap_50,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "dinding" => [
- 'type' => 'online',
- 'source' => $foto_dinding_50,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "lantai" => [
- 'type' => 'online',
- 'source' => $foto_lantai_50,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- 'is_form_valid' => $is_valid_50
- ],
- "foto_bangunan_100" => [
- "bangunan" => [
- 'type' => 'online',
- 'source' => $foto_rmh_100,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "atap" => [
- 'type' => 'online',
- 'source' => $foto_atap_100,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "dinding" => [
- 'type' => 'online',
- 'source' => $foto_dinding_100,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- "lantai" => [
- 'type' => 'online',
- 'source' => $foto_lantai_100,
- 'latitude' => '',
- 'longitude' => '',
- 'height' => 600,
- 'width' => 800
- ],
- 'is_form_valid' => $is_valid_100
- ]
- ]
- ];
- }
- } else {
- $response = [
- 'resp_error' => TRUE,
- 'resp_msg' => "Data Tidak Ada."
- ];
- }
- $this->response($response, 200);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement