Printable version of the text to be displayed in the same window

Printable version of the text to be displayed in the same window

by Mari Cruz García -
Number of replies: 2

Hello,

 

I have noticed that when using Firefox and Chrome, when you click on the menu 'Print book' or 'Print Chapter', a new window is displayed and there is no menus of top of the window's browsers, saying 'File Edit View ...' etc.

Some of our students don't have the right IT skills to know how to print from a window broswer.

Is there any way to avoid that situation, for instance, opening a NEW tab within the current window?

Thank you very much for your help.

Average of ratings: -
In reply to Mari Cruz García

Re: Printable version of the text to be displayed in the same window

by Mari Cruz García -

I have found the piece of the code in which the new window is launched, but I don't know how to modify it to prevent this:

$url1 = new moodle_url('/mod/book/print.php', array('id'=>$params['id']));
        $url2 = new moodle_url('/mod/book/print.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid']));
        if ($CFG->version > 2011020900) {
            $action = new action_link($url1, get_string('printbook', 'book'), new popup_action('click', $url1));
            $booknode->add('', $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('print_book', '', 'mod_book', array('class'=>'icon')));
            $action = new action_link($url2, get_string('printchapter', 'book'), new popup_action('click', $url2));
            $booknode->add('', $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('print_chapter', '', 'mod_book', array('class'=>'icon')));
        } else {
            $booknode->add(get_string('printbook', 'mod_book'), $url1, navigation_node::TYPE_SETTING, null, null, new pix_icon('print_book', '', 'mod_book', array('class'=>'icon')));
            $booknode->add(get_string('printchapter', 'mod_book'), $url2, navigation_node::TYPE_SETTING, null, null, new pix_icon('print_chapter', '', 'mod_book', array('class'=>'icon')));
        }
    }

In reply to Mari Cruz García

Re: Printable version of the text to be displayed in the same window

by Mari Cruz García -

Hello,

I have found a way of fixing it, in case it can be of any help to others:

$action = new action_link($url1, get_string('printbook', 'book')  ); /// we don't want any new pop up window.
            $booknode->add('',$action, navigation_node::TYPE_SETTING, null, null, new pix_icon('print_book', '', 'mod_book', array('class'=>'icon')));
            //$action = new action_link($url2, get_string('printchapter', 'book'), new popup_action('click', $url2));
             $action = new action_link($url2, get_string('printchapter', 'book') ); /// we don't want any new pop up window;

Regards