MDL-33767 Course: General section displays its title when required

This commit is contained in:
Frederic Massart
2012-07-17 22:28:13 +08:00
committed by Aparup Banerjee
parent 483d768bc0
commit a64fbc87b6
2 changed files with 24 additions and 2 deletions
+8 -2
View File
@@ -151,7 +151,13 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
$o.= html_writer::tag('div', $rightcontent, array('class' => 'right side'));
$o.= html_writer::start_tag('div', array('class' => 'content'));
if (!$onsectionpage) {
// When not on a section page, we display the section titles except the general section if null
$hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name)));
// When on a section page, we only display the general section title, if title is not the default one
$hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name)));
if ($hasnamenotsecpg || $hasnamesecpg) {
$o.= $this->output->heading($this->section_title($section, $course), 3, 'sectionname');
}
@@ -642,7 +648,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
$thissection = $sections[0];
unset($sections[0]);
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
echo $this->section_header($thissection, $course, true);
echo $this->section_header($thissection, $course, false);
print_section($course, $thissection, $mods, $modnamesused, true);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, 0, $modnames);
+16
View File
@@ -1376,7 +1376,16 @@ function get_print_section_cm_text(cm_info $cm, $course) {
/**
* Prints a section full of activity modules
*
* @param stdClass $course The course
* @param stdClass $section The section
* @param array $mods The modules in the section
* @param array $modnamesused An array containing the list of modules and their names
* @param bool $absolute All links are absolute
* @param string $width Width of the container
* @param bool $hidecompletion Hide completion status
* @param int $sectionreturn The section to return to
* @return void
*/
function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%", $hidecompletion=false, $sectionreturn=0) {
global $CFG, $USER, $DB, $PAGE, $OUTPUT;
@@ -1757,7 +1766,14 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
/**
* Prints the menus to add activities and resources.
*
* @param stdClass $course The course
* @param stdClass $section The section
* @param array $modnames An array containing the list of modules and their names
* @param bool $vertical Vertical orientation
* @param bool $return Return the menus or send them to output
* @param int $sectionreturn The section to link back to
* @return void|string depending on $return
*/
function print_section_add_menus($course, $section, $modnames, $vertical=false, $return=false, $sectionreturn=0) {
global $CFG, $OUTPUT;