Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
2975523a
Commit
2975523a
authored
Apr 27, 2012
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
tool/print/lib.php
View file @
2975523a
...
...
@@ -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'
)));
}
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment