Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simpan Data Bangunan Gedung
- public function savedatabangunan_post()
- {
- $username = trim($this->post('username'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username Kosong.',
- ];
- } elseif ($this->post('id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Permohonan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('id_fbangun') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Fungsi Utama Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('id_jenisbangun') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Jenis Bangunan Tidak Boleh Kosong.',
- ];
- } else {
- $id = trim($this->post('id'));
- $checkdata = $this->db->get_where('c39_imb_bangunan', array('id_pemohon' => $id))->row();
- if (count($checkdata) > 0) {
- $data = array(
- 'id_fbangun' => $this->post('id_fbangun', 'true'),
- 'id_jenisbangun' => $this->post('id_jenisbangun', 'true'),
- 'nm_bangunan_gdg' => strtoupper(trim($this->post('nm_bangunan_gdg', 'true'))),
- 'peruntukan' => strtoupper(trim($this->post('peruntukan', 'true'))),
- 'rencana_kota' => strtoupper(trim($this->post('rencana_kota', 'true'))),
- );
- $this->db->where('id_pemohon', $id);
- $this->db->update('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Bangunan Gedung Ter-Update.',
- ];
- } else {
- $data = array(
- 'id_pemohon' => $this->post('id', 'true'),
- 'id_fbangun' => $this->post('id_fbangun', 'true'),
- 'id_jenisbangun' => $this->post('id_jenisbangun', 'true'),
- 'nm_bangunan_gdg' => strtoupper(trim($this->post('nm_bangunan_gdg', 'true'))),
- 'peruntukan' => strtoupper(trim($this->post('peruntukan', 'true'))),
- 'rencana_kota' => strtoupper(trim($this->post('rencana_kota', 'true'))),
- );
- $this->db->insert('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Bangunan Gedung Tersimpan.',
- ];
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement