diff --git a/mod/book/locallib.php b/mod/book/locallib.php index 95028054c28..bc52dc7a204 100644 --- a/mod/book/locallib.php +++ b/mod/book/locallib.php @@ -166,7 +166,7 @@ function book_add_fake_block($chapters, $chapter, $book, $cm, $edit) { $bc = new block_contents(); $bc->title = get_string('toc', 'mod_book'); - $bc->attributes['class'] = 'block'; + $bc->attributes['class'] = 'block block_book_toc'; $bc->content = $toc; $regions = $PAGE->blocks->get_regions(); @@ -196,16 +196,16 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { switch ($book->numbering) { case BOOK_NUM_NONE: - $toc .= html_writer::start_tag('div', array('class' => 'book_toc_none')); + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_none clearfix')); break; case BOOK_NUM_NUMBERS: - $toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered')); + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered clearfix')); break; case BOOK_NUM_BULLETS: - $toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets')); + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets clearfix')); break; case BOOK_NUM_INDENTED: - $toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented')); + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented clearfix')); break; } @@ -218,11 +218,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { if (!$ch->subchapter) { if ($first) { - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } else { $toc .= html_writer::end_tag('ul'); $toc .= html_writer::end_tag('li'); - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } if (!$ch->hidden) { @@ -240,11 +240,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { } else { if ($first) { - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); $toc .= html_writer::start_tag('ul'); - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } else { - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } if (!$ch->hidden) { @@ -269,7 +269,8 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { } else { $toc .= html_writer::link(new moodle_url('view.php', array('id' => $cm->id, 'chapterid' => $ch->id)), $title, array('title' => s($title))); } - $toc .= '  '; + + $toc .= html_writer::start_tag('div', array('class' => 'action-list')); if ($i != 1) { $toc .= html_writer::link(new moodle_url('move.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'up' => '1', 'sesskey' => $USER->sesskey)), $OUTPUT->pix_icon('t/up', get_string('up')), array('title' => get_string('up'))); @@ -291,7 +292,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { } $toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'pagenum' => $ch->pagenum, 'subchapter' => $ch->subchapter)), $OUTPUT->pix_icon('add', get_string('addafter', 'mod_book'), 'mod_book'), array('title' => get_string('addafter', 'mod_book'))); - + $toc .= html_writer::end_tag('div'); if (!$ch->subchapter) { $toc .= html_writer::start_tag('ul'); @@ -315,11 +316,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { $ns = 0; if ($first) { - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } else { $toc .= html_writer::end_tag('ul'); $toc .= html_writer::end_tag('li'); - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } if ($book->numbering == BOOK_NUM_NUMBERS) { @@ -329,11 +330,11 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { $ns++; if ($first) { - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); $toc .= html_writer::start_tag('ul'); - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } else { - $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('li', array('class' => 'clearfix')); } if ($book->numbering == BOOK_NUM_NUMBERS) { diff --git a/mod/book/styles.css b/mod/book/styles.css index 39b941717cd..b868560f841 100644 --- a/mod/book/styles.css +++ b/mod/book/styles.css @@ -5,113 +5,104 @@ font-size: large; font-weight: bold; - margin-left: 0px; + margin-left: 0; margin-bottom: 20px; } - -.path-mod-book img.bigicon { - vertical-align: middle; - margin-right: 4px; - margin-left: 4px; - width: 24px; - height: 24px; - border: 0px; +.dir-rtl.path-mod-book .book_chapter_title { + text-align: right; } +.path-mod-book .navtop img.icon, +.path-mod-book .navbotton img.icon { + margin-right: 4px; + margin-left: 4px; + border: 0; + padding: 0; +} + + +.path-mod-book .navbottom, .path-mod-book .navtop { text-align: right; +} +.dir-rtl.path-mod-book .navbottom, +.dir-rtl.path-mod-book .navtop { + text-align: left; +} +.path-mod-book .navtop { margin-bottom: 0.5em; } -.path-mod-book .navbottom { - text-align: right; -} - /* == Fake toc block == */ +.path-mod-book .block_book_toc ul { + margin: 0 0 0 5px; + padding-left: 0; + padding-right: 0; +} +.dir-rtl.path-mod-book .block_book_toc ul { margin: 0 5px 0 0; } +.path-mod-book .block_book_toc li { + clear: both; + list-style: none; + margin-top: .5em; +} +.path-mod-book .block_book_toc li li { + list-style: none; +} +.path-mod-book .block_book_toc .action-list { float: right; } +.dir-rtl.path-mod-book .block_book_toc .action-list { float: left; } +.path-mod-book .block_book_toc .action-list img.smallicon { + margin: 0 3px; +} + /* toc style NONE */ .path-mod-book .book_toc_none { font-size: 0.8em; } -.path-mod-book .book_toc_none ul { - margin-left: 5px; - padding-left: 0px; +.path-mod-book .book_toc_none ul ul, +.dir-rtl.path-mod-book .book_toc_none ul ul { + margin-left: 0; + margin-right: 0; } -.path-mod-book .book_toc_none ul ul { - margin-left: 0px; - padding-left: 0px; -} -.path-mod-book .book_toc_none li { - margin-top: 5px; - list-style: none; -} -.path-mod-book .book_toc_none li li { - margin-top: 0px; - list-style: none; -} - /* toc style NUMBERED */ .path-mod-book .book_toc_numbered { font-size: 0.8em; } -.path-mod-book .book_toc_numbered ul { - margin-left: 5px; - padding-left: 0px; -} -.path-mod-book .book_toc_numbered ul ul { - margin-left: 0px; - padding-left: 0px; -} -.path-mod-book .book_toc_numbered li { - margin-top: 5px; - list-style: none; -} -.path-mod-book .book_toc_numbered li li { - margin-top: 0px; - list-style: none; -} - /*toc style BULLETS */ .path-mod-book .book_toc_bullets { font-size: 0.8em; } -.path-mod-book .book_toc_bullets ul { - margin-left: 5px; - padding-left: 0px; -} .path-mod-book .book_toc_bullets ul ul { margin-left: 20px; - padding-left: 0px; } -.path-mod-book .book_toc_bullets li { - margin-top: 5px; - list-style: none; +.dir-rtl.path-mod-book .book_toc_bullets ul ul { + margin-left: 0; + margin-right: 20px; } .path-mod-book .book_toc_bullets li li { - margin-top: 0px; list-style: circle; } - /* toc style INDENTED*/ .path-mod-book .book_toc_indented { font-size: 0.8em; } .path-mod-book .book_toc_indented ul { margin-left: 5px; - padding-left: 0px; +} +.dir-rtl.path-mod-book .book_toc_indented ul { + margin-left: 0; + margin-right: 5px; } .path-mod-book .book_toc_indented ul ul { margin-left: 15px; - padding-left: 0px; } -.path-mod-book .book_toc_indented li { - margin-top: 5px; - list-style: none; +.dir-rtl.path-mod-book .book_toc_indented ul ul { + margin-left: 0; + margin-right: 15px; } .path-mod-book .book_toc_indented li li { - margin-top: 0px; list-style: none; } diff --git a/mod/book/view.php b/mod/book/view.php index af131a0950e..cf9ed5512b8 100644 --- a/mod/book/view.php +++ b/mod/book/view.php @@ -142,21 +142,25 @@ foreach ($chapters as $ch) { $last = $ch->id; } +$navprevicon = right_to_left() ? 'nav_next' : 'nav_prev'; +$navnexticon = right_to_left() ? 'nav_prev' : 'nav_next'; +$navprevdisicon = right_to_left() ? 'nav_next_dis' : 'nav_prev_dis'; + $chnavigation = ''; if ($previd) { $chnavigation .= ''.get_string('navprev', 'book').''; + '&chapterid='.$previd.'">'.get_string('navprev', 'book').''; } else { - $chnavigation .= ''; + $chnavigation .= ''; } if ($nextid) { $chnavigation .= ''.get_string('navnext', 'book').''; + '&chapterid='.$nextid.'">'.get_string('navnext', 'book').''; } else { $sec = $DB->get_field('course_sections', 'section', array('id' => $cm->section)); $returnurl = course_get_url($course, $sec); $chnavigation .= ''.get_string('navexit', 'book').''; + '" class="icon" alt="'.get_string('navexit', 'book').'" />'; // we are cheating a bit here, viewing the last page means user has viewed the whole book $completion = new completion_info($course);