Merge branch 'MDL-58644-master' of git://github.com/ankitagarwal/moodle

This commit is contained in:
Andrew Nicols 2017-04-27 13:55:02 +08:00
commit ae068eb145
2 changed files with 17 additions and 2 deletions

View File

@ -77,12 +77,12 @@ class courses_view implements renderable, templatable {
$enddate = $course->enddate;
$courseid = $course->id;
$context = \context_course::instance($courseid);
// Convert summary to plain text.
$course->summary = content_to_text($course->summary, false);
$exporter = new course_summary_exporter($course, [
'context' => $context
]);
$exportedcourse = $exporter->export($output);
// Convert summary to plain text.
$exportedcourse->summary = content_to_text($exportedcourse->summary, $exportedcourse->summaryformat);
if (isset($this->coursesprogress[$courseid])) {
$coursecompleted = $this->coursesprogress[$courseid]['completed'];

View File

@ -65,6 +65,9 @@ class course_summary_exporter extends \core\external\exporter {
'type' => PARAM_RAW,
'null' => NULL_ALLOWED
),
'summaryformat' => array(
'type' => PARAM_INT,
),
'startdate' => array(
'type' => PARAM_INT,
),
@ -74,6 +77,18 @@ class course_summary_exporter extends \core\external\exporter {
);
}
/**
* Get the formatting parameters for the summary.
*
* @return array
*/
protected function get_format_parameters_for_summary() {
return [
'component' => 'course',
'filearea' => 'summary',
];
}
public static function define_other_properties() {
return array(
'fullnamedisplay' => array(