{{! This file is part of Moodle - http://moodle.org/ Moodle is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Moodle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Moodle. If not, see . }} {{! @template format_tiles/progress Progress indicator template. The purpose of this template is to render a progress indicator as a radial % indicator or fraction (e.g. 2/3 complete) to be displayed on a tile. Classes required for JS: * none Data attributes required for JS: * none Context variables required for this template: * complete - is the section 100% complete (if yes will show check mark instead of indicator) * tileid - which section / tile are we in * numComplete - how many has user completed * numOutOf - how many activities in this section to complete * showAsPercent - how as percent or numeric * isSingleDigit - is the perentage complete a single digit (if yes, x coordinate is offset to keep in centre of circle) * percent - percentage complte * percentCircumf - how big are the circles * percentOffset - the offset of the second circle which actually shows the progress - see PHP round(((100 - $percentcomplete) / 100) * $CIRCUMFERENCE, 0) * isOverall - if this is an overall progress indicator or not Example context (json): { "complete": false, "tileid": 3, "numComplete": 6, "numOutOf": 10, "showAsPercent": 1, "isSingleDigit": false, "percent": 60, "percentCircumf": 106.8, "percentOffset": 42 } }} {{#isComplete}}
{{#isOverall}}{{#pix}}star-o, format_tiles, {{#str}}allcomplete, format_tiles{{/str}}{{/pix}}{{#str}}allcomplete, format_tiles{{/str}}{{/isOverall}} {{^isOverall}}{{#pix}}check, format_tiles, {{#str}}allcomplete, format_tiles{{/str}}{{/pix}}{{/isOverall}}
{{/isComplete}} {{^isComplete}} {{#numOutOf}} {{! if the progress is out of zero then do not show the indicator at all}} {{#showAsPercent}}
{{#isOverall}}{{#str}}overallprogressshort, format_tiles{{/str}}{{/isOverall}}{{^isOverall}}{{#str}}progress, format_tiles{{/str}}{{/isOverall}} %
{{! two circles, one showing complete and one showing the user's progress }} {{! the numeric percentage in centre of circle }} {{percent}}
{{/showAsPercent}} {{^showAsPercent}}
{{#str}}progress, format_tiles{{/str}}:
{{numComplete}} / {{numOutOf}}
{{/showAsPercent}} {{/numOutOf}} {{/isComplete}}