Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!empty($_POST))
- {
- $book->title = $_POST['title'];
- $book->isbn = $_POST['isbn'];
- $book->chapters = $_POST['chapters'];
- $scanned = array();
- if (isset($_POST['scanned']))
- {
- $scanned = $_POST['scanned'];
- }
- $edited = array();
- if (isset($_POST['edited']))
- {
- $edited = $_POST['edited'];
- }
- $book->setChaptersStatuses($scanned, $edited);
- $valid = $book->save();
- if($valid === TRUE)
- {
- unset($_SESSION['post']['edit']);
- unset($_SESSION['formErrors']);
- $_SESSION['notice'] = 'Boek opgeslagen.';
- header('Location: ' . Core::url('books/view/' . $book->id));
- exit;
- }
- else
- {
- $_SESSION['post']['edit'] = $_POST;
- $_SESSION['formErrors'] = $valid;
- $_SESSION['error'] = View::factory('blocks/book_form_errors')->render();
- header('Location: ' . Core::url('books/edit/' . $book->id));
- exit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment