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_supporter/enrolusersection
|
|
|
19 |
Template which adds an enrol user function for the selected course and user
|
|
|
20 |
|
|
|
21 |
Classes required for JS:
|
|
|
22 |
* none
|
|
|
23 |
|
|
|
24 |
Context variables required for this template:
|
|
|
25 |
* assignableRoles - array of arrays: roles which can be assigned when enrolling.
|
|
|
26 |
|
|
|
27 |
Example context (json):
|
|
|
28 |
{
|
|
|
29 |
"assignableRoles": [
|
|
|
30 |
{
|
|
|
31 |
"id": 5,
|
|
|
32 |
"name": "Teilnehmer/in"
|
|
|
33 |
},
|
|
|
34 |
{
|
|
|
35 |
"id": 1,
|
|
|
36 |
"name": "Manager/in"
|
|
|
37 |
},
|
|
|
38 |
{
|
|
|
39 |
"id": 3,
|
|
|
40 |
"name": "Trainer/in"
|
|
|
41 |
},
|
|
|
42 |
{
|
|
|
43 |
"id": 4,
|
|
|
44 |
"name": "Trainer/in ohne Bearbeitungsrecht"
|
|
|
45 |
}
|
|
|
46 |
]
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
}}
|
|
|
50 |
|
|
|
51 |
<div id="enrolusersection" data-region="enroluserregion" style="display: none; padding-left: 5px;">
|
|
|
52 |
|
|
|
53 |
<div class="btn-toolbar" role="toolbar">
|
|
|
54 |
<div class="btn-group" role="group">
|
|
|
55 |
<button type="button" class="btn btn-primary mr-1" id ="enroluserintocoursebutton">{{#str}}enrolusers, enrol{{/str}}</button>
|
|
|
56 |
</div>
|
|
|
57 |
<div class="btn-group" role="group">
|
|
|
58 |
<select class="form-control custom-select" id="role-dropdown">
|
|
|
59 |
{{#assignableRoles}}
|
|
|
60 |
<option value={{id}}>{{name}}</option>
|
|
|
61 |
{{/assignableRoles}}
|
|
|
62 |
</select>
|
|
|
63 |
</div>
|
|
|
64 |
</div>
|
|
|
65 |
|
|
|
66 |
</div>
|
|
|
67 |
|
|
|
68 |
{{#js}}
|
|
|
69 |
require(['tool_supporter/enrol'], function(enrol) {
|
|
|
70 |
enrol.enrolUserIntoCourse();
|
|
|
71 |
});
|
|
|
72 |
{{/js}}
|