Commit 2975523a authored by Petr Skoda's avatar Petr Skoda
Browse files

CONTRIB-3616 Book module do not display icon for book and chapter print

Credit goes to Peter Svec, thanks.
parent bcb4958e
......@@ -26,32 +26,32 @@
defined('MOODLE_INTERNAL') || die;
function booktool_print_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) {
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
if ($PAGE->cm->modname !== 'book') {
return;
}
if ($PAGE->cm->modname !== 'book') {
return;
}
if (empty($PAGE->cm->context)) {
if (empty($PAGE->cm->context)) {
$PAGE->cm->context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->instance);
}
}
$params = $PAGE->url->params();
$params = $PAGE->url->params();
if (empty($params['id']) or empty($params['chapterid'])) {
return;
}
if (empty($params['id']) or empty($params['chapterid'])) {
return;
}
if (has_capability('booktool/print:print', $PAGE->cm->context)) {
$url1 = new moodle_url('/mod/book/tool/print/index.php', array('id'=>$params['id']));
$url2 = new moodle_url('/mod/book/tool/print/index.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid']));
$action = new action_link($url1, get_string('printbook', 'booktool_print'), new popup_action('click', $url1));
$booknode->add('', $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('book', '', 'booktool_print', array('class'=>'icon')));
$action = new action_link($url2, get_string('printchapter', 'booktool_print'), new popup_action('click', $url2));
$booknode->add('', $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('chapter', '', 'booktool_print', array('class'=>'icon')));
}
if (has_capability('booktool/print:print', $PAGE->cm->context)) {
$url1 = new moodle_url('/mod/book/tool/print/index.php', array('id'=>$params['id']));
$url2 = new moodle_url('/mod/book/tool/print/index.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid']));
$action = new action_link($url1, get_string('printbook', 'booktool_print'), new popup_action('click', $url1));
$booknode->add(get_string('printbook', 'booktool_print'), $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('book', '', 'booktool_print', array('class'=>'icon')));
$action = new action_link($url2, get_string('printchapter', 'booktool_print'), new popup_action('click', $url2));
$booknode->add(get_string('printchapter', 'booktool_print'), $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('chapter', '', 'booktool_print', array('class'=>'icon')));
}
}
/**
......
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