mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
95 lines
4.4 KiB
HTML
Executable File
95 lines
4.4 KiB
HTML
Executable File
|
|
<form id="assignform" method="post" action="">
|
|
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
|
|
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
|
<input type="hidden" name="host" value="<?php p($mnethost->id) ?>" />
|
|
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
|
<table align="center" border="0" cellpadding="5" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">
|
|
<?php print_string('existingusers', 'role', count($enrolledusers)); ?>
|
|
</td>
|
|
<td></td>
|
|
<td valign="top">
|
|
<?php print_string('potentialusers', 'role', $usercount); ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">
|
|
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
|
|
onfocus="getElementById('assignform').add.disabled=true;
|
|
getElementById('assignform').remove.disabled=false;
|
|
getElementById('assignform').addselect.selectedIndex=-1;">
|
|
<?php
|
|
foreach ($enrolledusers as $enrolleduser) {
|
|
$fullname = fullname($enrolleduser, true);
|
|
echo "<option value=\"$enrolleduser->id\">".$fullname.", ".$enrolleduser->email."</option>\n";
|
|
}
|
|
?>
|
|
|
|
</select></td>
|
|
<td valign="top">
|
|
<br />
|
|
<input name="add" type="submit" id="add" value="←" />
|
|
<br />
|
|
<input name="remove" type="submit" id="remove" value="→" />
|
|
<br />
|
|
</td>
|
|
<td valign="top">
|
|
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
|
|
onfocus="getElementById('assignform').add.disabled=false;
|
|
getElementById('assignform').remove.disabled=true;
|
|
getElementById('assignform').removeselect.selectedIndex=-1;">
|
|
<?php
|
|
|
|
if (!empty($searchtext)) {
|
|
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
|
|
while (! $availableusers->EOF) {
|
|
$user = $availableusers->FetchObj();
|
|
if (!isset($enrolledusers[$user->id])) {
|
|
$fullname = fullname($user, true);
|
|
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
|
}
|
|
$availableusers->MoveNext();
|
|
}
|
|
echo "</optgroup>\n";
|
|
|
|
} else {
|
|
if ($usercount > MAX_USERS_PER_PAGE) {
|
|
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
|
|
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
|
|
} else {
|
|
while (! $availableusers->EOF) {
|
|
$user = $availableusers->FetchObj();
|
|
if (!isset($enrolledusers[$user->id])) {
|
|
$fullname = fullname($user, true);
|
|
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
|
}
|
|
$availableusers->MoveNext();
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
<br />
|
|
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
|
|
onfocus ="getElementById('assignform').add.disabled=true;
|
|
getElementById('assignform').remove.disabled=true;
|
|
getElementById('assignform').removeselect.selectedIndex=-1;
|
|
getElementById('assignform').addselect.selectedIndex=-1;"
|
|
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
|
|
if (keyCode == 13) {
|
|
getElementById('assignform').previoussearch.value=1;
|
|
getElementById('assignform').submit();
|
|
} " />
|
|
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
|
|
<?php
|
|
if (!empty($searchusers)) {
|
|
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|