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 |
|
|
|
19 |
@template tool_supporter/create_new_course
|
|
|
20 |
Template which outputs a form to create a new course in a selected course category.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Context variables required for this template:
|
|
|
26 |
* categories - array of arrays: path, id and name of categories.
|
|
|
27 |
|
|
|
28 |
Example context (json):
|
|
|
29 |
{
|
|
|
30 |
"categories": [
|
|
|
31 |
{
|
|
|
32 |
"id": "4",
|
|
|
33 |
"path": "4",
|
|
|
34 |
"name": " \/ Top Level 1"
|
|
|
35 |
},
|
|
|
36 |
{
|
|
|
37 |
"id": "7",
|
|
|
38 |
"path": "4\/7",
|
|
|
39 |
"name": " \/ Top Level 1 \/ Level 1.1"
|
|
|
40 |
},
|
|
|
41 |
{
|
|
|
42 |
"id": "5",
|
|
|
43 |
"path": "5",
|
|
|
44 |
"name": " \/ Top Level 2"
|
|
|
45 |
},
|
|
|
46 |
{
|
|
|
47 |
"id": "6",
|
|
|
48 |
"path": "5\/6",
|
|
|
49 |
"name": " \/ Top Level 2 \/ Level 2.1"
|
|
|
50 |
}
|
|
|
51 |
],
|
|
|
52 |
"config": {
|
|
|
53 |
"startdate": "01.10.2018",
|
|
|
54 |
"enddate": "31.04.2019"
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
}}
|
|
|
59 |
|
|
|
60 |
<div data-region="create_new_course_section" id="create_new_course_section" style="display: none;">
|
|
|
61 |
<form>
|
|
|
62 |
<div class="form-group row">
|
|
|
63 |
<label for="new_course_full_name_input" class="col-sm-4 col-form-label">{{#str}}fullnamecourse{{/str}}:</label>
|
|
|
64 |
<div class="col-sm-8">
|
|
|
65 |
<input type="text" class="form-control" id="new_course_full_name_input" placeholder="{{#str}}fullnamecourse{{/str}}">
|
|
|
66 |
</div>
|
|
|
67 |
</div>
|
|
|
68 |
<div class="form-group row">
|
|
|
69 |
<label for="new_course_short_name_input" class="col-sm-4 col-form-label">{{#str}}shortnamecourse{{/str}}:</label>
|
|
|
70 |
<div class="col-sm-8">
|
|
|
71 |
<input type="text" class="form-control" id="new_course_short_name_input" placeholder="{{#str}}shortnamecourse{{/str}}">
|
|
|
72 |
</div>
|
|
|
73 |
</div>
|
|
|
74 |
<div class="form-group row">
|
|
|
75 |
<label for="new_course_category_input" class="col-sm-4 col-form-label">{{#str}}categories{{/str}}:</label>
|
|
|
76 |
<div class="col-sm-8">
|
|
|
77 |
<select class="form-control" id="new_course_category_input">
|
|
|
78 |
{{#categories}}
|
|
|
79 |
<option value="{{id}}">{{name}}</option>
|
|
|
80 |
{{/categories}}
|
|
|
81 |
</select>
|
|
|
82 |
</div>
|
|
|
83 |
</div>
|
|
|
84 |
<div class="form-group row">
|
|
|
85 |
<label for="new_course_is_visible" class="col-sm-4 col-form-label">{{#str}}visible{{/str}}:</label>
|
|
|
86 |
<input class="form-control-input col-sm-1" type="checkbox" value="" id="new_course_is_visible">
|
|
|
87 |
</div>
|
|
|
88 |
<div class="form-group row">
|
|
|
89 |
<label for="new_course_is_visible" class="col-sm-4 col-form-label">{{#str}}enable_selfenrolment, tool_supporter{{/str}}:</label>
|
|
|
90 |
<input class="form-control-input col-sm-1" type="checkbox" value="" id="new_course_enable_self">
|
|
|
91 |
<input type="text" class="form-contro col-sm-6" id="new_course_self_password" placeholder="{{#str}}password{{/str}}" disabled>
|
|
|
92 |
</div>
|
|
|
93 |
<div class="form-group row">
|
|
|
94 |
<div class="col-md-12 text-left">
|
|
|
95 |
<input type="button" class="btn btn-primary" id="create_new_course_button" value="{{#str}}addnewcourse{{/str}}"/>
|
|
|
96 |
</div>
|
|
|
97 |
</div>
|
|
|
98 |
{{#config}}
|
|
|
99 |
<div class="form-group row">
|
|
|
100 |
<label class="col-sm-4 col-form-label" for="new_course_startdate_input">{{#str}}startdate{{/str}}:</label>
|
|
|
101 |
<div class="col-sm-8">
|
|
|
102 |
<input type="text" class="form-control" id="new_course_startdate_input" placeholder="{{#str}}startdate{{/str}}" value={{startdate}}>
|
|
|
103 |
</div>
|
|
|
104 |
</div>
|
|
|
105 |
<div class="form-group row">
|
|
|
106 |
<label for="new_course_enddate_input" class="col-sm-4 col-form-label">{{#str}}enddate{{/str}}:</label>
|
|
|
107 |
<div class="col-sm-8">
|
|
|
108 |
<input type="text" class="form-control" id="new_course_enddate_input" placeholder="{{#str}}enddate{{/str}}" value={{enddate}}>
|
|
|
109 |
</div>
|
|
|
110 |
</div>
|
|
|
111 |
{{/config}}
|
|
|
112 |
|
|
|
113 |
</form>
|
|
|
114 |
</div>
|
|
|
115 |
|
|
|
116 |
{{#js}}
|
|
|
117 |
require(['tool_supporter/create_new_course'], function(createNewCourse) {
|
|
|
118 |
createNewCourse.createNewCourse();
|
|
|
119 |
createNewCourse.togglePasswordInput();
|
|
|
120 |
});
|
|
|
121 |
{{/js}}
|