Commit 4000d6e5 authored by Tobias Nießen's avatar Tobias Nießen
Browse files

MDL-56632 book: position of "Turn editing on/off"

parent 3c45d26f
...@@ -293,15 +293,10 @@ function book_supports($feature) { ...@@ -293,15 +293,10 @@ function book_supports($feature) {
function book_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) { function book_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) {
global $USER, $PAGE, $OUTPUT; global $USER, $PAGE, $OUTPUT;
$plugins = core_component::get_plugin_list('booktool'); if ($booknode->children->count() > 0) {
foreach ($plugins as $plugin => $dir) { $firstkey = $booknode->children->get_key_list()[0];
if (file_exists("$dir/lib.php")) { } else {
require_once("$dir/lib.php"); $firstkey = null;
}
$function = 'booktool_'.$plugin.'_extend_settings_navigation';
if (function_exists($function)) {
$function($settingsnav, $booknode);
}
} }
$params = $PAGE->url->params(); $params = $PAGE->url->params();
...@@ -316,9 +311,21 @@ function book_extend_settings_navigation(settings_navigation $settingsnav, navig ...@@ -316,9 +311,21 @@ function book_extend_settings_navigation(settings_navigation $settingsnav, navig
$edit = '1'; $edit = '1';
} }
$url = new moodle_url('/mod/book/view.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid'], 'edit'=>$edit, 'sesskey'=>sesskey())); $url = new moodle_url('/mod/book/view.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid'], 'edit'=>$edit, 'sesskey'=>sesskey()));
$booknode->add($string, $url, navigation_node::TYPE_SETTING); $editnode = navigation_node::create($string, $url, navigation_node::TYPE_SETTING);
$booknode->add_node($editnode, $firstkey);
$PAGE->set_button($OUTPUT->single_button($url, $string)); $PAGE->set_button($OUTPUT->single_button($url, $string));
} }
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");
}
$function = 'booktool_'.$plugin.'_extend_settings_navigation';
if (function_exists($function)) {
$function($settingsnav, $booknode);
}
}
} }
......
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