moodle/course/groups-edit.html
moodler f374fb1006 This is the first check-in of support for groups.
It's very early (it doesn't actually do anything yet!) but you can
define groups and get an idea of how the interface is shaping up.
I also wanted to show that I have actually done something on this! :-)

From here my plan is to add group support to the modules, one by one
(forums first), then go back and clean up some of the central interfaces,
graphics etc.

Finally, test, test, test and get 1.2 out well before the end of February.
2003-12-30 17:18:06 +00:00

171 lines
5.9 KiB
HTML
Executable File

<script language="JavaScript">
<!-- Begin
<?php
foreach ($listmembers as $groupid => $listmember) {
echo "group$groupid = new Object();\n";
$useridstring = "group$groupid.userid = new Array(";
$usernamestring = "group$groupid.username = new Array(";
$max = count($listmember);
$count = 0;
foreach ($listmember as $userid => $username) {
$count++;
$useridstring .= "\"$userid\"";
$usernamestring .= "\"$username\"";
if ($count < $max) {
$useridstring .= ', ';
$usernamestring .= ', ';
}
}
$useridstring .= ");\n";
$usernamestring .= ");\n";
echo $useridstring;
echo $usernamestring;
}
?>
function updateGroup() {
document.form1.groupid.value = document.form2.groups.value;
document.form3.groupid.value = document.form2.groups.value;
}
function updateMembers(selectgroup) {
eval('group=group'+selectgroup.value);
username = group.username;
userid = group.userid;
document.form3['members[]'].length = username.length;
for (i=0;i<username.length;i++) {
document.form3['members[]'].options[i].value = userid[i];
document.form3['members[]'].options[i].text = username[i];
}
updateGroup();
}
function userWindow(selectuser) {
num = 0;
for (var i=0; i<selectuser.options.length; i++) {
if (selectuser.options[i].selected) {
num++;
user = selectuser.options[i].value;
openpopup('/user/view.php?id='+user+'&course=<?php echo $courseid ?>','userinfo'+num,'','');
}
}
return false;
}
function groupWindow(selectgroup) {
num = 0;
for (var i=0; i<selectgroup.options.length; i++) {
if (selectgroup.options[i].selected) {
num++;
group = selectgroup.options[i].value;
openpopup('/course/group.php?id=<?php echo $courseid ?>&group='+group,'groupinfo'+num,'','');
}
}
return false;
}
// end hiding script -->
</script>
<table border="0" cellspacing="2" cellpadding="10" align="center" class="generalbox">
<tr>
<td width="33%" align="center" class="generaltableheader"><?php p($strgroupnonmembers) ?></td>
<td width="33%" align="center" class="generaltableheader"><?php p($strgroups) ?></td>
<td width="33%" align="center" class="generaltableheader"><?php p($strgroupmembersselected) ?></td>
</tr>
<tr align="center" valign="top">
<td class="generalboxcontent"><p>
<form name="form1" id="form1" method="post" action="groups.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" />
<select name="nonmembers[]" size="15" multiple="multiple">
<?php
if (!empty($nonmembers)) {
foreach ($nonmembers as $id => $nonmembername) {
echo "<option value=\"$id\">$nonmembername</option>";
}
}
?>
</select>
</p>
<p>
<input type="submit" name="nonmembersadd" value="<?php p($strgroupaddusers) ?> -&gt;"
onclick="updateGroup()" />
</p>
<p>
<input type="submit" name="nonmembersrandom" value="<?php p($strgrouprandomassign) ?> -&gt;" />
</p>
<p>
<input type="submit" name="nonmembersinfo" value="<?php p($strgroupinfopeople) ?>"
onclick="return userWindow(document.form1['nonmembers[]']);" />
</p>
</form>
</td>
<td class="generalboxcontent"><p>
<form name="form2" id="form2" method="post" action="groups.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<select name="groups" size="15" onChange="updateMembers(this)">
<?php
if (!empty($listgroups)) {
foreach ($listgroups as $id => $listgroup) {
$selected = '';
if ($id == $selectedgroup) {
$selected = 'selected="selected"';
}
echo "<option $selected value=\"$id\">$listgroup</option>";
}
}
?>
</select>
</p>
<p>
<input type="submit" name="groupsinfo" value="<?php p($strgroupinfo) ?>"
onclick="return groupWindow(document.form2.groups);"/>
</p>
<p>
<input type="submit" name="groupsremove" value="<?php p($strgroupremove) ?>" />
</p>
<p>
<input name="newgroupname" type="text" size="10" />
<input type="submit" name="groupsadd" value="<?php p($strgroupadd) ?>" />
</p>
</form>
</td>
<td class="generalboxcontent"><p>
<form name="form3" id="form3" method="post" action="groups.php">
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" />
<select name="members[]" size="15" multiple="multiple">
<?php
if (!empty($members)) {
foreach ($members as $id => $membername) {
echo "<option value=\"$id\">$membername</option>";
}
}
?>
</select>
</p>
<p>
<input type="submit" name="membersinfo" value="<?php p($strgroupinfomembers) ?>"
onclick="return userWindow(document.form3['members[]']);" />
</p>
<p>
<input type="submit" name="membersremove" value="<?php p($strgroupremovemembers) ?>"
onclick="updateGroup()" />
</p>
</form>
</td>
</tr>
</table>