1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
|
5 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
6 |
(at your option) any later version.
|
|
|
7 |
Moodle is distributed in the hope that it will be useful,
|
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
10 |
GNU General Public License for more details.
|
|
|
11 |
You should have received a copy of the GNU General Public License
|
|
|
12 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
13 |
}}
|
|
|
14 |
{{!
|
|
|
15 |
@template mod_data/presets
|
|
|
16 |
|
|
|
17 |
Form containing all database presets displayed within a table.
|
|
|
18 |
|
|
|
19 |
Context variables required for this template:
|
|
|
20 |
* formactionurl - The form action url.
|
|
|
21 |
* id - The database course module id (cmid).
|
|
|
22 |
* presets - List of presets containing id, name, fullname, shortname and actions.
|
|
|
23 |
|
|
|
24 |
Example context (json):
|
|
|
25 |
{
|
|
|
26 |
"formactionurl": "http://www.example.com",
|
|
|
27 |
"id": 1,
|
|
|
28 |
"presets": [
|
|
|
29 |
{
|
|
|
30 |
"id": 1,
|
|
|
31 |
"cmid": 1,
|
|
|
32 |
"name": "Image gallery",
|
|
|
33 |
"shortname": "imagegallery",
|
|
|
34 |
"fullname": "Image gallery",
|
|
|
35 |
"description": "Use this preset to collect images",
|
|
|
36 |
"userid": 0,
|
|
|
37 |
"url": "http://www.example.com",
|
|
|
38 |
"actions": [],
|
|
|
39 |
"presetindex": 0
|
|
|
40 |
},
|
|
|
41 |
{
|
|
|
42 |
"id": 2,
|
|
|
43 |
"cmid": 2,
|
|
|
44 |
"name": "Preset saved manually",
|
|
|
45 |
"shortname": "Preset saved manually",
|
|
|
46 |
"fullname": "Preset saved manually (admin)",
|
|
|
47 |
"userid": 2,
|
|
|
48 |
"url": "http://www.example.com",
|
|
|
49 |
"actions": [],
|
|
|
50 |
"presetindex": 1
|
|
|
51 |
}
|
|
|
52 |
]
|
|
|
53 |
}
|
|
|
54 |
}}
|
|
|
55 |
{{#str}}presetshelp, mod_data{{/str}}
|
|
|
56 |
|
|
|
57 |
<form method="post" action="{{formactionurl}}" class="mt-4">
|
|
|
58 |
<input type="hidden" name="id" value="{{id}}">
|
|
|
59 |
<input type="hidden" name="mode" value="usepreset">
|
|
|
60 |
<input type="hidden" name="action" value="select">
|
|
|
61 |
|
|
|
62 |
<fieldset>
|
|
|
63 |
<legend class="sr-only">{{#str}}presets, mod_data{{/str}}</legend>
|
|
|
64 |
<table id="presets-list" class="generaltable fullwidth">
|
|
|
65 |
<thead>
|
|
|
66 |
<tr>
|
|
|
67 |
<th class="pl-4 border-top-0" scope="col" style="width: 3%">
|
|
|
68 |
<span class="sr-only">{{#str}}select{{/str}}</span>
|
|
|
69 |
</th>
|
|
|
70 |
<th class="pl-4 border-top-0" scope="col" style="width:30%">{{#str}} name {{/str}}</th>
|
|
|
71 |
<th class="pl-4 border-top-0" scope="col">{{#str}} description {{/str}}</th>
|
|
|
72 |
<th class="pl-4 border-top-0" scope="col" style="width: 3%">
|
|
|
73 |
<span class="sr-only">{{#str}}actions{{/str}}</span>
|
|
|
74 |
</th>
|
|
|
75 |
</tr>
|
|
|
76 |
</thead>
|
|
|
77 |
<tbody>
|
|
|
78 |
{{#presets}}
|
|
|
79 |
<tr>
|
|
|
80 |
<td class="p-4 border-right">
|
|
|
81 |
<input type="radio" name="fullname" value="{{userid}}/{{shortname}}" data-cmid="{{cmid}}" aria-labelledby="preset-name-{{presetindex}}" >
|
|
|
82 |
</td>
|
|
|
83 |
<td class="p-4">
|
|
|
84 |
<a id="preset-name-{{presetindex}}" href="{{{url}}}">{{fullname}}</a>
|
|
|
85 |
</td>
|
|
|
86 |
<td class="p-4">{{description}}</td>
|
|
|
87 |
<td class="p-4 preset_action_menu">
|
|
|
88 |
{{#actions}}
|
|
|
89 |
<div class="float-right">
|
|
|
90 |
{{>core/action_menu}}
|
|
|
91 |
</div>
|
|
|
92 |
{{/actions}}
|
|
|
93 |
</td>
|
|
|
94 |
</tr>
|
|
|
95 |
{{/presets}}
|
|
|
96 |
</tbody>
|
|
|
97 |
</table>
|
|
|
98 |
</fieldset>
|
|
|
99 |
|
|
|
100 |
{{< core/sticky_footer }}
|
|
|
101 |
{{$ stickycontent }}
|
|
|
102 |
<input
|
|
|
103 |
type="submit"
|
|
|
104 |
name="selectpreset"
|
|
|
105 |
data-action="selectpreset"
|
|
|
106 |
value="{{#str}}usepreset, mod_data{{/str}}"
|
|
|
107 |
class="btn btn-secondary"
|
|
|
108 |
disabled
|
|
|
109 |
>
|
|
|
110 |
{{/ stickycontent }}
|
|
|
111 |
{{/ core/sticky_footer }}
|
|
|
112 |
</form>
|
|
|
113 |
|
|
|
114 |
{{#js}}
|
|
|
115 |
require(['mod_data/selectpreset'], function(selectPreset) {
|
|
|
116 |
selectPreset.init();
|
|
|
117 |
});
|
|
|
118 |
|
|
|
119 |
require(['mod_data/editpreset'], function(editPreset) {
|
|
|
120 |
editPreset.init();
|
|
|
121 |
});
|
|
|
122 |
require(['mod_data/importmappingdialogue'], function(importPreset) {
|
|
|
123 |
importPreset.init();
|
|
|
124 |
});
|
|
|
125 |
{{/js}}
|