public function edit_submit() { $data = $this->input->post(); $id = $data['ID']; unset($data['ID']); unset($data['btn_submit']); if ($data['PARENT'] == 'BLANK') { $data['PARENT'] = NULL; } $this->form_validation->set_rules('ID_NAME', 'Id', 'trim|required|max_length[50]|custom_validate_cate_id_name|callback_edit_unique_cate_id[category.ID_NAME.' . $data['ID_NAME'] . '.' . $id . ']'); $this->form_validation->set_rules(Validation_rules::edit_category_rules()); if ($this->form_validation->run()) { if ($data != null) { $this->t_category->update_data_by_id($data, $id); $this->noti('Data saved.', 'success'); } else { $this->noti('Failed.', 'error'); } redirect('admin/category/category_list'); } else { $this->session->set_userdata('type_mess_code', ERROR_CLASS); $this->session->set_userdata('error_flag_code', 0); $ext_field = array(array('field' => 'ID_NAME', 'label' => 'Id')); $list_of_errors = validate_load(Validation_rules::edit_category_rules()); $ext_field = validate_load($ext_field); $list_of_errors = array_merge($list_of_errors, $ext_field); $this->session->set_userdata('list_of_errors', json_encode($list_of_errors)); $this->session->set_userdata('error_mess_code', validation_errors()); $this->session->set_userdata('EDIT_CATEGORY', $data); redirect('admin/category/edit_category/' . $id); } }
public function update_volca() { $data = $this->input->post(); $id = $data['id']; unset($data['id']); unset($data['btn_submit']); $this->form_validation->set_rules(Validation_rules::update_volca_rules()); if ($this->form_validation->run()) { $this->t_volca->update_data_by_id($data, $id); $this->noti('Data update successfully.', 'success'); redirect('admin/course/volca_list'); } else { $list_of_errors = validate_load(Validation_rules::update_volca_rules()); $this->session->set_userdata('list_of_errors', json_encode($list_of_errors)); $this->session->set_userdata('error_mess_code', validation_errors()); $this->session->set_userdata('EDIT_VOLCA', $data); redirect('admin/course/edit_volca/' . $id); } }
public function edit_submit() { $data = $this->input->post(); $id = $data['ID']; unset($data['ID']); unset($data['myfile']); if ($data['THUMB'] == null) { $data['THUMB'] = DEFAULT_THUMB; } else { $data['THUMB'] = DEFAULT_THUMB_FOLDER . $data['THUMB']; } unset($data['btn_submit']); $this->form_validation->set_rules(Validation_rules::create_blog_rules()); if ($this->form_validation->run()) { $this->t_blog->update_data_by_id($data, $id); $this->noti('Data update successfully.', 'success'); redirect('admin/cms'); } else { $list_of_errors = validate_load(Validation_rules::edit_blog_rules()); $this->session->set_userdata('list_of_errors', json_encode($list_of_errors)); $this->session->set_userdata('error_mess_code', validation_errors()); $this->session->set_userdata('EDIT_CONTENT', $data); redirect('admin/cms/edit/' . $id); } }