Skip to content

Commit

Permalink
Added new {diskfreespacedata} tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Jul 3, 2020
1 parent c350832 commit 6b5a9b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
### Added
- New configurable setting to enable/disable escaped [{braces}] (e.g. for creating documentation). Default is enabled.
- You can now escape tags so they are not processed by wrapping them in [{brackets}]. {{double-braces}} are no longer supported.
- New {diskfreespacedata} tag.
- New {diskfreespace} tag.
- New {help}{/help} tags.
- New {info}{/info} tags.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Moodle metadata filters
* {courseimage} : Display's the course image.
* {courseparticipantcount} : Displays the number of students enrolled in the current course.
* {diskfreespace} : Display amount of free disk space for application folder.
* {diskfreespacedata} : Display amount of free disk space for moodledata folder.
* {mycourses} : Display an unordered list of links to all my enrolled courses.
* {mycoursesmenu} : A second level list of courses with links for use in custom menus (filtering must be supported by the theme).
* {categoryid} : If in a course, the ID of the course's parent category, the category ID of a course category page, otherwise 0.
Expand Down Expand Up @@ -507,7 +508,8 @@ Create a Page on your Moodle site and include the following code:
* Course custom fields [{coursefields}]: {coursefields}
* Section ID [{sectionid}]: {sectionid}
* Section ID (encoded) [%7Bsectionid%7D]: %7Bsectionid%7D
* Available free disk space [{diskfreespace}]: {diskfreespace}
* Available free application disk space [{diskfreespace}]: {diskfreespace}
* Available free moodledata disk space [{diskfreespacedata}]: {diskfreespacedata}
* My Enrolled Courses [{mycourses}]: {mycourses}
* My Enrolled Courses menu [{mycoursesmenu}]: {mycoursesmenu}
* Course category ID (0 if not in a course or category list of course) [{categoryid}]: {categoryid}
Expand Down
7 changes: 6 additions & 1 deletion filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,16 @@ function ($matches) {
}
}

// Tag: {diskfreespace}.
// Tag: {diskfreespace} - free space of Moodle application volume.
if (stripos($text, '{diskfreespace}') !== false) {
$replace['/\{diskfreespace\}/i'] = display_size(disk_free_space('.'));
}

// Tag: {diskfreespacedata} - free space of Moodledata volume.
if (stripos($text, '{diskfreespacedata}') !== false) {
$replace['/\{diskfreespacedata\}/i'] = display_size(disk_free_space($CFG->dataroot));
}

// Any {user*} tags.
if (stripos($text, '{user') !== false) {

Expand Down

0 comments on commit 6b5a9b8

Please sign in to comment.