Esempio n. 1
0
 function edit_by_parent($district_id, $id = 0)
 {
     $district = new Estatedistrict($district_id);
     $wards = new Estateward($id);
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $this->load->helper('remove_vn_helper');
         $wards->name = $this->input->post('name');
         $wards->name_none = remove_vn($wards->name);
         $wards->estatedistrict_id = $district_id;
         if ($wards->save()) {
             flash_message('success', 'Thao tác đã được thực hiện');
             redirect($this->admin . 'estatewards/list_by_parent/' . $district_id);
         } else {
             flash_message('error', 'Đã có lỗi xãy ra !');
         }
     }
     $dis['object'] = $wards;
     $dis['district_id'] = $district_id;
     $dis['base_url'] = base_url();
     $dis['view'] = 'estateward/edit';
     $dis['menu_active'] = 'Thành phố/Tỉnh';
     $dis['title'] = "Thêm/Sửa Xã/Phường thuộc <span style='color:#F00;'>" . $district->name . "</span>";
     $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estatewards/list_by_parent/" . $district_id, "onclick" => ""));
     $this->viewadmin($dis);
 }