Skip to content
GitLab
Menu
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
1d6f6615
Commit
1d6f6615
authored
Nov 12, 2020
by
Peter Dias
Browse files
MDL-64776 book: Final deprecation booktool_print_get_toc
parent
6ef4e66f
Changes
2
Hide whitespace changes
Inline
Side-by-side
mod/book/tool/print/locallib.php
View file @
1d6f6615
...
...
@@ -28,85 +28,9 @@ require_once(__DIR__.'/lib.php');
require_once
(
$CFG
->
dirroot
.
'/mod/book/locallib.php'
);
/**
* Generate toc structure and titles
*
* @deprecated since Moodle 3.7
* @param array $chapters
* @param stdClass $book
* @param stdClass $cm
* @return array
*/
function
booktool_print_get_toc
(
$chapters
,
$book
,
$cm
)
{
debugging
(
'booktool_print_get_toc() is deprecated. Please use booktool_print renderer
function render_print_book_toc().'
,
DEBUG_DEVELOPER
);
$first
=
true
;
$titles
=
array
();
$context
=
context_module
::
instance
(
$cm
->
id
);
$toc
=
''
;
// Representation of toc (HTML).
switch
(
$book
->
numbering
)
{
case
BOOK_NUM_NONE
:
$toc
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'book_toc_none'
));
break
;
case
BOOK_NUM_NUMBERS
:
$toc
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'book_toc_numbered'
));
break
;
case
BOOK_NUM_BULLETS
:
$toc
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'book_toc_bullets'
));
break
;
case
BOOK_NUM_INDENTED
:
$toc
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'book_toc_indented'
));
break
;
}
$toc
.
=
html_writer
::
tag
(
'a'
,
''
,
array
(
'name'
=>
'toc'
));
// Representation of toc (HTML).
$toc
.
=
html_writer
::
tag
(
'h2'
,
get_string
(
'toc'
,
'mod_book'
));
$toc
.
=
html_writer
::
start_tag
(
'ul'
);
foreach
(
$chapters
as
$ch
)
{
if
(
!
$ch
->
hidden
)
{
$title
=
book_get_chapter_title
(
$ch
->
id
,
$chapters
,
$book
,
$context
);
if
(
!
$ch
->
subchapter
)
{
if
(
$first
)
{
$toc
.
=
html_writer
::
start_tag
(
'li'
);
}
else
{
$toc
.
=
html_writer
::
end_tag
(
'ul'
);
$toc
.
=
html_writer
::
end_tag
(
'li'
);
$toc
.
=
html_writer
::
start_tag
(
'li'
);
}
}
else
{
if
(
$first
)
{
$toc
.
=
html_writer
::
start_tag
(
'li'
);
$toc
.
=
html_writer
::
start_tag
(
'ul'
);
$toc
.
=
html_writer
::
start_tag
(
'li'
);
}
else
{
$toc
.
=
html_writer
::
start_tag
(
'li'
);
}
}
$titles
[
$ch
->
id
]
=
$title
;
$toc
.
=
html_writer
::
link
(
new
moodle_url
(
'#ch'
.
$ch
->
id
),
$title
,
array
(
'title'
=>
s
(
$title
)));
if
(
!
$ch
->
subchapter
)
{
$toc
.
=
html_writer
::
start_tag
(
'ul'
);
}
else
{
$toc
.
=
html_writer
::
end_tag
(
'li'
);
}
$first
=
false
;
}
}
$toc
.
=
html_writer
::
end_tag
(
'ul'
);
$toc
.
=
html_writer
::
end_tag
(
'li'
);
$toc
.
=
html_writer
::
end_tag
(
'ul'
);
$toc
.
=
html_writer
::
end_tag
(
'div'
);
$toc
=
str_replace
(
'<ul></ul>'
,
''
,
$toc
);
// Cleanup of invalid structures.
return
array
(
$toc
,
$titles
);
function
booktool_print_get_toc
()
{
throw
new
coding_exception
(
__FUNCTION__
.
' can not be used any more. Please use booktool_print renderer
function render_print_book_toc().'
);
}
mod/book/upgrade.txt
View file @
1d6f6615
This files describes API changes in the book code.
=== 3.11 ===
* Final deprecation - booktool_print_get_toc(). Please use render_print_book_toc() instead.
=== 3.8 ===
* The following functions have been finally deprecated and can not be used anymore:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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