1441 |
ariadna |
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 core_question/question_category_selector
|
|
|
19 |
|
|
|
20 |
Template for core_question\output\question_category_selector
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"categories": [
|
|
|
25 |
{
|
|
|
26 |
"value": "0",
|
|
|
27 |
"disabled": true,
|
|
|
28 |
"label": "Bank name 1"
|
|
|
29 |
},
|
|
|
30 |
{
|
|
|
31 |
"value": "123,456",
|
|
|
32 |
"selected": true,
|
|
|
33 |
"label": "Category 1"
|
|
|
34 |
},
|
|
|
35 |
{
|
|
|
36 |
"value": "124,456",
|
|
|
37 |
"label": "Category 2"
|
|
|
38 |
}
|
|
|
39 |
]
|
|
|
40 |
}
|
|
|
41 |
}}
|
|
|
42 |
<div class="question_category_selector">
|
|
|
43 |
<label for="selectcategory{{uniqid}}" class="visually-hidden">{{#str}} questioncategory, core_question {{/str}}</label>
|
|
|
44 |
<select id="selectcategory{{uniqid}}" class="selectcategory" name="selectcategory">
|
|
|
45 |
{{#banks}}
|
|
|
46 |
<optgroup label="{{bankname}}">
|
|
|
47 |
{{#categories}}
|
|
|
48 |
<option value="{{idcontext}}"{{#selected}} selected{{/selected}}>{{{category}}}</option>
|
|
|
49 |
{{/categories}}
|
|
|
50 |
</optgroup>
|
|
|
51 |
{{/banks}}
|
|
|
52 |
{{#categories}}
|
|
|
53 |
<option {{!
|
|
|
54 |
}}value="{{value}}"{{!
|
|
|
55 |
}}{{#disabled}} disabled class="suggestions-heading"{{/disabled}}{{!
|
|
|
56 |
}}{{#selected}} selected{{/selected}}>
|
|
|
57 |
{{{label}}}
|
|
|
58 |
</option>
|
|
|
59 |
{{/categories}}
|
|
|
60 |
</select>
|
|
|
61 |
</div>
|