diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fa8e54..cf666a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - New {ifworkplace}{/ifworkplace} (ALPHA) tags. (Workplace only - in Moodle classic, will not display tags or content). - New {timezone} tag. - New {preferredlanguage} tag. +- New {coursesummary} tag. ### Updated - {courseprogress} and {courseprogressbar} now show zero progress if progress is 0. - {alert} to allow for optional contextual class stying. diff --git a/README.md b/README.md index b00e515..363ad11 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,7 @@ FilterCodes are meant to be entered as regular text in the Moodle WYSIWYG editor * {courseprogressbar}: (ALPHA) Displays course progress status as a status bar. Only works within a course. * {course_fields}: Displays the custom course fields. NOTE: Respects a custom course field's Visible To setting. * {course_field_shortname} : Display's custom course field. Replace "shortname" with the shortname of a custom course field all in lowercase. NOTE: Respects a custom course field's Visible To setting. +* {coursesummary} : Display's the course summary. If placed in a site page, displays the site summary. * {courseimage} : Display's the course image. * {courseparticipantcount} : Displays the number of students enrolled in the current course. * {courseid} or %7Bcourseid%7D : Display a course's ID. @@ -602,6 +603,7 @@ Create a Page on your Moodle site, preferably in a course, so that those tags wo * Other course categories in this categories menu [{categoriesxmenu}]: {categoriesxmenu} * List of custom course fields [{course_fields}]: {course_fields} * Course custom fields [{course_field_location}] (assumes you have created a custom course field called "location"): {course_field_location} +* Course description [{coursesummary}] : {coursesummary} * [{courseimage}] : {courseimage} * Number of participants in the course [{courseparticipantcount}] : {courseparticipantcount} * The base (root) URL of your Moodle site [{wwwroot}]: {wwwroot} diff --git a/filter.php b/filter.php index b802a83..7c3830e 100644 --- a/filter.php +++ b/filter.php @@ -817,6 +817,11 @@ function ($matches) { } } + // Tag: {coursesummary}. + if (stripos($text, '{coursesummary}') !== false) { + $replace['/\{coursesummary\}/i'] = $PAGE->course->summary; + } + // Tag: {courseimage}. The course image. if (stripos($text, '{courseimage') !== false) { $course = $PAGE->course;