1 <script type=
"text/javascript">
4 $roleoptions
= array(0 => get_string('all'));
5 $roles
= get_all_roles();
6 foreach ($roles as
$rolex
) {
7 $roleoptions
[$rolex
->id
] = $rolex
->name
;
10 foreach ($listmembers as
$groupid
=> $listmember
) {
11 echo
"group$groupid = new Object();\n";
12 $useridstring
= "group$groupid.userid = new Array(";
13 $usernamestring
= "group$groupid.username = new Array(";
14 $max
= count($listmember
);
16 foreach ($listmember as
$userid
=> $username
) {
18 $useridstring
.= "\"$userid\"";
19 $usernamestring
.= '"'.addslashes($username
).'"';
21 $useridstring
.= ', ';
22 $usernamestring
.= ', ';
25 $useridstring
.= ");\n";
26 $usernamestring
.= ");\n";
33 function updateGroup() {
34 document
.getElementById("form1").groupid
.value
= document
.getElementById("form2").groups
.value
;
35 document
.getElementById("form3").groupid
.value
= document
.getElementById("form2").groups
.value
;
39 function updateMembers(selectgroup
) {
40 eval('group=group'+selectgroup
.value
);
42 username
= group
.username
;
43 userid
= group
.userid
;
45 document
.getElementById("form3")['members[]'].length
= username
.length
;
47 for (i
=0;i
<username
.length
;i
++) {
48 document
.getElementById("form3")['members[]'].options
[i
].value
= userid
[i
];
49 document
.getElementById("form3")['members[]'].options
[i
].text
= username
[i
];
55 function userWindow(selectuser
) {
57 for (var i
=0; i
<selectuser
.options
.length
; i
++) {
58 if (selectuser
.options
[i
].selected
) {
60 user
= selectuser
.options
[i
].value
;
61 openpopup('/user/view.php?id='+user
+'&course=<?php echo $courseid ?>','userinfo'+num
,'','');
67 function groupWindow(selectgroup
) {
69 for (var i
=0; i
<selectgroup
.options
.length
; i
++) {
70 if (selectgroup
.options
[i
].selected
) {
72 group
= selectgroup
.options
[i
].value
;
73 openpopup('/course/group.php?id=<?php echo $courseid ?>&group='+group
,'groupinfo'+num
,'menubar=0,directory=0,location=0,scrollbars,resizable,width=600,height=480','');
83 <form id=
"rolesform1" action=
"groups.php" method=
"get">
84 <input type=
"hidden" name=
"id" value=
"<?php echo $courseid ?>" />
85 <div align
="center"><?php
echo get_string('currentrole', 'role') ?>:
86 <?php choose_from_menu ($roleoptions, 'roleid', $roleid, '', 'document.getElementById(\'rolesform1\').submit()') ?>
89 <table cellspacing=
"0" cellpadding=
"10" align=
"center" class=
"generaltable generalbox">
90 <tr align=
"center" valign=
"top">
91 <td class=
"generalboxcontent">
92 <label for=
"nonmembers"><?php p($strmemberincourse) ?></label>
93 <form id=
"form1" method=
"post" action=
"groups.php">
94 <input type=
"hidden" name=
"id" value=
"<?php p($course->id) ?>" />
95 <input type
="hidden" name
="groupid" value
="<?php p($selectedgroup) ?>" />
96 <input type
="hidden" name
="sesskey" value
="<?php p($sesskey) ?>" />
97 <input type
="hidden" name
="roleid" value
="<?php p($roleid) ?>" />
99 <select name
="nonmembers[]" size
="15" id
="nonmembers" multiple
="multiple">
101 if (!empty($nonmembers)) {
102 foreach ($nonmembers as $id => $nonmembername) {
103 if (!is_array($ugroups = user_group($course->id
, $id))) {
107 $numgroups = count($ugroups);
109 echo "<option value=\"$id\" title=\"$nonmembername is in $numgroups groups\">$nonmembername ($numgroups)</option>\n";
115 <input type=
"submit" name=
"nonmembersadd" value=
"<?php p($strgroupaddusers) ?> ->"
116 onclick
="updateGroup()" />
119 <input type
="submit" name
="nonmembersrandom" value
="<?php p($strgrouprandomassign) ?> ->" />
121 <input type
="submit" name
="nonmembersinfo" value
="<?php p($strgroupinfopeople) ?>"
122 onclick
="return userWindow(document.getElementById('form1')['nonmembers[]']);" />
125 <td
class="generalboxcontent">
126 <label
for="groups"><?php
p($strgroups) ?></label>
127 <form id=
"form2" method=
"post" action=
"groups.php">
128 <input type=
"hidden" name=
"id" value=
"<?php p($course->id) ?>" />
129 <input type
="hidden" name
="sesskey" value
="<?php p($sesskey) ?>" />
130 <input type
="hidden" name
="roleid" value
="<?php p($roleid) ?>" />
131 <select name
="groups" size
="15" id
="groups" onchange
="updateMembers(this)">
133 if (!empty($listgroups)) {
134 foreach ($listgroups as $id => $listgroup) {
136 if ($id == $selectedgroup) {
137 $selected = 'selected="selected"';
139 echo "<option $selected value=\"$id\">$listgroup</option>";
145 <input type=
"submit" name=
"groupsinfo" value=
"<?php p($strgroupinfoedit) ?>"
146 onclick
="return groupWindow(document.getElementById('form2').groups);" />
148 <input type
="submit" name
="groupsremove" value
="<?php p($strgroupremove) ?>" />
150 <label
for="groupadd" class="accesshide"><?php
p($strgroupadd) ?></label>
151 <input name=
"newgroupname" id=
"groupadd" type=
"text" size=
"10" />
152 <input type=
"submit" name=
"groupsadd" value=
"<?php p($strgroupadd) ?>" />
157 <td
class="generalboxcontent">
158 <label
for="members"><?php
p($strgroupmembersselected) ?></label>
159 <form id=
"form3" method=
"post" action=
"groups.php">
160 <input type=
"hidden" name=
"id" value=
"<?php p($course->id) ?>" />
161 <input type
="hidden" name
="groupid" value
="<?php p($selectedgroup) ?>" />
162 <input type
="hidden" name
="sesskey" value
="<?php p($sesskey) ?>" />
163 <input type
="hidden" name
="roleid" value
="<?php p($roleid) ?>" />
164 <select name
="members[]" size
="15" id
="members" multiple
="multiple">
166 if (!empty($members)) {
167 foreach ($members as $id => $membername) {
168 echo "<option value=\"$id\">$membername</option>";
174 <input type=
"submit" name=
"membersinfo" value=
"<?php p($strgroupinfomembers) ?>"
175 onclick
="return userWindow(document.getElementById('form3')['members[]']);" />
177 <input type
="submit" name
="membersremove" value
="<?php p($strgroupremovemembers) ?>"
178 onclick
="updateGroup()" />