Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simpan Data Batas-Batas Tanah
- public function savedatabatas_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('utara') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Batas Utara Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('selatan') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Batas Selatan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('timur') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Batas Timur Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('barat') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Batas Barat Tidak Boleh Kosong.',
- ];
- } else {
- $id = $this->post('id');
- $checkdata = $this->db->get_where('c39_imb_bangunan', array('id_pemohon' => $id))->row();
- if (count($checkdata) > 0) {
- $data = array(
- 'batas_utara' => strtoupper(trim($this->post('utara', 'true'))),
- 'batas_selatan' => strtoupper(trim($this->post('selatan', 'true'))),
- 'batas_timur' => strtoupper(trim($this->post('timur', 'true'))),
- 'batas_barat' => strtoupper(trim($this->post('barat', 'true'))),
- );
- $this->db->where('id_pemohon', $id);
- $this->db->update('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Batas Bangunan Ter-Update.',
- ];
- } else {
- $data = array(
- 'id_pemohon' => $this->post('id', 'true'),
- 'batas_utara' => strtoupper(trim($this->post('utara', 'true'))),
- 'batas_selatan' => strtoupper(trim($this->post('selatan', 'true'))),
- 'batas_timur' => strtoupper(trim($this->post('timur', 'true'))),
- 'batas_barat' => strtoupper(trim($this->post('barat', 'true'))),
- );
- $this->db->insert('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Batas Bangunan Tersimpan.',
- ];
- }
- }
- $this->response($response, 200);
- }
Add Comment
Please, Sign In to add comment