mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-49963 core: Select all button on participant list works across pages
This commit is contained in:
parent
03b8b55f10
commit
5b7c500a71
4 changed files with 248 additions and 4 deletions
|
@ -42,6 +42,7 @@ $search = optional_param('search', '', PARAM_RAW); // Make sure it is proc
|
|||
$roleid = optional_param('roleid', 0, PARAM_INT); // Optional roleid, 0 means all enrolled users (or all on the frontpage).
|
||||
$contextid = optional_param('contextid', 0, PARAM_INT); // One of this or.
|
||||
$courseid = optional_param('id', 0, PARAM_INT); // This are required.
|
||||
$selectall = optional_param('selectall', false, PARAM_BOOL); // When rendering checkboxes against users mark them all checked.
|
||||
|
||||
$PAGE->set_url('/user/index.php', array(
|
||||
'page' => $page,
|
||||
|
@ -714,7 +715,12 @@ if ($mode === MODE_USERDETAILS) { // Print simple listing.
|
|||
$row->cells[2]->text .= implode('', $links);
|
||||
|
||||
if ($bulkoperations) {
|
||||
$row->cells[2]->text .= '<br /><input type="checkbox" class="usercheckbox" name="user'.$user->id.'" /> ';
|
||||
if ($selectall) {
|
||||
$checked = 'checked="true"';
|
||||
} else {
|
||||
$checked = '';
|
||||
}
|
||||
$row->cells[2]->text .= '<br /><input type="checkbox" class="usercheckbox" name="user'.$user->id.'" ' .$checked .'/> ';
|
||||
}
|
||||
$table->data = array($row);
|
||||
echo html_writer::table($table);
|
||||
|
@ -768,7 +774,12 @@ if ($mode === MODE_USERDETAILS) { // Print simple listing.
|
|||
|
||||
$data = array();
|
||||
if ($bulkoperations) {
|
||||
$data[] = '<input type="checkbox" class="usercheckbox" name="user'.$user->id.'" />';
|
||||
if ($selectall) {
|
||||
$checked = 'checked="true"';
|
||||
} else {
|
||||
$checked = '';
|
||||
}
|
||||
$data[] = '<input type="checkbox" class="usercheckbox" name="user'.$user->id.'" ' . $checked .'/>';
|
||||
}
|
||||
$data[] = $OUTPUT->user_picture($user, array('size' => 35, 'courseid' => $course->id));
|
||||
$data[] = $profilelink;
|
||||
|
@ -798,7 +809,27 @@ if ($mode === MODE_USERDETAILS) { // Print simple listing.
|
|||
|
||||
if ($bulkoperations) {
|
||||
echo '<br /><div class="buttons">';
|
||||
echo '<input type="button" id="checkall" value="'.get_string('selectall').'" /> ';
|
||||
|
||||
if ($matchcount > 0 && $perpage < $matchcount) {
|
||||
$perpageurl = clone($baseurl);
|
||||
$perpageurl->remove_params('perpage');
|
||||
$perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE);
|
||||
$perpageurl->param('selectall', true);
|
||||
$showalllink = $perpageurl;
|
||||
} else {
|
||||
$showalllink = false;
|
||||
}
|
||||
|
||||
if ($perpage < $matchcount) {
|
||||
// Select all users, refresh page showing all users and mark them all selected.
|
||||
$label = get_string('selectalluserswithcount', 'moodle', $matchcount);
|
||||
echo '<input type="button" id="checkall" value="' . $label . '" data-showallink="' . $showalllink . '" /> ';
|
||||
// Select all users, mark all users on page as selected.
|
||||
echo '<input type="button" id="checkallonpage" value="' . get_string('selectallusersonpage') . '" /> ';
|
||||
} else {
|
||||
echo '<input type="button" id="checkallonpage" value="' . get_string('selectall') . '" /> ';
|
||||
}
|
||||
|
||||
echo '<input type="button" id="checknone" value="'.get_string('deselectall').'" /> ';
|
||||
$displaylist = array();
|
||||
$displaylist['messageselect.php'] = get_string('messageselectadd');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue