Guest User

Untitled

a guest
May 11th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. if (!empty($_POST))
  2. {
  3. $book->title = $_POST['title'];
  4. $book->isbn = $_POST['isbn'];
  5. $book->chapters = $_POST['chapters'];
  6.  
  7. $scanned = array();
  8. if (isset($_POST['scanned']))
  9. {
  10. $scanned = $_POST['scanned'];
  11. }
  12.  
  13. $edited = array();
  14. if (isset($_POST['edited']))
  15. {
  16. $edited = $_POST['edited'];
  17. }
  18.  
  19. $book->setChaptersStatuses($scanned, $edited);
  20.  
  21. $valid = $book->save();
  22.  
  23. if($valid === TRUE)
  24. {
  25. unset($_SESSION['post']['edit']);
  26. unset($_SESSION['formErrors']);
  27. $_SESSION['notice'] = 'Boek opgeslagen.';
  28. header('Location: ' . Core::url('books/view/' . $book->id));
  29. exit;
  30. }
  31. else
  32. {
  33. $_SESSION['post']['edit'] = $_POST;
  34. $_SESSION['formErrors'] = $valid;
  35. $_SESSION['error'] = View::factory('blocks/book_form_errors')->render();
  36. header('Location: ' . Core::url('books/edit/' . $book->id));
  37. exit();
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment