arsiarne

c_edit_ebook

Jul 23rd, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. public function edit_ebook($id=0){
  2. $this->load->view("app_user/global/header");
  3. $this->load->library('encrypt');
  4.  
  5. if ($this->input->post('judul_ebook')){
  6. $config['upload_path'] = "./cover/"; //lokasi folder yang akan digunakan untuk menyimpan file
  7. $config['allowed_types'] = 'gif|jpg|png|JPEG'; //extension yang diperbolehkan untuk diupload
  8. $config['file_name'] = url_title($this->input->post('cover_ebook'));
  9.  
  10. $this->upload->initialize($config); //meng set config yang sudah di atur
  11. if( !$this->upload->do_upload('cover_ebook'))
  12. {
  13. $data= array (
  14. 'ebook' => $this->app_model->get_ebook($id),
  15. 'kategori' => $this->app_model_admin->view_kategori(),
  16. );
  17. $this->load->view('app_user/halaman/edit_ebook',$data);
  18. }
  19. else{
  20.  
  21. if($this->app_model->edit_ebook())
  22. {
  23. $this->session->set_flashdata('success', 'Your ebook successfully created!');
  24. header('location:'.base_url().'app_user/manage_ebook');
  25. }
  26. else
  27. {
  28. $this->session->set_flashdata('msg', 'Error insert database');
  29. header('location:'.base_url().'app_user/manage_ebook');
  30. }
  31. }
  32. }else{
  33.  
  34. $data= array (
  35. 'ebook' => $this->app_model->get_ebook($id),
  36. 'kategori' => $this->app_model_admin->view_kategori(),
  37. );
  38. $this->load->view('app_user/halaman/edit_ebook',$data);
  39. }
  40.  
  41. $this->load->view("app_user/global/script");
  42. }
Advertisement
Add Comment
Please, Sign In to add comment