MDL-32508 course/format: Display general section above title

This commit is contained in:
Dan Poltawski 2012-04-30 12:16:55 +08:00
parent 803e36e105
commit 243b7003e3

View File

@ -413,10 +413,6 @@ abstract class format_renderer_base extends plugin_renderer_base {
public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection) {
global $PAGE;
// Section next/previous links.
$sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection);
echo $sectionnavlinks;
// Can we view the section in question?
$context = context_course::instance($course->id);
$canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
@ -432,6 +428,24 @@ abstract class format_renderer_base extends plugin_renderer_base {
return;
}
// General section if non-empty.
$thissection = $sections[0];
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true);
print_section($course, $thissection, $mods, $modnamesused, true);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, 0, $modnames);
}
echo $this->section_footer();
echo $this->end_section_list();
}
// Section next/previous links.
$sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection);
echo $sectionnavlinks;
// Title with completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
@ -444,17 +458,6 @@ abstract class format_renderer_base extends plugin_renderer_base {
// Now the list of sections..
echo $this->start_section_list();
// General section if non-empty.
$thissection = $sections[0];
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
echo $this->section_header($thissection, $course, true);
print_section($course, $thissection, $mods, $modnamesused, true);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, 0, $modnames);
}
echo $this->section_footer();
}
// The requested section page.
$thissection = $sections[$displaysection];
echo $this->section_header($thissection, $course, true);