function list_by_parent($id, $offset = 0, $limit = 10) { if ($_SERVER['REQUEST_METHOD'] == "POST") { foreach ($_POST as $key => $value) { if (substr($key, 0, 8) == "position") { if (trim($this->input->post($key)) != "") { $keylist = explode("_", $key); $object_id = $keylist[1]; $object = new Estateward($object_id); $object->position = $this->input->post($key); $object->save(); $object->clear(); } } } $district_id = $this->input->post('district_id'); flash_message('success', 'Cập nhật thành công.'); redirect($this->admin . 'estatewards/list_by_parent/' . $district_id); } $districts = new Estatedistrict($id); $wards = new Estateward(); $wards->where('estatedistrict_id', $id); $wards->order_by('position', 'asc'); $wards->get_iterated(); $dis['wards'] = $wards; $dis['districts'] = $districts; $dis['base_url'] = base_url(); $dis['view'] = 'estateward/list_by_parent'; $dis['menu_active'] = 'Thành phố/Tỉnh'; $dis['title'] = "Danh sách các Xã/Phường thuộc <span style='color:#F00;'>" . $districts->name . '</span>'; $dis['title_table'] = "Trang hiện tại:" . $wards->paged->current_page . '/' . $wards->paged->total_pages; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estatedistricts/list_by_parent/" . $districts->estatecity_id, "onclick" => ""), array("type" => "add", "text" => "Thêm", "link" => "{$this->admin_url}estatewards/edit_by_parent/" . $districts->id, "onclick" => "")); $this->viewadmin($dis); }