mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-32857 course: single topic summary rewriting pluginfile urls
This commit is contained in:
parent
e16e2300c5
commit
7cb8bfdb5c
1 changed files with 20 additions and 10 deletions
|
@ -146,16 +146,9 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$o.= html_writer::start_tag('div', array('class' => 'summary'));
|
$o.= html_writer::start_tag('div', array('class' => 'summary'));
|
||||||
|
$o.= $this->format_summary_text($section);
|
||||||
|
|
||||||
$context = context_course::instance($section->course);
|
$context = context_course::instance($course->id);
|
||||||
$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);
|
|
||||||
|
|
||||||
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
|
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
|
||||||
$url = new moodle_url('/course/editsection.php', array('id'=>$section->id));
|
$url = new moodle_url('/course/editsection.php', array('id'=>$section->id));
|
||||||
|
|
||||||
|
@ -277,7 +270,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||||
$o.= html_writer::end_tag('a');
|
$o.= html_writer::end_tag('a');
|
||||||
|
|
||||||
$o.= html_writer::start_tag('div', array('class' => 'summarytext'));
|
$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('div');
|
$o.= html_writer::end_tag('div');
|
||||||
$o.= html_writer::end_tag('li');
|
$o.= html_writer::end_tag('li');
|
||||||
|
@ -576,4 +569,21 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue