Línea 20... |
Línea 20... |
20 |
* @package booktool_print
|
20 |
* @package booktool_print
|
21 |
* @copyright 2004-2011 Petr Skoda {@link http://skodak.org}
|
21 |
* @copyright 2004-2011 Petr Skoda {@link http://skodak.org}
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
23 |
*/
|
23 |
*/
|
Línea 24... |
Línea -... |
24 |
|
- |
|
25 |
defined('MOODLE_INTERNAL') || die;
|
- |
|
26 |
|
24 |
|
27 |
/**
|
25 |
/**
|
28 |
* Adds module specific settings to the settings block
|
26 |
* Adds module specific settings to the settings block
|
29 |
*
|
27 |
*
|
30 |
* @param settings_navigation $settings The settings navigation object
|
28 |
* @param settings_navigation $settings The settings navigation object
|
31 |
* @param navigation_node $node The node to add module settings to
|
29 |
* @param navigation_node $node The node to add module settings to
|
32 |
*/
|
30 |
*/
|
- |
|
31 |
function booktool_print_extend_settings_navigation(settings_navigation $settings, navigation_node $node) {
|
- |
|
32 |
global $OUTPUT;
|
33 |
function booktool_print_extend_settings_navigation(settings_navigation $settings, navigation_node $node) {
|
33 |
|
34 |
$params = $settings->get_page()->url->params();
|
34 |
$params = $settings->get_page()->url->params();
|
35 |
if (empty($params['id']) or empty($params['chapterid'])) {
|
35 |
if (empty($params['id']) || empty($params['chapterid'])) {
|
36 |
return;
|
36 |
return;
|
Línea 37... |
Línea 37... |
37 |
}
|
37 |
}
|
38 |
|
38 |
|
39 |
if (has_capability('booktool/print:print', $settings->get_page()->cm->context)) {
|
39 |
if (has_capability('booktool/print:print', $settings->get_page()->cm->context)) {
|
40 |
$url1 = new moodle_url('/mod/book/tool/print/index.php', array('id'=>$params['id']));
|
40 |
$url1 = new moodle_url('/mod/book/tool/print/index.php', ['id' => $params['id']]);
|
- |
|
41 |
$url2 = new moodle_url('/mod/book/tool/print/index.php', ['id' => $params['id'], 'chapterid' => $params['chapterid']]);
|
- |
|
42 |
$action = new action_link($url1, get_string('printbook', 'booktool_print'), new popup_action('click', $url1));
|
- |
|
43 |
$newwindowtext = html_writer::span(' (' . get_string('opensinnewwindow') . ')', 'visually-hidden');
|
- |
|
44 |
$externalicon = $OUTPUT->pix_icon('i/externallink', '', attributes: [
|
- |
|
45 |
'title' => get_string('opensinnewwindow'),
|
- |
|
46 |
'class' => 'ms-1',
|
- |
|
47 |
]);
|
- |
|
48 |
|
- |
|
49 |
$booknode = $node->add(
|
41 |
$url2 = new moodle_url('/mod/book/tool/print/index.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid']));
|
50 |
// Add both an icon and visualy hidden text to indicate link opens in a new window
|
- |
|
51 |
// because Clean theme strips out the icon html.
|
- |
|
52 |
get_string('printbook', 'booktool_print') . $externalicon . $newwindowtext,
|
- |
|
53 |
$action,
|
- |
|
54 |
navigation_node::TYPE_SETTING,
|
42 |
$action = new action_link($url1, get_string('printbook', 'booktool_print'), new popup_action('click', $url1));
|
55 |
null,
|
- |
|
56 |
'printbook',
|
43 |
$booknode = $node->add(get_string('printbook', 'booktool_print'), $action, navigation_node::TYPE_SETTING, null, 'printbook',
|
57 |
new pix_icon('book', '', 'booktool_print', ['class' => 'icon'])
|
44 |
new pix_icon('book', '', 'booktool_print', array('class' => 'icon')));
|
58 |
);
|
- |
|
59 |
$booknode->set_force_into_more_menu(true);
|
- |
|
60 |
$action = new action_link($url2, get_string('printchapter', 'booktool_print'), new popup_action('click', $url2));
|
- |
|
61 |
$chapternode = $node->add(
|
45 |
$booknode->set_force_into_more_menu(true);
|
62 |
// Add both an icon and visualy hidden text to indicate link opens in a new window
|
- |
|
63 |
// because Clean theme strips out the icon html.
|
- |
|
64 |
get_string('printchapter', 'booktool_print') . $externalicon . $newwindowtext,
|
- |
|
65 |
$action,
|
- |
|
66 |
navigation_node::TYPE_SETTING,
|
46 |
$action = new action_link($url2, get_string('printchapter', 'booktool_print'), new popup_action('click', $url2));
|
67 |
null,
|
- |
|
68 |
'printchapter',
|
47 |
$chapternode = $node->add(get_string('printchapter', 'booktool_print'), $action, navigation_node::TYPE_SETTING, null,
|
69 |
new pix_icon('chapter', '', 'booktool_print', ['class' => 'icon'])
|
48 |
'printchapter', new pix_icon('chapter', '', 'booktool_print', array('class' => 'icon')));
|
70 |
);
|
49 |
$chapternode->set_force_into_more_menu(true);
|
71 |
$chapternode->set_force_into_more_menu(true);
|
Línea 50... |
Línea 72... |
50 |
}
|
72 |
}
|
Línea 58... |
Línea 80... |
58 |
* be considered as view action.
|
80 |
* be considered as view action.
|
59 |
*
|
81 |
*
|
60 |
* @return array
|
82 |
* @return array
|
61 |
*/
|
83 |
*/
|
62 |
function booktool_print_get_view_actions() {
|
84 |
function booktool_print_get_view_actions() {
|
63 |
return array('print');
|
85 |
return ['print'];
|
64 |
}
|
86 |
}
|