From 58ee763bfb6c2425f57a32d94736357dd53e6101 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Mon, 10 Sep 2012 15:44:21 +0800 Subject: [PATCH] MDL-33198 book: Adding h tags to book titles to increase accessibility while printing a book --- mod/book/tool/print/index.php | 13 +++++++++---- mod/book/tool/print/locallib.php | 6 +----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mod/book/tool/print/index.php b/mod/book/tool/print/index.php index 9077b84a9c3..f33f9a11ad7 100644 --- a/mod/book/tool/print/index.php +++ b/mod/book/tool/print/index.php @@ -91,6 +91,7 @@ if ($chapter) { +

name, true, array('context'=>$context)) ?>

customtitles) { if (!$chapter->subchapter) { $currtitle = book_get_chapter_title($chapter->id, $chapters, $book, $context); - echo '

'.$currtitle.'

'; + echo '

'.$currtitle.'

'; } else { $currtitle = book_get_chapter_title($chapters[$chapter->id]->parent, $chapters, $book, $context); $currsubtitle = book_get_chapter_title($chapter->id, $chapters, $book, $context); - echo '

'.$currtitle.'
'.$currsubtitle.'

'; + echo '

'.$currtitle.'

'.$currsubtitle.'

'; } } @@ -128,7 +129,7 @@ if ($chapter) { -

name, true, array('context'=>$context)) ?>

+

name, true, array('context'=>$context)) ?>

intro, $book->introformat, array('noclean'=>true, 'context'=>$context)) ?>

@@ -162,7 +163,11 @@ if ($chapter) { } echo '
'; if (!$book->customtitles) { - echo '

'.$titles[$ch->id].'

'; + if (!$chapter->subchapter) { + echo '

'.$titles[$ch->id].'

'; + } else { + echo '

'.$titles[$ch->id].'

'; + } } $content = str_replace($link1, '#ch', $chapter->content); $content = str_replace($link2, '#top', $content); diff --git a/mod/book/tool/print/locallib.php b/mod/book/tool/print/locallib.php index 200bee74867..27838a9ff2e 100644 --- a/mod/book/tool/print/locallib.php +++ b/mod/book/tool/print/locallib.php @@ -60,11 +60,7 @@ function booktool_print_get_toc($chapters, $book, $cm) { $toc .= html_writer::tag('a', '', array('name' => 'toc')); // Representation of toc (HTML). - if ($book->customtitles) { - $toc .= html_writer::tag('h1', get_string('toc', 'mod_book')); - } else { - $toc .= html_writer::tag('p', get_string('toc', 'mod_book'), array('class' => 'book_chapter_title')); - } + $toc .= html_writer::tag('h2', get_string('toc', 'mod_book'), array('class' => 'book_chapter_title')); $toc .= html_writer::start_tag('ul'); foreach ($chapters as $ch) { if (!$ch->hidden) { -- 2.17.1