2 This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 @template core_group/index
20 Template for the Groups page.
22 Classes required for JS:
25 Data attributes required for JS:
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.
38 Example context (json):
41 "selectedgroup": "Group 1 (3)",
42 "editgroupsettingsdisabled": false,
43 "deletegroupdisabled": false,
44 "addmembersdisabled": false,
48 "text": "Group 1 (3)",
75 "undeletablegroups": "[1: true, 3: true]"
78 <form id="groupeditform" action="index.php" method="post">
79 <div class="container-fluid groupmanagementtable">
80 <div class="row row-fluid rtl-compatible">
81 <div class="col-md-6 span6 m-b-1">
82 <input type="hidden" name="id" value="{{courseid}}">
83 <div class="form-group">
85 <span id="groupslabel">{{#str}}groups{{/str}}</span>
86 <span id="thegrouping"> </span>
88 <select name="groups[]" multiple="multiple" id="groups" size="15" class="form-control input-block-level">
90 <option value="{{value}}" {{#selected}}selected="selected"{{/selected}} title="{{{text}}}">{{{text}}}</option>
94 <div class="form-group">
95 <input type="submit" name="act_updatemembers" id="updatemembers" value="{{#str}}showmembersforgroup, group{{/str}}" class="btn btn-default" />
97 <div class="form-group">
98 <input type="submit" name="act_showgroupsettingsform" id="showeditgroupsettingsform" value="{{#str}}editgroupsettings, group{{/str}}" {{#editgroupsettingsdisabled}}disabled="disabled"{{/editgroupsettingsdisabled}} class="btn btn-default" />
100 <div class="form-group">
101 <input type="submit" name="act_deletegroup" id="deletegroup" value="{{#str}}deleteselectedgroup, group{{/str}}" {{#deletegroupdisabled}}disabled="disabled"{{/deletegroupdisabled}} class="btn btn-default" />
103 <div class="form-group">
104 <input type="submit" name="act_showcreateorphangroupform" id="showcreateorphangroupform" value="{{#str}}creategroup, group{{/str}}" class="btn btn-default" />
106 <div class="form-group">
107 <input type="submit" name="act_showautocreategroupsform" id="showautocreategroupsform" value="{{#str}}autocreategroups, group{{/str}}" class="btn btn-default" />
109 <div class="form-group">
110 <input type="submit" name="act_showimportgroups" id="showimportgroups" value="{{#str}}importgroups, group{{/str}}" class="btn btn-default" />
113 <div class="col-md-6 span6 m-b-1">
114 <div class="form-group">
115 <label for="members">
116 <span id="memberslabel">{{#str}}membersofselectedgroup, group{{/str}}</span>
117 <span id="thegroup">{{{selectedgroup}}}</span>
119 <select size="15" multiple="multiple" class="form-control input-block-level" id="members" name="user">
121 <optgroup label="{{role}}">
123 <option value="{{value}}">{{{text}}}</option>
129 <div class="form-group">
130 <input type="submit" value="{{#str}}adduserstogroup, group{{/str}}" class="btn btn-default" {{#addmembersdisabled}}disabled="disabled"{{/addmembersdisabled}} name="act_showaddmembersform" id="showaddmembersform"/>
137 require(['jquery', 'core/yui'], function($) {
138 $("#groups").change(function() {
139 M.core_group.membersCombo.refreshMembers();
141 M.core_group.init_index(Y, "{{wwwroot}}", {{courseid}});
142 var undeletableGroups = JSON.parse('{{{undeletablegroups}}}');
143 M.core_group.groupslist(Y, undeletableGroups);