Commit 2cd972c1 authored by Sam Hemelryk's avatar Sam Hemelryk
Browse files

MDL-32709 Pre-integration trivial clean up

* Added a comment for the BOOK_NUM_* defines.
* Fixed broken redirects in tool/importhtml/index.php
* Fixed typo in book_preload_chapters [subchpaters => subchapters]
* Fixed copy paste docblock error in tool/print/locallib.php
* Removed the .gitignore file as Eloy had previously mentioned that.
parent 079be74d
# See gitignore(5) man page for more details
#
*~
*.swp
/tags
/TAGS
/cscope.*
/.patches/
/.idea/
/nbproject/
CVS
.DS_Store
/.settings/
/.project
/.buildpath
/.cache
......@@ -27,6 +27,13 @@ defined('MOODLE_INTERNAL') || die;
require_once(dirname(__FILE__).'/lib.php');
require_once($CFG->libdir.'/filelib.php');
/**
* The following defines are used to define how the chapters and subchapters of a book should be displayed in that table of contents.
* BOOK_NUM_NONE No special styling will applied and the editor will be able to do what ever thay want in the title
* BOOK_NUM_NUMBERS Chapters and subchapters are numbered (1, 1.1, 1.2, 2, ...)
* BOOK_NUM_BULLETS Subchapters are indented and displayed with bullets
* BOOK_NUM_INDENTED Subchapters are indented
*/
define('BOOK_NUM_NONE', '0');
define('BOOK_NUM_NUMBERS', '1');
define('BOOK_NUM_BULLETS', '2');
......@@ -88,7 +95,7 @@ function book_preload_chapters($book) {
$hidesub = $ch->hidden;
$parent = $ch->id;
$ch->parent = null;
$ch->subchpaters = array();
$ch->subchapters = array();
} else {
$ch->prev = $prevsub;
$ch->next = null;
......@@ -96,7 +103,7 @@ function book_preload_chapters($book) {
$chapters[$prevsub]->next = $ch->id;
}
$ch->parent = $parent;
$ch->subchpaters = null;
$ch->subchapters = null;
$chapters[$parent]->subchapters[$ch->id] = $ch->id;
if ($hidesub) {
// all subchapters in hidden chapter must be hidden too
......
......@@ -61,9 +61,9 @@ $mform = new booktool_importhtml_form(null, array('id'=>$id, 'chapterid'=>$chapt
// If data submitted, then process and store.
if ($mform->is_cancelled()) {
if (empty($chapter->id)) {
redirect("view.php?id=$cm->id");
redirect("/mod/book/view.php?id=$cm->id");
} else {
redirect("view.php?id=$cm->id&chapterid=$chapter->id");
redirect("/mod/book/view.php?id=$cm->id&chapterid=$chapter->id");
}
} else if ($data = $mform->get_data()) {
......
......@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* HTML import lib
* Book print lib
*
* @package booktool_print
* @copyright 2011 Petr Skoda {@link http://skodak.org}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment