Skip to content

Commit

Permalink
Added new {coursesummary} tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Nov 8, 2020
1 parent 7da63d5 commit 0d2973a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0d2973a

Please sign in to comment.