Permalink
Browse files

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

  • Loading branch information...
1 parent 483d768 commit a64fbc87b6808d8a31a20c240415e89eccea25f7 @FMCorz FMCorz committed with nebgor Jun 29, 2012
Showing with 24 additions and 2 deletions.
  1. +8 −2 course/format/renderer.php
  2. +16 −0 course/lib.php
View
@@ -151,7 +151,13 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
$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 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
$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);
View
@@ -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;

0 comments on commit a64fbc8

Please sign in to comment.