Пример #1
0
 public function create_volca_submit()
 {
     $data = $this->input->post();
     unset($data['ID']);
     unset($data['btn_submit']);
     $this->form_validation->set_rules(Validation_rules::create_volca_rules());
     if ($this->form_validation->run()) {
         $id = $this->t_volca->set_data($data);
         if ($id != null) {
             $this->noti('Data create successfully.', 'error');
         } else {
             $this->noti('Data create failed.', 'error');
         }
         $this->noti('Data create successfully.', 'success');
         redirect('admin/course/volca_list');
     } else {
         $list_of_errors = validate_load(Validation_rules::create_blog_rules());
         $this->session->set_userdata('list_of_errors', json_encode($list_of_errors));
         $this->session->set_userdata('error_mess_code', validation_errors());
         redirect('admin/course/create_volca');
     }
 }
Пример #2
0
 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);
     }
 }