Permalink
Browse files

MDL-32770 course: fixed section title and footer

  • Loading branch information...
1 parent e16e230 commit 36be7e145329656f0ab690f29c3d9a239f424349 Rajesh Taneja committed May 10, 2012
Showing with 35 additions and 22 deletions.
  1. +28 −20 course/format/renderer.php
  2. +1 −0 lang/en/moodle.php
  3. +6 −2 theme/base/style/course.css
View
@@ -322,7 +322,7 @@ protected function course_activity_clipboard($course, $sectionno = 0) {
* @param stdClass $course The course entry from DB
* @param array $sections The course_sections entries from the DB
* @param int $sectionno The section number in the coruse which is being dsiplayed
- * @return string HTML to output.
+ * @return array associative array with previous and next section link
*/
protected function get_nav_links($course, $sections, $sectionno) {
// FIXME: This is really evil and should by using the navigation API.
@@ -333,28 +333,24 @@ protected function get_nav_links($course, $sections, $sectionno) {
$back = $sectionno - 1;
while ($back > 0 and empty($links['previous'])) {
if ($canviewhidden || $sections[$back]->visible) {
- $links['previous'] = html_writer::link(course_get_url($course, $back),
- $this->output->larrow().$this->output->spacer().get_section_name($course, $sections[$back]));
+ $previouslink = html_writer::tag('span', $this->output->larrow(), array('class' => 'larrow'));
+ $previouslink .= get_section_name($course, $sections[$back]);
+ $links['previous'] = html_writer::link(course_get_url($course, $back), $previouslink);
}
$back--;
}
$forward = $sectionno + 1;
while ($forward <= $course->numsections and empty($links['next'])) {
if ($canviewhidden || $sections[$forward]->visible) {
- $links['next'] = html_writer::link(course_get_url($course, $forward),
- get_section_name($course, $sections[$forward]).$this->output->spacer().$this->output->rarrow());
+ $nextlink = get_section_name($course, $sections[$forward]);
+ $nextlink .= html_writer::tag('span', $this->output->rarrow(), array('class' => 'rarrow'));
+ $links['next'] = html_writer::link(course_get_url($course, $forward), $nextlink);
}
$forward++;
}
- $o = '';
- $o.= html_writer::start_tag('div', array('class' => 'section-navigation yui3-g'));
- $o.= html_writer::tag('div', $links['previous'], array('class' => 'yui3-u'));
- $o.= html_writer::tag('div', $links['next'], array('class' => 'right yui3-u'));
- $o.= html_writer::end_tag('div');
-
- return $o;
+ return $links;
}
/**
@@ -449,16 +445,19 @@ public function print_single_section_page($course, $sections, $mods, $modnames,
echo $this->end_section_list();
}
- // Section next/previous links.
+ // Title with section navigation links.
$sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection);
- echo $sectionnavlinks;
-
-
- // Title with completion help icon.
+ $sectiontitle = '';
+ $sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation headingblock header'));
+ $sectiontitle .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
+ $sectiontitle .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
+ $sectiontitle .= html_writer::tag('div', get_section_name($course, $sections[$displaysection]), array('class' => 'mdl-align'));
+ $sectiontitle .= html_writer::end_tag('div');
+ echo $sectiontitle;
+
+ // Show completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
- $title = get_section_name($course, $sections[$displaysection]);
- echo $this->output->heading($title, 2, 'headingblock header outline');
// Copy activity clipboard..
echo $this->course_activity_clipboard($course, $displaysection);
@@ -474,8 +473,17 @@ public function print_single_section_page($course, $sections, $mods, $modnames,
print_section_add_menus($course, $displaysection, $modnames);
}
echo $this->section_footer();
- echo $sectionnavlinks;
echo $this->end_section_list();
+
+ // Display section bottom navigation.
+ $courselink = html_writer::link(course_get_url($course), get_string('returntomaincoursepage'));
+ $sectionbottomnav = '';
+ $sectionbottomnav .= html_writer::start_tag('div', array('class' => 'section-navigation mdl-bottom'));
+ $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
+ $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
+ $sectionbottomnav .= html_writer::tag('div', $courselink, array('class' => 'mdl-align'));
+ $sectionbottomnav .= html_writer::end_tag('div');
+ echo $sectionbottomnav;
}
/**
View
@@ -1392,6 +1392,7 @@
$string['restoreusersprecheckerror'] = 'Some problems were detected when checking user data';
$string['restricted'] = 'Restricted';
$string['returningtosite'] = 'Returning to this web site?';
+$string['returntomaincoursepage'] = 'Return to main course page';
$string['returntooriginaluser'] = 'Return to {$a}';
$string['revert'] = 'Revert';
$string['role'] = 'Role';
@@ -11,8 +11,12 @@
.course-content .section-summary { border: 1px solid #DDD; margin-top: 5px; }
.course-content .section-summary .section-title { margin: 2px 5px 2px 5px; }
.course-content .section-summary .summarytext { margin: 2px 5px 2px 5px; }
-.course-content .section-navigation { display: block; padding: 10px; }
-.course-content .section-navigation .right { float: right; }
+.course-content .section-navigation { display: block; padding: 0.5em; margin-top: 1em; margin-bottom: -0.5em !important; }
+.course-content .section-navigation .mdl-left { float: left; font-weight: normal; margin-right: 1em; }
+.course-content .section-navigation .mdl-left .larrow { margin-right: 0.1em; }
+.course-content .section-navigation .mdl-right { float: right; font-weight: normal; margin-left: 1em; }
+.course-content .section-navigation .mdl-right .rarrow { margin-left: 0.1em; }
+.course-content .section-navigation .mdl-bottom { font-weight: normal; margin-top: 0; }
#page-site-index .subscribelink {text-align:right;}
#page-site-index .headingblock {margin-bottom: 9px;}

0 comments on commit 36be7e1

Please sign in to comment.