Permalink
Browse files

MDL-32857 course: single topic summary rewriting pluginfile urls

  • Loading branch information...
danpoltawski committed May 9, 2012
1 parent e16e230 commit 7cb8bfdb5c16b5ecf12c869a746d5686b2beae4b
Showing with 20 additions and 10 deletions.
  1. +20 −10 course/format/renderer.php
View
@@ -146,16 +146,9 @@ protected function section_header($section, $course, $onsectionpage) {
}
$o.= html_writer::start_tag('div', array('class' => 'summary'));
$o.= $this->format_summary_text($section);
$context = context_course::instance($section->course);
$summarytext = file_rewrite_pluginfile_urls($section->summary, 'pluginfile.php',
$context->id, 'course', 'section', $section->id);
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
$summaryformatoptions->overflowdiv = true;
$o.= format_text($summarytext, $section->summaryformat, $summaryformatoptions);
$context = context_course::instance($course->id);
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
$url = new moodle_url('/course/editsection.php', array('id'=>$section->id));
@@ -277,7 +270,7 @@ protected function section_summary($section, $course) {
$o.= html_writer::end_tag('a');
$o.= html_writer::start_tag('div', array('class' => 'summarytext'));
$o.= format_text($section->summary, $section->summaryformat);
$o.= $this->format_summary_text($section);
$o.= html_writer::end_tag('div');
$o.= html_writer::end_tag('div');
$o.= html_writer::end_tag('li');
@@ -576,4 +569,21 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
}
}
/**
* Generate html for a section summary text
*
* @param stdClass $section The course_section entry from DB
* @return string HTML to output.
*/
protected function format_summary_text($section) {
$context = context_course::instance($section->course);
$summarytext = file_rewrite_pluginfile_urls($section->summary, 'pluginfile.php',
$context->id, 'course', 'section', $section->id);
$options = new stdClass();
$options->noclean = true;
$options->overflowdiv = true;
return format_text($summarytext, $section->summaryformat, $options);
}
}

0 comments on commit 7cb8bfd

Please sign in to comment.