1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template tool_courserating/summary_for_cfield
|
|
|
19 |
|
|
|
20 |
This template is used to generate content for the custom course profile field that shows course rating.
|
|
|
21 |
Because the content of the custom course profile field is purified, it is not allowed to use any data-
|
|
|
22 |
attributes. The course id is included as a part of a 'class' attribute.
|
|
|
23 |
|
|
|
24 |
Example context (json):
|
|
|
25 |
{
|
|
|
26 |
"avgrating": "3.6",
|
|
|
27 |
"stars": {
|
|
|
28 |
"staricons": [
|
|
|
29 |
{"key": "star", "component": "tool_courserating", "title": ""},
|
|
|
30 |
{"key": "star", "component": "tool_courserating", "title": ""},
|
|
|
31 |
{"key": "star", "component": "tool_courserating", "title": ""},
|
|
|
32 |
{"key": "star-half", "component": "tool_courserating", "title": ""},
|
|
|
33 |
{"key": "star-o", "component": "tool_courserating", "title": ""}
|
|
|
34 |
]
|
|
|
35 |
},
|
|
|
36 |
"courseid": "2",
|
|
|
37 |
"cntall": "15"
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
}}
|
|
|
41 |
{{#cntall}}
|
|
|
42 |
<span class="tool_courserating-cfield"><a
|
|
|
43 |
class="tool_courserating-ratings tool_courserating-ratings-courseid-{{courseid}}"
|
|
|
44 |
title="{{#str}}pluginname, tool_courserating{{/str}}"
|
|
|
45 |
href="#">{{#stars}}{{> tool_courserating/stars }}{{/stars}}<span
|
|
|
46 |
class="course-average-value tool_courserating-ratingcolor ml-2">{{avgrating}}</span><span
|
|
|
47 |
class="ml-2 course-rating-cntall">({{cntall}})</span></a></span>
|
|
|
48 |
{{/cntall}}
|
|
|
49 |
{{#displayempty}}
|
|
|
50 |
{{^cntall}}
|
|
|
51 |
<span class="tool_courserating-cfield"><a
|
|
|
52 |
class="tool_courserating-ratings tool_courserating-ratings-courseid-{{courseid}} tool_courserating-norating"
|
|
|
53 |
href="#">{{#stars}}{{> tool_courserating/stars }}{{/stars}}</a></span>
|
|
|
54 |
{{/cntall}}
|
|
|
55 |
{{/displayempty}}
|