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 core_group/index
|
|
|
19 |
|
|
|
20 |
Template for the Groups page.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Data attributes required for JS:
|
|
|
26 |
* none
|
|
|
27 |
|
|
|
28 |
Context variables required for this template:
|
|
|
29 |
* courseid int The course ID.
|
|
|
30 |
* selectedgroup string The initially selected group.
|
|
|
31 |
* editgroupsettingsdisabled bool Whether to disable the "Edit group settings" button on load.
|
|
|
32 |
* deletegroupdisabled bool Whether to disable the "Delete selected group" button on load.
|
|
|
33 |
* addmembersdisabled bool Whether to disable the "Add/remove users" button on load.
|
|
|
34 |
* groups array The list of groups.
|
|
|
35 |
* members array The list of members, grouped based on roles.
|
|
|
36 |
* undeletablegroups string A JSON string containing an array of group IDs that a user cannot delete.
|
|
|
37 |
* messagingsettingsvisible bool Wether the messaging settings buttons should be visible.
|
|
|
38 |
|
|
|
39 |
Example context (json):
|
|
|
40 |
{
|
|
|
41 |
"courseid": "1",
|
|
|
42 |
"selectedgroup": "Group 1 (3)",
|
|
|
43 |
"editgroupsettingsdisabled": false,
|
|
|
44 |
"deletegroupdisabled": false,
|
|
|
45 |
"addmembersdisabled": false,
|
|
|
46 |
"messagingenabled": true,
|
|
|
47 |
"groups": [
|
|
|
48 |
{
|
|
|
49 |
"value": "1",
|
|
|
50 |
"text": "Group 1 (3)",
|
|
|
51 |
"selected": true
|
|
|
52 |
},
|
|
|
53 |
{
|
|
|
54 |
"value": "2",
|
|
|
55 |
"text": "Group 2 (2)"
|
|
|
56 |
}
|
|
|
57 |
],
|
|
|
58 |
"members": [
|
|
|
59 |
{
|
|
|
60 |
"role": "Student",
|
|
|
61 |
"rolemembers": [
|
|
|
62 |
{
|
|
|
63 |
"value": "1",
|
|
|
64 |
"text": "John Doe"
|
|
|
65 |
},
|
|
|
66 |
{
|
|
|
67 |
"value": "2",
|
|
|
68 |
"text": "Jane Doe"
|
|
|
69 |
},
|
|
|
70 |
{
|
|
|
71 |
"value": "3",
|
|
|
72 |
"text": "John Smith"
|
|
|
73 |
}
|
|
|
74 |
]
|
|
|
75 |
}
|
|
|
76 |
],
|
|
|
77 |
"undeletablegroups": "[1: true, 3: true]"
|
|
|
78 |
}
|
|
|
79 |
}}
|
|
|
80 |
<form id="groupeditform" action="index.php" method="post">
|
|
|
81 |
<div class="container-fluid groupmanagementtable">
|
|
|
82 |
<div class="row rtl-compatible justify-items-between">
|
|
|
83 |
<div class="col-md-6 mb-1 pl-0">
|
|
|
84 |
<input type="hidden" name="id" value="{{courseid}}">
|
|
|
85 |
<div class="form-group">
|
|
|
86 |
<label for="groups">
|
|
|
87 |
<span id="groupslabel" class="badge badge-secondary">
|
|
|
88 |
<svg width="18" height="18" fill="none" viewBox="0 0 24 24">
|
|
|
89 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.78168 19.25H13.2183C13.7828 19.25 14.227 18.7817 14.1145 18.2285C13.804 16.7012 12.7897 14 9.5 14C6.21031 14 5.19605 16.7012 4.88549 18.2285C4.773 18.7817 5.21718 19.25 5.78168 19.25Z"></path>
|
|
|
90 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15.75 14C17.8288 14 18.6802 16.1479 19.0239 17.696C19.2095 18.532 18.5333 19.25 17.6769 19.25H16.75"></path>
|
|
|
91 |
<circle cx="9.5" cy="7.5" r="2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
|
|
|
92 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M14.75 10.25C16.2688 10.25 17.25 9.01878 17.25 7.5C17.25 5.98122 16.2688 4.75 14.75 4.75"></path>
|
|
|
93 |
</svg>
|
|
|
94 |
<span class="ml-1">{{#str}}groups{{/str}}</span>
|
|
|
95 |
</span>
|
|
|
96 |
<span id="thegrouping"> </span>
|
|
|
97 |
</label>
|
|
|
98 |
<select name="groups[]" multiple="multiple" id="groups" size="15" class="form-control input-block-level">
|
|
|
99 |
{{#groups}}
|
|
|
100 |
<option value="{{value}}" {{#selected}}selected="selected"{{/selected}} title="{{{text}}}">{{{text}}}</option>
|
|
|
101 |
{{/groups}}
|
|
|
102 |
</select>
|
|
|
103 |
</div>
|
|
|
104 |
<h4 class="mt-2"> {{#str}} withselected, group {{/str}} </h4>
|
|
|
105 |
<div class="form-group form-group-btns mb-3">
|
|
|
106 |
<button type="submit" name="action" id="updatemembers" value="updatemembers" class="btn btn-xs btn-secondary">{{#str}}showmembersforgroup, group{{/str}}</button>
|
|
|
107 |
<button type="submit" name="action" id="showeditgroupsettingsform" value="showgroupsettingsform" {{#editgroupsettingsdisabled}}disabled="disabled"{{/editgroupsettingsdisabled}} class="btn btn-xs btn-secondary">{{#str}}editgroupsettings, group{{/str}}</button>
|
|
|
108 |
{{#messagingsettingsvisible}}
|
|
|
109 |
<button type="submit" name="action" id="disablemessaging" value="disablemessaging" class="btn btn-xs btn-warning" disabled="disabled">{{#str}}disablemessagingaction, group{{/str}}</button>
|
|
|
110 |
<button type="submit" name="action" id="enablemessaging" value="enablemessaging" class="btn btn-xs btn-success" disabled="disabled">{{#str}}enablemessagingaction, group{{/str}}</button>
|
|
|
111 |
{{/messagingsettingsvisible}}
|
|
|
112 |
<button type="submit" name="action" id="deletegroup" value="deletegroup" {{#deletegroupdisabled}}disabled="disabled"{{/deletegroupdisabled}} class="btn btn-xs btn-danger">{{#str}}deleteselectedgroup, group{{/str}}</button>
|
|
|
113 |
</div>
|
|
|
114 |
|
|
|
115 |
<h4 class="mt-2"> {{#str}} manageactions, group {{/str}} </h4>
|
|
|
116 |
<div class="form-group form-group-btns mb-3">
|
|
|
117 |
<button type="submit" name="action" id="showcreateorphangroupform" value="showcreateorphangroupform" class="btn btn-sm btn-primary">{{#str}}creategroup, group{{/str}}</button>
|
|
|
118 |
<button type="submit" name="action" id="showautocreategroupsform" value="showautocreategroupsform" class="btn btn-sm btn-outline-secondary">{{#str}}autocreategroups, group{{/str}}</button>
|
|
|
119 |
<button type="submit" name="action" id="showimportgroups" value="showimportgroups" class="btn btn-sm btn-secondary">{{#str}}importgroups, group{{/str}}</button>
|
|
|
120 |
</div>
|
|
|
121 |
</div>
|
|
|
122 |
<div class="col-md-6 mb-1 pr-0">
|
|
|
123 |
<div class="form-group">
|
|
|
124 |
<label for="members" class="d-inline-flex">
|
|
|
125 |
<span id="memberslabel" class="badge badge-secondary">
|
|
|
126 |
<svg width="18" height="18" fill="none" viewBox="0 0 24 24">
|
|
|
127 |
<circle cx="12" cy="8" r="3.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
|
|
|
128 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12.25 19.25H6.94953C5.77004 19.25 4.88989 18.2103 5.49085 17.1954C6.36247 15.7234 8.23935 14 12.25 14"></path>
|
|
|
129 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17 14.75V19.25"></path>
|
|
|
130 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 17L14.75 17"></path>
|
|
|
131 |
</svg>
|
|
|
132 |
<span id="memberslabel" class="ml-1">{{#str}}membersofselectedgroup, group{{/str}}</span>
|
|
|
133 |
</span>
|
|
|
134 |
<span id="thegroup" class="badge">{{{selectedgroup}}}</span>
|
|
|
135 |
</label>
|
|
|
136 |
<select size="15" multiple="multiple" class="form-control input-block-level" id="members" name="user">
|
|
|
137 |
{{#members}}
|
|
|
138 |
<optgroup label="{{role}}">
|
|
|
139 |
{{#rolemembers}}
|
|
|
140 |
<option value="{{value}}" title="{{text}}">{{{text}}}</option>
|
|
|
141 |
{{/rolemembers}}
|
|
|
142 |
</optgroup>
|
|
|
143 |
{{/members}}
|
|
|
144 |
</select>
|
|
|
145 |
</div>
|
|
|
146 |
<div class="form-group">
|
|
|
147 |
<button type="submit" value="showaddmembersform" class="btn btn-secondary" {{#addmembersdisabled}}disabled="disabled"{{/addmembersdisabled}} name="action" id="showaddmembersform">{{#str}}adduserstogroup, group{{/str}}</button>
|
|
|
148 |
</div>
|
|
|
149 |
</div>
|
|
|
150 |
</div>
|
|
|
151 |
</div>
|
|
|
152 |
</form>
|
|
|
153 |
{{#js}}
|
|
|
154 |
require(['jquery', 'core/yui'], function($) {
|
|
|
155 |
$("#groups").change(function() {
|
|
|
156 |
M.core_group.membersCombo.refreshMembers();
|
|
|
157 |
});
|
|
|
158 |
M.core_group.init_index(Y, "{{wwwroot}}", {{courseid}});
|
|
|
159 |
var undeletableGroups = JSON.parse('{{{undeletablegroups}}}');
|
|
|
160 |
M.core_group.groupslist(Y, undeletableGroups);
|
|
|
161 |
});
|
|
|
162 |
{{/js}}
|
|
|
163 |
{{#js}}
|
|
|
164 |
require(['core_group/index'], (module) => module.init());
|
|
|
165 |
{{/js}}
|