function edit($id = 0) { $catalogue = new Estatecatalogue($id); if ($_SERVER['REQUEST_METHOD'] == "POST") { $this->load->helper('remove_vn_helper'); //$catalogue->parentcat_id = $this->input->post('parentcat_id'); $catalogue->name = $this->input->post('name'); $catalogue->name_none = remove_vn($catalogue->name); $catalogue->title = $this->input->post('title'); $catalogue->description = $this->input->post('description'); $catalogue->keyword = $this->input->post('keyword'); if ($catalogue->save()) { flash_message('success', 'Thao tác đã được thực hiện'); redirect($this->admin . 'estatecatalogues/list_all'); } else { flash_message('error', 'Đã có lỗi xãy ra !'); } } $estatesCatalogue = new Estatecatalogue(); $estatesCatalogue->where('parentcat_id', NULL); $estatesCatalogue->order_by('position'); $estatesCatalogue->get_iterated(); $dis['estatesCatalogue'] = $estatesCatalogue; $dis['object'] = $catalogue; $dis['base_url'] = base_url(); $dis['view'] = 'estatecatalogue/edit'; $dis['menu_active'] = 'Hình thức'; $dis['title'] = "Thêm/Sửa Hình thức"; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estatecatalogues/list_all/", "onclick" => "")); $this->viewadmin($dis); }