MDL-35276 fix redirect to course/section pages

This commit is contained in:
Marina Glancy
2012-09-26 10:58:03 +08:00
parent c366bea3cf
commit 583c0cf67f
6 changed files with 72 additions and 68 deletions
+13 -12
View File
@@ -65,8 +65,9 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
*/
public function section_title($section, $course) {
$title = get_section_name($course, $section);
if ($section->section != 0 && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
$title = html_writer::link(course_get_url($course, $section->section), $title);
$url = course_get_url($course, $section->section, array('navigation' => true));
if ($url) {
$title = html_writer::link($url, $title);
}
return $title;
}
@@ -125,7 +126,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
* @param int $sectionreturn The section to return to after an action
* @return string HTML to output.
*/
protected function section_header($section, $course, $onsectionpage, $sectionreturn=0) {
protected function section_header($section, $course, $onsectionpage, $sectionreturn=null) {
global $PAGE;
$o = '';
@@ -413,7 +414,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
* @param int $sectionno The section number in the coruse which is being dsiplayed
* @return string HTML to output.
*/
protected function course_activity_clipboard($course, $sectionno = 0) {
protected function course_activity_clipboard($course, $sectionno = null) {
global $USER;
$o = '';
@@ -642,7 +643,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
echo $this->output->heading($this->page_title(), 2, 'accesshide');
// Copy activity clipboard..
echo $this->course_activity_clipboard($course);
echo $this->course_activity_clipboard($course, 0);
// Now the list of sections..
echo $this->start_section_list();
@@ -651,10 +652,10 @@ 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, false);
print_section($course, $thissection, $mods, $modnamesused, true);
echo $this->section_header($thissection, $course, false, 0);
print_section($course, $thissection, $mods, $modnamesused, true, "100%", false, 0);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, 0, $modnames);
print_section_add_menus($course, 0, $modnames, false, false, 0);
}
echo $this->section_footer();
}
@@ -693,11 +694,11 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
// Display section summary only.
echo $this->section_summary($thissection, $course, $mods);
} else {
echo $this->section_header($thissection, $course, false);
echo $this->section_header($thissection, $course, false, 0);
if ($thissection->uservisible) {
print_section($course, $thissection, $mods, $modnamesused);
print_section($course, $thissection, $mods, $modnamesused, true, "100%", false, 0);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, $section, $modnames);
print_section_add_menus($course, $section, $modnames, false, false, 0);
}
}
echo $this->section_footer();
@@ -714,7 +715,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
continue;
}
echo $this->stealth_section_header($section);
print_section($course, $thissection, $mods, $modnamesused);
print_section($course, $thissection, $mods, $modnamesused, true, "100%", false, $displaysection);
echo $this->stealth_section_footer();
}