mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-9115 Added new strings to lang/en_utf8/group.php (where in roles.php before!). Also cleaned up page a little more so the backend code is at the top, with the HTML output at the bottom. We may be able to use mform with this page eventually. AJAX would also help.
This commit is contained in:
parent
65391c1aa3
commit
27c69abeea
@ -70,6 +70,53 @@ if ($success) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$groupmembers = groups_get_members($groupid);
|
||||
$groupmembersoptions = '';
|
||||
$groupmemberscount = 0;
|
||||
if ($groupmembers != false) {
|
||||
// Put the groupings into a hash and sorts them
|
||||
foreach ($groupmembers as $userid) {
|
||||
$listmembers[$userid] = groups_get_user_displayname($userid, $courseid);
|
||||
$groupmemberscount ++;
|
||||
}
|
||||
natcasesort($listmembers);
|
||||
|
||||
// Print out the HTML
|
||||
foreach($listmembers as $id => $name) {
|
||||
$groupmembersoptions .= "<option value=\"$id\">$name</option>\n";
|
||||
}
|
||||
} else {
|
||||
$groupmembersoptions .= '<option> </option>';
|
||||
}
|
||||
|
||||
//TODO: If no 'showall' button, then set true.
|
||||
$showall = true;
|
||||
|
||||
$potentialmembers = array();
|
||||
$potentialmembersoptions = '';
|
||||
$potentialmemberscount = 0;
|
||||
if (!$showall && $groupingid != GROUP_NOT_IN_GROUPING) {
|
||||
$potentialmembers = groups_get_users_not_in_any_group_in_grouping($courseid, $groupingid, $groupid);
|
||||
} else {
|
||||
$potentialmembers = groups_get_users_not_in_group($courseid, $groupid);
|
||||
}
|
||||
|
||||
if ($potentialmembers != false) {
|
||||
// Put the groupings into a hash and sorts them
|
||||
foreach ($potentialmembers as $userid) {
|
||||
$nonmembers[$userid] = groups_get_user_displayname($userid, $courseid);
|
||||
$potentialmemberscount++;
|
||||
}
|
||||
natcasesort($nonmembers);
|
||||
|
||||
// Print out the HTML
|
||||
foreach($nonmembers as $id => $name) {
|
||||
$potentialmembersoptions .= "<option value=\"$id\">$name</option>\n";
|
||||
}
|
||||
} else {
|
||||
$potentialmembersoptions .= '<option> </option>';
|
||||
}
|
||||
|
||||
// Print the page and form
|
||||
$strgroups = get_string('groups');
|
||||
@ -98,30 +145,13 @@ if ($success) {
|
||||
<table summary="" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<label for="removeselect"><?php print_string('existingusers', 'role'); //count($contextusers) ?></label>
|
||||
<label for="removeselect"><?php print_string('existingmembers', 'group', $groupmemberscount); //count($contextusers) ?></label>
|
||||
<br />
|
||||
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
|
||||
onfocus="document.getElementById('assignform').add.disabled=true;
|
||||
document.getElementById('assignform').remove.disabled=false;
|
||||
document.getElementById('assignform').addselect.selectedIndex=-1;">
|
||||
<?php
|
||||
$userids = groups_get_members($groupid);
|
||||
|
||||
if ($userids != false) {
|
||||
// Put the groupings into a hash and sorts them
|
||||
foreach ($userids as $userid) {
|
||||
$listmembers[$userid] = groups_get_user_displayname($userid, $courseid);
|
||||
}
|
||||
natcasesort($listmembers);
|
||||
|
||||
// Print out the HTML
|
||||
foreach($listmembers as $id => $name) {
|
||||
echo "<option value=\"$id\">$name</option>\n";
|
||||
}
|
||||
} else {
|
||||
echo '<option> </option>';
|
||||
}
|
||||
?>
|
||||
<?php echo $groupmembersoptions ?>
|
||||
</select></td>
|
||||
<td valign="top">
|
||||
<?php // Hidden assignment? ?>
|
||||
@ -134,37 +164,13 @@ if ($success) {
|
||||
</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<label for="addselect"><?php print_string('potentialusers', 'role'); //$usercount ?></label>
|
||||
<label for="addselect"><?php print_string('potentialmembers', 'group', $potentialmemberscount); //$usercount ?></label>
|
||||
<br />
|
||||
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
|
||||
onfocus="document.getElementById('assignform').add.disabled=false;
|
||||
document.getElementById('assignform').remove.disabled=true;
|
||||
document.getElementById('assignform').removeselect.selectedIndex=-1;">
|
||||
<?php
|
||||
//TODO: If no 'showall' button, then set true.
|
||||
$showall = true;
|
||||
unset($userids);
|
||||
if (!$showall && $groupingid != GROUP_NOT_IN_GROUPING) {
|
||||
$userids = groups_get_users_not_in_any_group_in_grouping($courseid, $groupingid, $groupid);
|
||||
} else {
|
||||
$userids = groups_get_users_not_in_group($courseid, $groupid);
|
||||
}
|
||||
|
||||
if ($userids != false) {
|
||||
// Put the groupings into a hash and sorts them
|
||||
foreach ($userids as $userid) {
|
||||
$nonmembers[$userid] = groups_get_user_displayname($userid, $courseid);
|
||||
}
|
||||
natcasesort($nonmembers);
|
||||
|
||||
// Print out the HTML
|
||||
foreach($nonmembers as $id => $name) {
|
||||
echo "<option value=\"$id\">$name</option>\n";
|
||||
}
|
||||
} else {
|
||||
echo '<option> </option>';
|
||||
}
|
||||
?>
|
||||
<?php echo $potentialmembersoptions ?>
|
||||
</select>
|
||||
<br />
|
||||
<?php //TODO: Search box?
|
||||
|
@ -85,7 +85,8 @@ $string['save'] = 'Save';
|
||||
$string['cancel'] = 'Cancel';
|
||||
$string['return'] = 'Return';
|
||||
$string['backtogroups'] = 'Back to groups';
|
||||
|
||||
$string['existingmembers'] = 'Existing members: $a';
|
||||
$string['potentialmembers'] = 'Potential members: $a';
|
||||
$string['groupfor'] = "for group";
|
||||
$string['groupinfo'] = 'Info about selected group';
|
||||
$string['groupinfomembers'] = 'Info about selected members';
|
||||
|
Loading…
x
Reference in New Issue
Block a user