Skip to content

Commit

Permalink
CONTRIB-3616 Book module do not display icon for book and chapter print
Browse files Browse the repository at this point in the history
Credit goes to Peter Svec, thanks.
  • Loading branch information
skodak committed Apr 27, 2012
1 parent bcb4958 commit 2975523
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tool/print/lib.php
Expand Up @@ -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')));
}
}

/**
Expand Down

0 comments on commit 2975523

Please sign in to comment.