| 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 forumreport_summary/bulk_action_menu
|
|
|
19 |
|
|
|
20 |
Summary report filters.
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"showbulkactions": true,
|
|
|
25 |
"id": "formactionid",
|
|
|
26 |
"attributes": [
|
|
|
27 |
{
|
|
|
28 |
"name": "data-action",
|
|
|
29 |
"value": "toggle"
|
|
|
30 |
},
|
|
|
31 |
{
|
|
|
32 |
"name": "data-togglegroup",
|
|
|
33 |
"value": "summaryreport-table"
|
|
|
34 |
},
|
|
|
35 |
{
|
|
|
36 |
"name": "data-toggle",
|
|
|
37 |
"value": "action"
|
|
|
38 |
}
|
|
|
39 |
],
|
|
|
40 |
"actions": [
|
|
|
41 |
{
|
|
|
42 |
"name": "Choose...",
|
|
|
43 |
"value": ""
|
|
|
44 |
},
|
|
|
45 |
{
|
|
|
46 |
"name": "Send a message",
|
|
|
47 |
"value": "#messageselect"
|
|
|
48 |
}
|
|
|
49 |
],
|
|
|
50 |
"perpage": {
|
|
|
51 |
"name": "perpage",
|
|
|
52 |
"method": "get",
|
|
|
53 |
"action": "#",
|
|
|
54 |
"classes": "singleselect",
|
|
|
55 |
"label": "Per page",
|
|
|
56 |
"formid": "randomid",
|
|
|
57 |
"id": "selectperpage",
|
|
|
58 |
"options":[
|
|
|
59 |
{"value": 50, "name": "50", "selected": true},
|
|
|
60 |
{"value": 100, "name": "100", "selected":false},
|
|
|
61 |
{"value": 200, "name": "200", "selected": false}
|
|
|
62 |
]
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
}}
|
|
|
66 |
|
|
|
67 |
<br />
|
|
|
68 |
<div class="d-inline-block w-100">
|
|
|
69 |
{{#showbulkactions}}
|
| 1441 |
ariadna |
70 |
<div class="buttons float-start">
|
|
|
71 |
<div class="d-flex flex-wrap align-items-center ps-1">
|
| 1 |
efrain |
72 |
<label for="{{id}}">{{#str}}withselectedusers{{/str}}</label>
|
| 1441 |
ariadna |
73 |
<select id="{{id}}" class="select form-select ms-4" {{#attributes}}{{name}}="{{value}}" {{/attributes}}>
|
| 1 |
efrain |
74 |
<option value="">{{#str}}choosedots{{/str}}</option>
|
|
|
75 |
{{#actions}}
|
|
|
76 |
<option value="{{value}}">{{name}}</option>
|
|
|
77 |
{{/actions}}
|
|
|
78 |
</select>
|
|
|
79 |
</div>
|
|
|
80 |
</div>
|
|
|
81 |
{{/showbulkactions}}
|
| 1441 |
ariadna |
82 |
<div class="float-end">
|
| 1 |
efrain |
83 |
{{#perpage}}
|
|
|
84 |
{{> core/single_select}}
|
|
|
85 |
{{/perpage}}
|
|
|
86 |
</div>
|
|
|
87 |
</div>
|
|
|
88 |
|
|
|
89 |
{{#js}}
|
|
|
90 |
require(['jquery', 'core_message/message_send_bulk', 'core/custom_interaction_events'], function($, BulkSender, CustomEvents) {
|
|
|
91 |
CustomEvents.define('#{{id}}', [CustomEvents.events.accessibleChange]);
|
|
|
92 |
$('#{{id}}').on(CustomEvents.events.accessibleChange, function(e) {
|
|
|
93 |
var action = $(e.target).val();
|
|
|
94 |
if (action.indexOf('#') !== -1) {
|
|
|
95 |
e.preventDefault();
|
|
|
96 |
|
|
|
97 |
var ids = $('#summaryreport input.usercheckbox:checked').map(function(index, element) {
|
|
|
98 |
return element.name.replace('user', '');
|
|
|
99 |
}).get();
|
|
|
100 |
|
|
|
101 |
if (action == '#messageselect') {
|
|
|
102 |
BulkSender.showModal(ids, function() {
|
|
|
103 |
$('#{{id}}').focus();
|
|
|
104 |
});
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
$('#{{id}} option[value=""]').prop('selected', 'selected');
|
|
|
108 |
}
|
|
|
109 |
});
|
|
|
110 |
});
|
|
|
111 |
{{/js}}
|