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_lp/user_competency_course_navigation
|
|
|
19 |
|
|
|
20 |
Show an auto-complete for jumping to competencies in a plan.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* groupselector - HTML
|
|
|
24 |
* hasusers
|
|
|
25 |
* users - array
|
|
|
26 |
* id
|
|
|
27 |
* selected
|
|
|
28 |
* fullname
|
|
|
29 |
* hascompetencies
|
|
|
30 |
* competencies - array
|
|
|
31 |
* id
|
|
|
32 |
* selected
|
|
|
33 |
* shortname
|
|
|
34 |
* idnumber
|
|
|
35 |
|
|
|
36 |
// No example context because the JS is connected to webservices
|
|
|
37 |
}}
|
|
|
38 |
<div class="float-sm-right border p-2 mb-2">
|
|
|
39 |
<p>{{{groupselector}}}</p>
|
|
|
40 |
<form class="user-competency-course-navigation">
|
|
|
41 |
<input type="hidden" name="userid" value="{{userid}}"/>
|
|
|
42 |
<input type="hidden" name="competencyid" value="{{competencyid}}"/>
|
|
|
43 |
<input type="hidden" name="courseid" value="{{courseid}}"/>
|
|
|
44 |
{{#hasusers}}
|
|
|
45 |
<span>
|
|
|
46 |
<label for="user-nav-{{uniqid}}" class="accesshide">{{#str}}jumptouser, tool_lp{{/str}}</label>
|
|
|
47 |
<select id="user-nav-{{uniqid}}" class="custom-select">
|
|
|
48 |
{{#users}}
|
|
|
49 |
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{fullname}}</option>
|
|
|
50 |
{{/users}}
|
|
|
51 |
</select>
|
|
|
52 |
</span>
|
|
|
53 |
{{/hasusers}}
|
|
|
54 |
<br>
|
|
|
55 |
{{#hascompetencies}}
|
|
|
56 |
<span>
|
|
|
57 |
<label for="competency-nav-{{uniqid}}" class="accesshide">{{#str}}jumptocompetency, tool_lp{{/str}}</label>
|
|
|
58 |
<select id="competency-nav-{{uniqid}}" class="custom-select">
|
|
|
59 |
{{#competencies}}
|
|
|
60 |
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{{shortname}}} {{idnumber}}</option>
|
|
|
61 |
{{/competencies}}
|
|
|
62 |
</select>
|
|
|
63 |
</span>
|
|
|
64 |
{{/hascompetencies}}
|
|
|
65 |
</form>
|
|
|
66 |
</div>
|
|
|
67 |
{{#js}}
|
|
|
68 |
require(['core/form-autocomplete', 'tool_lp/user_competency_course_navigation'], function(autocomplete, nav) {
|
|
|
69 |
(new nav('#user-nav-{{uniqid}}', '#competency-nav-{{uniqid}}', '{{baseurl}}', {{userid}}, {{competencyid}}, {{courseid}}));
|
|
|
70 |
{{#hasusers}}
|
|
|
71 |
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, {{# quote }}{{# str }}jumptouser, tool_lp{{/ str }}{{/ quote }});
|
|
|
72 |
{{/hasusers}}
|
|
|
73 |
{{#hascompetencies}}
|
|
|
74 |
autocomplete.enhance('#competency-nav-{{uniqid}}', false, false, {{# quote }}{{# str }}jumptocompetency, tool_lp{{/ str }}{{/ quote }});
|
|
|
75 |
{{/hascompetencies}}
|
|
|
76 |
|
|
|
77 |
});
|
|
|
78 |
{{/js}}
|