Merge branch 'MDL-33121' of git://github.com/rwijaya/moodle

This commit is contained in:
Dan Poltawski 2012-06-19 14:14:54 +08:00
commit 34741af185
41 changed files with 221 additions and 213 deletions

View File

@ -19,24 +19,6 @@ Created by:
* Petr Skoda (skodak) - most of the coding & design
* Mojmir Volf, Eloy Lafuente, Antonio Vicent and others
Project page:
* https://github.com/skodak/moodle-mod_book
* http://moodle.org/plugins/view.php?plugin=mod_book
Installation:
* http://docs.moodle.org/20/en/Installing_contributed_modules_or_plugins
Issue tracker:
* https://github.com/skodak/moodle-mod_book/issues?milestone=&labels=
Intentionally omitted features:
* more chapter levels - it would encourage teachers to write too much complex and long books, better use standard standalone HTML editor and import it as Resource. DocBook format is another suitable solution.
@ -44,8 +26,3 @@ Intentionally omitted features:
* PDF export - there is no elegant way AFAIK to convert HTML to PDF, use virtual PDF printer or better use DocBook format for authoring
* detailed student tracking (postponed till officially supported)
* export as zipped set of HTML pages - instead use browser command Save page as... in print view
Future:
* No more development planned

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -130,14 +130,14 @@ class moodle1_mod_book_handler extends moodle1_mod_handler {
}
/**
* This is executed when the parser reaches the <OPTIONS> opening element
* This is executed when the parser reaches the <CHAPTERS> opening element
*/
public function on_book_chapters_start() {
$this->xmlwriter->begin_tag('chapters');
}
/**
* This is executed when the parser reaches the closing </OPTIONS> element
* This is executed when the parser reaches the closing </CHAPTERS> element
*/
public function on_book_chapters_end() {
$this->xmlwriter->end_tag('chapters');

View File

@ -18,7 +18,6 @@
* Define all the restore steps that will be used by the restore_book_activity_task
*
* @package mod_book
* @subpackage book
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Book module upgrade code
*

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -45,9 +45,8 @@ $chapter = $DB->get_record('book_chapters', array('id'=>$chapterid, 'bookid'=>$b
// Header and strings.
$PAGE->set_title(format_string($book->name));
$PAGE->add_body_class('mod_book');
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title($book->name);
$PAGE->set_heading($course->fullname);
// Form processing.
if ($confirm) { // the operation was confirmed.

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -108,9 +108,8 @@ if ($mform->is_cancelled()) {
}
// Otherwise fill and print the form.
$PAGE->set_title(format_string($book->name));
$PAGE->add_body_class('mod_book');
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title($book->name);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('editingchapter', 'mod_book'));

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -34,6 +34,12 @@ class book_chapter_edit_form extends moodleform {
$chapter = $this->_customdata['chapter'];
$options = $this->_customdata['options'];
//Disabled subchapter option when editing first node
$disabledmsg = null;
if ($chapter->pagenum == 1) {
$disabledmsg = get_string('subchapternotice', 'book');
}
$mform = $this->_form;
$mform->addElement('header', 'general', get_string('edit'));
@ -42,7 +48,7 @@ class book_chapter_edit_form extends moodleform {
$mform->setType('title', PARAM_RAW);
$mform->addRule('title', null, 'required', null, 'client');
$mform->addElement('advcheckbox', 'subchapter', get_string('subchapter', 'mod_book'));
$mform->addElement('advcheckbox', 'subchapter', get_string('subchapter', 'mod_book'), $disabledmsg);
$mform->addElement('editor', 'content_editor', get_string('content', 'mod_book'), null, $options);
$mform->setType('content_editor', PARAM_RAW);
@ -62,4 +68,12 @@ class book_chapter_edit_form extends moodleform {
// set the defaults
$this->set_data($chapter);
}
function definition_after_data(){
$mform = $this->_form;
$pagenum = $mform->getElement('pagenum');
if ($pagenum->getValue() == 1) {
$mform->hardFreeze('subchapter');
}
}
}

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -88,14 +88,14 @@ foreach ($books as $book) {
$currentsection = $book->section;
}
} else {
$printsection = '<span class="smallinfo">'.userdate($book->timemodified)."</span>";
$printsection = html_writer::tag('span', userdate($book->timemodified), array('class' => 'smallinfo'));
}
$class = $book->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed
$class = $book->visible ? null : array('class' => 'dimmed'); // hidden modules are dimmed
$table->data[] = array (
$printsection,
"<a $class href=\"view.php?id=$cm->id\">".format_string($book->name)."</a>",
html_writer::link(new moodle_url('view.php', array('id' => $cm->id)), format_string($book->name), $class),
format_module_intro('book', $book, $cm->id));
}

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -58,7 +58,6 @@ $string['numbering2'] = 'Bullets';
$string['numbering3'] = 'Indented';
$string['numberingoptions'] = 'Available options for chapter formatting';
$string['numberingoptions_desc'] = 'Options for displaying chapters and subchapters in the table of contents';
$string['chapterscount'] = 'Chapters';
$string['addafter'] = 'Add new chapter';
$string['confchapterdelete'] = 'Do you really want to delete this chapter?';
$string['confchapterdeleteall'] = 'Do you really want to delete this chapter and all its subchapters?';
@ -73,6 +72,6 @@ $string['book:viewhiddenchapters'] = 'View hidden book chapters';
$string['errorchapter'] = 'Error reading chapter of book.';
$string['page-mod-book-x'] = 'Any book module page';
$string['subchapternotice'] = 'This option is disabled, because the first chapter cannot be a subchapter';
$string['subplugintype_booktool'] = 'Book tool';
$string['subplugintype_booktool_plural'] = 'Book tools';

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ defined('MOODLE_INTERNAL') || die;
*/
function book_get_numbering_types() {
global $CFG; // required for the include
require_once(dirname(__FILE__).'/locallib.php');
return array (
@ -291,11 +292,7 @@ function book_supports($feature) {
* @return void
*/
function book_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) {
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
if ($PAGE->cm->modname !== 'book') {
return;
}
global $USER, $PAGE;
$plugins = get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -75,11 +75,6 @@ function book_preload_chapters($book) {
$first = false;
}
if (!$ch->subchapter) {
$ch->prev = $prev;
$ch->next = null;
if ($prev) {
$chapters[$prev]->next = $ch->id;
}
if ($ch->hidden) {
if ($book->numbering == BOOK_NUM_NUMBERS) {
$ch->number = 'x';
@ -97,11 +92,6 @@ function book_preload_chapters($book) {
$ch->parent = null;
$ch->subchapters = array();
} else {
$ch->prev = $prevsub;
$ch->next = null;
if ($prevsub) {
$chapters[$prevsub]->next = $ch->id;
}
$ch->parent = $parent;
$ch->subchapters = null;
$chapters[$parent]->subchapters[$ch->id] = $ch->id;
@ -120,6 +110,7 @@ function book_preload_chapters($book) {
$ch->number = $j;
}
}
if ($oldch->subchapter != $ch->subchapter or $oldch->pagenum != $ch->pagenum or $oldch->hidden != $ch->hidden) {
// update only if something changed
$DB->update_record('book_chapters', $ch);
@ -159,27 +150,6 @@ function book_get_chapter_title($chid, $chapters, $book, $context) {
return $title;
}
/**
* General logging to table
* @param string $str1
* @param string $str2
* @param int $level
* @return void
*/
function book_log($str1, $str2, $level = 0) {
switch ($level) {
case 1:
echo '<tr><td><span class="dimmed_text">'.$str1.'</span></td><td><span class="dimmed_text">'.$str2.'</span></td></tr>';
break;
case 2:
echo '<tr><td><span style="color: rgb(255, 0, 0);">'.$str1.'</span></td><td><span style="color: rgb(255, 0, 0);">'.$str2.'</span></td></tr>';
break;
default:
echo '<tr><td>'.$str1.'</class></td><td>'.$str2.'</td></tr>';
break;
}
}
/**
* Add the book TOC sticky block to the 1st region available
*
@ -217,7 +187,7 @@ function book_add_fake_block($chapters, $chapter, $book, $cm, $edit) {
function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
global $USER, $OUTPUT;
$toc = ''; // Representation of toc (HTML)
$toc = '';
$nch = 0; // Chapter number
$ns = 0; // Subchapter number
$first = 1;
@ -226,27 +196,35 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
switch ($book->numbering) {
case BOOK_NUM_NONE:
$toc .= '<div class="book_toc_none">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_none'));
break;
case BOOK_NUM_NUMBERS:
$toc .= '<div class="book_toc_numbered">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered'));
break;
case BOOK_NUM_BULLETS:
$toc .= '<div class="book_toc_bullets">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets'));
break;
case BOOK_NUM_INDENTED:
$toc .= '<div class="book_toc_indented">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented'));
break;
}
if ($edit) { // Teacher's TOC
$toc .= '<ul>';
$toc .= html_writer::start_tag('ul');
$i = 0;
foreach ($chapters as $ch) {
$i++;
$title = trim(format_string($ch->title, true, array('context'=>$context)));
if (!$ch->subchapter) {
$toc .= ($first) ? '<li>' : '</ul></li><li>';
if ($first) {
$toc .= html_writer::start_tag('li');
} else {
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::start_tag('li');
}
if (!$ch->hidden) {
$nch++;
$ns = 0;
@ -257,10 +235,18 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "x $title";
}
$title = '<span class="dimmed_text">'.$title.'</span>';
$title = html_writer::tag('span', $title, array('class' => 'dimmed_text'));
}
} else {
$toc .= ($first) ? '<li><ul><li>' : '<li>';
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('ul');
$toc .= html_writer::start_tag('li');
} else {
$toc .= html_writer::start_tag('li');
}
if (!$ch->hidden) {
$ns++;
if ($book->numbering == BOOK_NUM_NUMBERS) {
@ -274,75 +260,109 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$title = "x.x $title";
}
}
$title = '<span class="dimmed_text">'.$title.'</span>';
$title = html_writer::tag('span', $title, array('class' => 'dimmed_text'));
}
}
if ($ch->id == $chapter->id) {
$toc .= '<strong>'.$title.'</strong>';
$toc .= html_writer::tag('strong', $title);
} else {
$toc .= '<a title="'.s($title).'" href="view.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'">'.$title.'</a>';
$toc .= html_writer::link(new moodle_url('view.php', array('id' => $cm->id, 'chapterid' => $ch->id)), $title, array('title' => s($title)));
}
$toc .= '&nbsp;&nbsp;';
if ($i != 1) {
$toc .= ' <a title="'.get_string('up').'" href="move.php?id='.$cm->id.'&amp;chapterid='.$ch->id.
'&amp;up=1&amp;sesskey='.$USER->sesskey.'"><img src="'.$OUTPUT->pix_url('t/up').'" class="iconsmall" alt="'.get_string('up').'" /></a>';
$toc .= html_writer::link(new moodle_url('move.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'up' => '1', 'sesskey' => $USER->sesskey)),
$OUTPUT->pix_icon('t/up', get_string('up')), array('title' => get_string('up')));
}
if ($i != count($chapters)) {
$toc .= ' <a title="'.get_string('down').'" href="move.php?id='.$cm->id.'&amp;chapterid='.$ch->id.
'&amp;up=0&amp;sesskey='.$USER->sesskey.'"><img src="'.$OUTPUT->pix_url('t/down').'" class="iconsmall" alt="'.get_string('down').'" /></a>';
$toc .= html_writer::link(new moodle_url('move.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'up' => '0', 'sesskey' => $USER->sesskey)),
$OUTPUT->pix_icon('t/down', get_string('down')), array('title' => get_string('down')));
}
$toc .= ' <a title="'.get_string('edit').'" href="edit.php?cmid='.$cm->id.'&amp;id='.$ch->id.'"><img src="'.
$OUTPUT->pix_url('t/edit').'" class="iconsmall" alt="'.get_string('edit').'" /></a>';
$toc .= ' <a title="'.get_string('delete').'" href="delete.php?id='.$cm->id.'&amp;chapterid='.$ch->id.
'&amp;sesskey='.$USER->sesskey.'"><img src="'.$OUTPUT->pix_url('t/delete').'" class="iconsmall" alt="'.get_string('delete').'" /></a>';
$toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'id' => $ch->id)),
$OUTPUT->pix_icon('t/edit', get_string('edit')), array('title' => get_string('edit')));
$toc .= html_writer::link(new moodle_url('delete.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)),
$OUTPUT->pix_icon('t/delete', get_string('delete')), array('title' => get_string('delete')));
if ($ch->hidden) {
$toc .= ' <a title="'.get_string('show').'" href="show.php?id='.$cm->id.'&amp;chapterid='.$ch->id.
'&amp;sesskey='.$USER->sesskey.'"><img src="'.$OUTPUT->pix_url('t/show').'" class="iconsmall" alt="'.get_string('show').'" /></a>';
$toc .= html_writer::link(new moodle_url('show.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)),
$OUTPUT->pix_icon('t/show', get_string('show')), array('title' => get_string('show')));
} else {
$toc .= ' <a title="'.get_string('hide').'" href="show.php?id='.$cm->id.'&amp;chapterid='.$ch->id.
'&amp;sesskey='.$USER->sesskey.'"><img src="'.$OUTPUT->pix_url('t/hide').'" class="iconsmall" alt="'.get_string('hide').'" /></a>';
$toc .= html_writer::link(new moodle_url('show.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)),
$OUTPUT->pix_icon('t/hide', get_string('hide')), array('title' => get_string('hide')));
}
$toc .= ' <a title="'.get_string('addafter', 'mod_book').'" href="edit.php?cmid='.$cm->id.
'&amp;pagenum='.$ch->pagenum.'&amp;subchapter='.$ch->subchapter.'"><img src="'.
$OUTPUT->pix_url('add', 'mod_book').'" class="iconsmall" alt="'.get_string('addafter', 'mod_book').'" /></a>';
$toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'pagenum' => $ch->pagenum, 'subchapter' => $ch->subchapter)),
$OUTPUT->pix_icon('add', get_string('addafter', 'mod_book'), 'mod_book'), array('title' => get_string('addafter', 'mod_book')));
$toc .= (!$ch->subchapter) ? '<ul>' : '</li>';
if (!$ch->subchapter) {
$toc .= html_writer::start_tag('ul');
} else {
$toc .= html_writer::end_tag('li');
}
$first = 0;
}
$toc .= '</ul></li></ul>';
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::end_tag('ul');
} else { // Normal students view
$toc .= '<ul>';
$toc .= html_writer::start_tag('ul');
foreach ($chapters as $ch) {
$title = trim(format_string($ch->title, true, array('context'=>$context)));
if (!$ch->hidden) {
if (!$ch->subchapter) {
$nch++;
$ns = 0;
$toc .= ($first) ? '<li>' : '</ul></li><li>';
if ($first) {
$toc .= html_writer::start_tag('li');
} else {
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::start_tag('li');
}
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch $title";
}
} else {
$ns++;
$toc .= ($first) ? '<li><ul><li>' : '<li>';
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('ul');
$toc .= html_writer::start_tag('li');
} else {
$toc .= html_writer::start_tag('li');
}
if ($book->numbering == BOOK_NUM_NUMBERS) {
$title = "$nch.$ns $title";
}
}
if ($ch->id == $chapter->id) {
$toc .= '<strong>'.$title.'</strong>';
$toc .= html_writer::tag('strong', $title);
} else {
$toc .= '<a title="'.s($title).'" href="view.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'">'.$title.'</a>';
$toc .= html_writer::link(new moodle_url('view.php', array('id' => $cm->id, 'chapterid' => $ch->id)), $title, array('title' => s($title)));
}
$toc .= (!$ch->subchapter) ? '<ul>' : '</li>';
if (!$ch->subchapter) {
$toc .= html_writer::start_tag('ul');
} else {
$toc .= html_writer::end_tag('li');
}
$first = 0;
}
}
$toc .= '</ul></li></ul>';
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::end_tag('ul');
}
$toc .= '</div>';
$toc .= html_writer::end_tag('div');
$toc = str_replace('<ul></ul>', '', $toc); // Cleanup of invalid structures.

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
.mod_book .book_chapter_title {
.path-mod-book .book_chapter_title {
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
text-align: left;
font-size: large;
@ -9,7 +9,7 @@
margin-bottom: 20px;
}
.mod_book img.bigicon {
.path-mod-book img.bigicon {
vertical-align: middle;
margin-right: 4px;
margin-left: 4px;
@ -18,100 +18,100 @@
border: 0px;
}
.mod_book .navtop {
.path-mod-book .navtop {
text-align: right;
margin-bottom: 0.5em;
}
.mod_book .navbottom {
.path-mod-book .navbottom {
text-align: right;
}
/* == Fake toc block == */
/* toc style NONE */
.mod_book .book_toc_none {
.path-mod-book .book_toc_none {
font-size: 0.8em;
}
.mod_book .book_toc_none ul {
.path-mod-book .book_toc_none ul {
margin-left: 5px;
padding-left: 0px;
}
.mod_book .book_toc_none ul ul {
.path-mod-book .book_toc_none ul ul {
margin-left: 0px;
padding-left: 0px;
}
.mod_book .book_toc_none li {
.path-mod-book .book_toc_none li {
margin-top: 5px;
list-style: none;
}
.mod_book .book_toc_none li li {
.path-mod-book .book_toc_none li li {
margin-top: 0px;
list-style: none;
}
/* toc style NUMBERED */
.mod_book .book_toc_numbered {
.path-mod-book .book_toc_numbered {
font-size: 0.8em;
}
.mod_book .book_toc_numbered ul {
.path-mod-book .book_toc_numbered ul {
margin-left: 5px;
padding-left: 0px;
}
.mod_book .book_toc_numbered ul ul {
.path-mod-book .book_toc_numbered ul ul {
margin-left: 0px;
padding-left: 0px;
}
.mod_book .book_toc_numbered li {
.path-mod-book .book_toc_numbered li {
margin-top: 5px;
list-style: none;
}
.mod_book .book_toc_numbered li li {
.path-mod-book .book_toc_numbered li li {
margin-top: 0px;
list-style: none;
}
/*toc style BULLETS */
.mod_book .book_toc_bullets {
.path-mod-book .book_toc_bullets {
font-size: 0.8em;
}
.mod_book .book_toc_bullets ul {
.path-mod-book .book_toc_bullets ul {
margin-left: 5px;
padding-left: 0px;
}
.mod_book .book_toc_bullets ul ul {
.path-mod-book .book_toc_bullets ul ul {
margin-left: 20px;
padding-left: 0px;
}
.mod_book .book_toc_bullets li {
.path-mod-book .book_toc_bullets li {
margin-top: 5px;
list-style: none;
}
.mod_book .book_toc_bullets li li {
.path-mod-book .book_toc_bullets li li {
margin-top: 0px;
list-style: circle;
}
/* toc style INDENTED*/
.mod_book .book_toc_indented {
.path-mod-book .book_toc_indented {
font-size: 0.8em;
}
.mod_book .book_toc_indented ul {
.path-mod-book .book_toc_indented ul {
margin-left: 5px;
padding-left: 0px;
}
.mod_book .book_toc_indented ul ul {
.path-mod-book .book_toc_indented ul ul {
margin-left: 15px;
padding-left: 0px;
}
.mod_book .book_toc_indented li {
.path-mod-book .book_toc_indented li {
margin-top: 5px;
list-style: none;
}
.mod_book .book_toc_indented li li {
.path-mod-book .book_toc_indented li li {
margin-top: 0px;
list-style: none;
}

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -44,10 +44,6 @@ $context = context_module::instance($cm->id);
require_capability('mod/book:read', $context);
require_capability('booktool/exportimscp:export', $context);
$strbooks = get_string('modulenameplural', 'book');
$strbook = get_string('modulename', 'book');
$strtop = get_string('top', 'book');
add_to_log($course->id, 'book', 'exportimscp', 'tool/exportimscp/index.php?id='.$cm->id, $book->id, $cm->id);
$file = booktool_exportimscp_build_package($book, $context);

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -31,11 +31,7 @@ defined('MOODLE_INTERNAL') || die;
* @param navigation_node $node The node to add module settings to
*/
function booktool_exportimscp_extend_settings_navigation(settings_navigation $settings, navigation_node $node) {
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
if ($PAGE->cm->modname !== 'book') {
return;
}
global $PAGE;
if (has_capability('booktool/exportimscp:export', $PAGE->cm->context)) {
$url = new moodle_url('/mod/book/tool/exportimscp/index.php', array('id'=>$PAGE->cm->id));

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -48,9 +48,8 @@ if ($chapterid) {
$chapter = false;
}
$PAGE->set_title(format_string($book->name));
$PAGE->add_body_class('mod_book');
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title($book->name);
$PAGE->set_heading($course->fullname);
// Prepare the page header.
$strbook = get_string('modulename', 'mod_book');

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -31,11 +31,7 @@ defined('MOODLE_INTERNAL') || die;
* @param navigation_node $node The node to add module settings to
*/
function booktool_importhtml_extend_settings_navigation(settings_navigation $settings, navigation_node $node) {
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
if ($PAGE->cm->modname !== 'book') {
return;
}
global $PAGE;
if (has_capability('booktool/importhtml:import', $PAGE->cm->context)) {
$url = new moodle_url('/mod/book/tool/importhtml/index.php', array('id'=>$PAGE->cm->id));

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -33,12 +33,7 @@ defined('MOODLE_INTERNAL') || die;
function booktool_print_extend_settings_navigation(settings_navigation $settings, navigation_node $node) {
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
if ($PAGE->cm->modname !== 'book') {
return;
}
$params = $PAGE->url->params();
if (empty($params['id']) or empty($params['chapterid'])) {
return;
}

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -45,43 +45,67 @@ function booktool_print_get_toc($chapters, $book, $cm) {
switch ($book->numbering) {
case BOOK_NUM_NONE:
$toc .= '<div class="book_toc_none">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_none'));
break;
case BOOK_NUM_NUMBERS:
$toc .= '<div class="book_toc_numbered">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered'));
break;
case BOOK_NUM_BULLETS:
$toc .= '<div class="book_toc_bullets">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets'));
break;
case BOOK_NUM_INDENTED:
$toc .= '<div class="book_toc_indented">';
$toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented'));
break;
}
$toc .= '<a name="toc"></a>'; // Representation of toc (HTML).
$toc .= html_writer::tag('a', '', array('name' => 'toc')); // Representation of toc (HTML).
if ($book->customtitles) {
$toc .= '<h1>'.get_string('toc', 'mod_book').'</h1>';
$toc .= html_writer::tag('h1', get_string('toc', 'mod_book'));
} else {
$toc .= '<p class="book_chapter_title">'.get_string('toc', 'mod_book').'</p>';
$toc .= html_writer::tag('p', get_string('toc', 'mod_book'), array('class' => 'book_chapter_title'));
}
$toc .= '<ul>';
$toc .= html_writer::start_tag('ul');
foreach ($chapters as $ch) {
if (!$ch->hidden) {
$title = book_get_chapter_title($ch->id, $chapters, $book, $context);
if (!$ch->subchapter) {
$toc .= $first ? '<li>' : '</ul></li><li>';
if ($first) {
$toc .= html_writer::start_tag('li');
} else {
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::start_tag('li');
}
} else {
$toc .= $first ? '<li><ul><li>' : '<li>';
if ($first) {
$toc .= html_writer::start_tag('li');
$toc .= html_writer::start_tag('ul');
$toc .= html_writer::start_tag('li');
} else {
$toc .= html_writer::start_tag('li');
}
}
$titles[$ch->id] = $title;
$toc .= '<a title="'.s($title).'" href="#ch'.$ch->id.'">'.$title.'</a>';
$toc .= (!$ch->subchapter) ? '<ul>' : '</li>';
$toc .= html_writer::link(new moodle_url('#ch'.$ch->id), $title, array('title' => s($title)));
if (!$ch->subchapter) {
$toc .= html_writer::start_tag('ul');
} else {
$toc .= html_writer::end_tag('li');
}
$first = false;
}
}
$toc .= '</ul></li></ul>';
$toc .= '</div>';
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('li');
$toc .= html_writer::end_tag('ul');
$toc .= html_writer::end_tag('div');
$toc = str_replace('<ul></ul>', '', $toc); // Cleanup of invalid structures.
return array($toc, $titles);

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
// This file is part of Book module for Moodle - http://moodle.org/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -114,9 +114,8 @@ $strbook = get_string('modulename', 'mod_book');
$strtoc = get_string('toc', 'mod_book');
// prepare header
$PAGE->set_title(format_string($book->name));
$PAGE->add_body_class('mod_book');
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title($book->name);
$PAGE->set_heading($course->fullname);
book_add_fake_block($chapters, $chapter, $book, $cm, $edit);