MDL-58365 block_myoverview: Show course summary in plain text

Part of MDL-55611 epic.
This commit is contained in:
Jun Pataleta 2017-03-23 16:06:41 +08:00 committed by Dan Poltawski
parent c755cb354c
commit aac4653365
4 changed files with 9 additions and 5 deletions

View File

@ -57,14 +57,16 @@ class course_summary implements renderable, templatable {
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return stdClass
* @return array
*/
public function export_for_template(renderer_base $output) {
$data = [];
foreach ($this->courses as $courseid => $value) {
foreach ($this->courses as $courseid => $course) {
$context = \context_course::instance($courseid);
$exporter = new course_summary_exporter($this->courses[$courseid], array('context' => $context));
// Convert summary to plain text.
$course->summary = content_to_text($course->summary, false);
$exporter = new course_summary_exporter($course, array('context' => $context));
$exportedcourse = $exporter->export($output);
if (isset($this->coursesprogress[$courseid])) {

View File

@ -77,6 +77,8 @@ 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
]);

View File

@ -56,6 +56,6 @@
{{/enddate}}
</p>
<p class="text-muted">
{{#shortentext}} 140, {{{summary}}}{{/shortentext}}
{{#shortentext}} 140, {{summary}}{{/shortentext}}
</p>
</div>

View File

@ -54,7 +54,7 @@
{{/enddate}}
</p>
<p class="text-muted">
{{#shortentext}} 140, {{{summary}}}{{/shortentext}}
{{#shortentext}} 140, {{summary}}{{/shortentext}}
</p>
</div>
</div>