
Untitled
By: a guest on
May 11th, 2012 | syntax:
None | size: 0.91 KB | hits: 13 | expires: Never
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();
}
}