Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Foto 100 %
- $idrmh_100 = $data->data->foto_bangunan_100->bangunan->foto_id; // ID Foto Rumah
- $typerumah_100 = $data->data->foto_bangunan_100->bangunan->type; // Foto Rumah
- $filefotorumah_100 = $data->data->foto_bangunan_100->bangunan->source;
- if ($typerumah_100 == 'local' && $filefotorumah_100 != '') {
- $fotoRumah_100 = $filefotorumah_100;
- $lokasiasalrmh_100 = FCPATH . 'temp_sync/dataoperator/data_ekstrak/' . $nama_file . '/' . $filefotorumah_100;
- $lokasibarurmh_100 = FCPATH . 'img/foto_rumah/' . $filefotorumah_100;
- rename($lokasiasalrmh_100, $lokasibarurmh_100);
- } else {
- $path = $filefotorumah_100;
- $fotoRumah_100 = basename($path);
- $fotoRumah_100 = basename($path, ".jpg");
- $fotoRumah_100 = $fotoRumah_100 . '.jpg';
- }
- $idatap_100 = $data->data->foto_bangunan_100->atap->foto_id; // ID Foto Atap
- $typeatap_100 = $data->data->foto_bangunan_100->atap->type; // Foto Atap
- $filefotoatap_100 = $data->data->foto_bangunan_100->atap->source;
- if ($typeatap_100 == 'local' && $filefotoatap_100 != '') {
- $fotoAtap_100 = $filefotoatap_100;
- $lokasiasalatap_100 = FCPATH . 'temp_sync/dataoperator/data_ekstrak/' . $nama_file . '/' . $filefotoatap_100;
- $lokasibaruatap_100 = FCPATH . 'img/foto_rumah/' . $filefotoatap_100;
- rename($lokasiasalatap_100, $lokasibaruatap_100);
- } else {
- $path = $filefotoatap_100;
- $fotoAtap_100 = basename($path);
- $fotoAtap_100 = basename($path, ".jpg");
- $fotoAtap_100 = $fotoAtap_100 . '.jpg';
- }
- $iddinding_100 = $data->data->foto_bangunan_100->dinding->foto_id; // ID Foto Dinding
- $typedinding_100 = $data->data->foto_bangunan_100->dinding->type; // Foto Dinding
- $filefotodinding_100 = $data->data->foto_bangunan_100->dinding->source;
- if ($typedinding_100 == 'local' && $filefotodinding_100 != '') {
- $fotoDinding_100 = $filefotodinding_100;
- $lokasiasaldinding_100 = FCPATH . 'temp_sync/dataoperator/data_ekstrak/' . $nama_file . '/' . $filefotodinding_100;
- $lokasibarudinding_100 = FCPATH . 'img/foto_rumah/' . $filefotodinding_100;
- rename($lokasiasaldinding_100, $lokasibarudinding_100);
- } else {
- $path = $filefotodinding_100;
- $fotoDinding_100 = basename($path);
- $fotoDinding_100 = basename($path, ".jpg");
- $fotoDinding_100 = $fotoDinding_100 . '.jpg';
- }
- $idlantai_100 = $data->data->foto_bangunan_100->lantai->foto_id; // ID Foto Lantai
- $typelantai_100 = $data->data->foto_bangunan_100->lantai->type; // Foto Lantai
- $filefotolantai_100 = $data->data->foto_bangunan_100->lantai->source;
- if ($typelantai_100 == 'local' && $filefotolantai_100 != '') {
- $fotoLantai_100 = $filefotolantai_100;
- $lokasiasallantai_100 = FCPATH . 'temp_sync/dataoperator/data_ekstrak/' . $nama_file . '/' . $filefotolantai_100;
- $lokasibarulantai_100 = FCPATH . 'img/foto_rumah/' . $filefotolantai_100;
- rename($lokasiasallantai_100, $lokasibarulantai_100);
- } else {
- $path = $filefotolantai_100;
- $fotoLantai_100 = basename($path);
- $fotoLantai_100 = basename($path, ".jpg");
- $fotoLantai_100 = $fotoLantai_100 . '.jpg';
- }
- // Insert/Update ke Tabel Foto 100%
- for ($i = 1; $i <= 4; $i++) {
- switch ($i) {
- case 1:
- $this->db->select('foto_id');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '100');
- $this->db->where('foto_nama', 'Rumah');
- $query = $this->db->get()->result();
- if (count($query) > 0) {
- $dataRumah = array(
- 'foto_file' => $fotoRumah_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->where('foto_id', $idrmh_100);
- $this->db->update('rtlh_foto_rumah', $dataRumah);
- } else {
- $dataRumah = array(
- 'rtlh_id' => $rtlh_id,
- 'foto_tipe' => '100',
- 'foto_nama' => 'Rumah',
- 'foto_file' => $fotoRumah_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->insert('rtlh_foto_rumah', $dataRumah);
- }
- break;
- case 2:
- $this->db->select('foto_id');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '100');
- $this->db->where('foto_nama', 'Atap');
- $query = $this->db->get()->result();
- if (count($query) > 0) {
- $dataAtap = array(
- 'foto_file' => $fotoAtap_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->where('foto_id', $idatap_100);
- $this->db->update('rtlh_foto_rumah', $dataAtap);
- } else {
- $dataAtap = array(
- 'rtlh_id' => $rtlh_id,
- 'foto_tipe' => '100',
- 'foto_nama' => 'Atap',
- 'foto_file' => $fotoAtap_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->insert('rtlh_foto_rumah', $dataAtap);
- }
- break;
- case 3:
- $this->db->select('foto_id');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '100');
- $this->db->where('foto_nama', 'Dinding');
- $query = $this->db->get()->result();
- if (count($query) > 0) {
- $dataDinding = array(
- 'foto_file' => $fotoDinding_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->where('foto_id', $iddinding_100);
- $this->db->update('rtlh_foto_rumah', $dataDinding);
- } else {
- $dataDinding = array(
- 'rtlh_id' => $rtlh_id,
- 'foto_tipe' => '100',
- 'foto_nama' => 'Dinding',
- 'foto_file' => $fotoDinding_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->insert('rtlh_foto_rumah', $dataDinding);
- }
- break;
- case 4:
- $this->db->select('foto_id');
- $this->db->from('rtlh_foto_rumah');
- $this->db->where('rtlh_id', $rtlh_id);
- $this->db->where('foto_tipe', '100');
- $this->db->where('foto_nama', 'Lantai');
- $query = $this->db->get()->result();
- if (count($query) > 0) {
- $dataLantai = array(
- 'foto_file' => $fotoLantai_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->where('foto_id', $idlantai_100);
- $this->db->update('rtlh_foto_rumah', $dataLantai);
- } else {
- $dataLantai = array(
- 'rtlh_id' => $rtlh_id,
- 'foto_tipe' => '100',
- 'foto_nama' => 'Lantai',
- 'foto_file' => $fotoLantai_100,
- 'foto_update' => date('Y-m-d H:i:s'),
- );
- $this->db->insert('rtlh_foto_rumah', $dataLantai);
- }
- break;
- default:
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement