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 qbank_columnsortorder/column_sort_ui
|
|
|
19 |
|
|
|
20 |
Display a list of enable columns with customisation controls, and a list of columns from disabled plugins, with a link to the
|
|
|
21 |
question bank plugin management screen.
|
|
|
22 |
|
|
|
23 |
Context variables required for this template:
|
|
|
24 |
* contextid - Current context id.
|
|
|
25 |
* formaction - The URL of the actions controller to submit the form to.
|
|
|
26 |
* sesskey - The current sesskey.
|
|
|
27 |
* previewurl - The URL of the question bank preview page.
|
|
|
28 |
* addcolumn - The context for the qbank_columnsortorder/add_column template.
|
|
|
29 |
* resetcolumns - The context for the qbank_columnsortorder/reset_columns template.
|
|
|
30 |
* names - A list of the currently active columns
|
|
|
31 |
* name - The display name of the column
|
|
|
32 |
* tiptitle - The tooltip text for the move handle.
|
|
|
33 |
* colname - The unique class name for the column from the plugin.
|
|
|
34 |
* escapedclass - The class name with \ replaced by __.
|
|
|
35 |
* widthlabel - The label text of for this column's width field.
|
|
|
36 |
* minwidth - The minimum value for the width field.
|
|
|
37 |
* width - The current value for the width field.
|
|
|
38 |
* actionmenu - The context for core/action_menu, a list of actions for the column.
|
|
|
39 |
* columnsdisabled - Are the any columns defined by disabled plugins?
|
|
|
40 |
* disabled - A list of disabled column names.
|
|
|
41 |
* disabledname - The disabled column's name.
|
|
|
42 |
* urltomanageqbanks - Link to the page for managing qbank plugins.
|
|
|
43 |
|
|
|
44 |
Example context (json):
|
|
|
45 |
{
|
|
|
46 |
"contextid": 1,
|
|
|
47 |
"formaction": "https://example.com/question/bank/columnsortorder/actions.php",
|
|
|
48 |
"sesskey": "12345abcde",
|
|
|
49 |
"previewurl": "https://example.com/question/bank/columnsortorder/sortcolumns.php?preview=1",
|
|
|
50 |
"addcolumn": {
|
|
|
51 |
"hashiddencolumns": true,
|
|
|
52 |
"hiddencolumns": [
|
|
|
53 |
{
|
|
|
54 |
"name": "Column A",
|
|
|
55 |
"class": "class_name_A",
|
|
|
56 |
"addurl": "/question/bank/columnsortorder/actions.php?action=add&column=class_name_A"
|
|
|
57 |
},
|
|
|
58 |
{
|
|
|
59 |
"name": "Column B",
|
|
|
60 |
"class": "class_name_B",
|
|
|
61 |
"addurl": "/question/bank/columnsortorder/actions.php?action=add&column=class_name_B"
|
|
|
62 |
}
|
|
|
63 |
]
|
|
|
64 |
},
|
|
|
65 |
"resetcolumns": {
|
|
|
66 |
"reseturl": "https://example.com/question/bank/columnsortorder/actions.php?action=reset"
|
|
|
67 |
},
|
|
|
68 |
"names": [
|
|
|
69 |
{
|
|
|
70 |
"name": "Column A",
|
|
|
71 |
"tiptitle": "Move Column A",
|
|
|
72 |
"columnid": "qbank_example\\col_name_A-col_name_A",
|
|
|
73 |
"escapedid": "qbank_example__col_name_A-col_name_A",
|
|
|
74 |
"widthlabel": "Width of Column A",
|
|
|
75 |
"minwidth": "10",
|
|
|
76 |
"width": ""
|
|
|
77 |
},
|
|
|
78 |
{
|
|
|
79 |
"name": "Column B",
|
|
|
80 |
"tiptitle": "Move Column B",
|
|
|
81 |
"columnid": "qbank_example\\col_name_B-col_name_B",
|
|
|
82 |
"escapedid": "qbank_example__col_name_B-col_name_B",
|
|
|
83 |
"minwidth": "10",
|
|
|
84 |
"width": "200"
|
|
|
85 |
}
|
|
|
86 |
],
|
|
|
87 |
"columnsdisabled": true,
|
|
|
88 |
"disabled": [
|
|
|
89 |
{
|
|
|
90 |
"disabledname": "disabled_1"
|
|
|
91 |
},
|
|
|
92 |
{
|
|
|
93 |
"disabledname": "disabled_2"
|
|
|
94 |
}
|
|
|
95 |
],
|
|
|
96 |
"urltomanageqbanks": "<a href=\"https://example.com/admin/manageqbankplugins.php\">Manage qbank plugins</a>"
|
|
|
97 |
}
|
|
|
98 |
}}
|
|
|
99 |
<div id="qbank_columnsortorder-{{uniqid}}" {{!
|
|
|
100 |
}}class="container" {{!
|
|
|
101 |
}}data-component="qbank_columnsortorder" {{!
|
|
|
102 |
}}data-callback="column_sort_ui" {{!
|
|
|
103 |
}}data-contextid="{{contextid}}">
|
|
|
104 |
<p>
|
|
|
105 |
{{#str}}qbanksortdescription, qbank_columnsortorder{{/str}}
|
|
|
106 |
</p>
|
|
|
107 |
<form class="has-validation" action="{{formaction}}" method="post">
|
|
|
108 |
<input type="hidden" name="sesskey" value="{{sesskey}}">{{!
|
|
|
109 |
}}<div class="d-grid gap-2 d-md-flex justify-content-between mb-2">
|
|
|
110 |
<div>
|
|
|
111 |
<a class="btn btn-primary" href="{{previewurl}}">
|
|
|
112 |
{{#str}}preview{{/str}}
|
|
|
113 |
</a>
|
|
|
114 |
{{#addcolumn}}
|
|
|
115 |
{{>qbank_columnsortorder/add_column}}
|
|
|
116 |
{{/addcolumn}}
|
|
|
117 |
</div>
|
|
|
118 |
{{#resetcolumns}}
|
|
|
119 |
{{>qbank_columnsortorder/reset_columns}}
|
|
|
120 |
{{/resetcolumns}}
|
|
|
121 |
</div>
|
|
|
122 |
<table class="generaltable table table-fixed">
|
|
|
123 |
<thead>
|
|
|
124 |
<tr>
|
|
|
125 |
<th scope="col"></th>
|
|
|
126 |
<th scope="col">{{#str}}name{{/str}}</th>
|
|
|
127 |
<th scope="col">{{#str}}plugin{{/str}}</th>
|
|
|
128 |
<th scope="col" class="w-25">{{#str}}columnwidth, qbank_columnsortorder{{/str}}</th>
|
|
|
129 |
<th scope="col">{{#str}}action{{/str}}</th>
|
|
|
130 |
</tr>
|
|
|
131 |
</thead>
|
|
|
132 |
<tbody class="qbank-column-list">
|
|
|
133 |
{{#names}}
|
|
|
134 |
<tr class="qbank-sortable-column" data-pluginname="{{class}}" data-name="{{name}}" data-columnid="{{columnid}}">
|
|
|
135 |
<td>{{>core/drag_handle}}</td>
|
|
|
136 |
<td>{{name}}</td>
|
|
|
137 |
<td>{{colname}}</td>
|
|
|
138 |
<td>
|
|
|
139 |
<div class="input-group">
|
|
|
140 |
<label class="sr-only" for="width_{{escapedid}}">{{widthlabel}}</label>
|
|
|
141 |
<input id="width_{{escapedid}}" {{!
|
|
|
142 |
}}class="form-control width-input" {{!
|
|
|
143 |
}}type="number" {{!
|
|
|
144 |
}}min="{{minwidth}}" {{!
|
|
|
145 |
}}name="width[{{escapedid}}]" {{!
|
|
|
146 |
}}placeholder="{{#str}}auto, qbank_columnsortorder{{/str}}" {{!
|
|
|
147 |
}}value="{{width}}">
|
|
|
148 |
<button class="btn btn-sm btn-outline-dark savewidths" type="submit" name="action" value="savewidths">
|
|
|
149 |
{{#str}}save{{/str}}
|
|
|
150 |
</button>
|
|
|
151 |
<div class="invalid-feedback">
|
|
|
152 |
{{#str}}invalidwidth, qbank_columnsortorder, {{minwidth}}{{/str}}
|
|
|
153 |
</div>
|
|
|
154 |
</div>
|
|
|
155 |
</td>
|
|
|
156 |
<td>{{#actionmenu}}{{>core/action_menu}}{{/actionmenu}}</td>
|
|
|
157 |
</tr>
|
|
|
158 |
{{/names}}
|
|
|
159 |
</tbody>
|
|
|
160 |
</table>
|
|
|
161 |
</form>
|
|
|
162 |
<div>
|
|
|
163 |
{{#columnsdisabled}}
|
|
|
164 |
{{#str}}qbankcolumnsdisabled, qbank_columnsortorder{{/str}}
|
|
|
165 |
<br>
|
|
|
166 |
{{/columnsdisabled}}
|
|
|
167 |
{{#disabled}}
|
|
|
168 |
<div class="list-group-item disabled">
|
|
|
169 |
{{disabledname}}
|
|
|
170 |
</div>
|
|
|
171 |
{{/disabled}}
|
|
|
172 |
</div>
|
|
|
173 |
<div>
|
|
|
174 |
{{{urltomanageqbanks}}}
|
|
|
175 |
</div>
|
|
|
176 |
{{#js}}
|
|
|
177 |
require(['qbank_columnsortorder/admin_actions'], function(AdminTable) {
|
|
|
178 |
AdminTable.init("qbank_columnsortorder-{{uniqid}}");
|
|
|
179 |
});
|
|
|
180 |
{{/js}}
|
|
|
181 |
</div>
|