$database_config_bible->setVerseMapping($bible, $mapping); } } } $mapping = $database_config_bible->getVerseMapping($bible); $view->view->mapping = $mapping; // Book creation. @($createbook = $_GET['createbook']); if (isset($createbook)) { if ($createbook == "") { $dialog_books = new Dialog_Books(array("bible"), Locale_Translate::_("Create book"), "", "", "createbook", NULL, $database_bibles->getBooks($bible)); die; } else { $feedback = array(); if ($write_access) { Book_Create::create($bible, $createbook, NULL, $feedback); } } } // Book deletion. @($deletebook = $_GET['deletebook']); if ($deletebook != "") { @($confirm = $_GET['confirm']); if ($confirm != "") { if ($write_access) { Bible_Logic::deleteBook($bible, $deletebook); } } else { $dialog_yes = new Dialog_Yes(array("bible"), Locale_Translate::_("Would you like to delete this book?"), "deletebook"); die; }
} } } // Add chapter. if (isset($_GET['createchapter'])) { $dialog_entry = new Dialog_Entry(array("bible" => $bible, "book" => $book), Locale_Translate::_("Please enter the number for the new chapter"), "", "createchapter", NULL); die; } if (isset($_POST['createchapter'])) { $createchapter = $_POST['entry']; $chapters = $database_bibles->getChapters($bible, $book); // Only create the chapters if it does not yet exist. if (array_search($createchapter, $chapters) === false) { $feedback = array(); if ($write_access) { $result = Book_Create::create($bible, $book, $createchapter, $feedback); } $feedback = implode(" ", $feedback); if ($result) { $success_message = $feedback; } else { $error_message = $feedback; } } else { $error_message = Locale_Translate::_("This chapter already exists"); } } // Available chapters. $chapters = $database_bibles->getChapters($bible, $book); $view->view->chapters = $chapters; @($view->view->success_message = $success_message);