Merge branch 'MDL-58644-master' of git://github.com/ankitagarwal/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 27 Apr 2017 05:55:02 +0000 (13:55 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 27 Apr 2017 05:55:02 +0000 (13:55 +0800)
blocks/myoverview/classes/output/courses_view.php
course/classes/external/course_summary_exporter.php

index 198deb6..31dc8c6 100644 (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'];
index 113a3c7..342296e 100644 (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(