MDL-68463 core_user: Correct Show all link details
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 19 May 2020 08:27:51 +0000 (16:27 +0800)
committerSara Arjona <sara@moodle.com>
Tue, 19 May 2020 12:16:25 +0000 (14:16 +0200)
user/index.php

index 2e9290f..7c60722 100644 (file)
@@ -312,14 +312,18 @@ $perpageurl = clone($baseurl);
 $perpageurl->remove_params('perpage');
 $perpagesize = DEFAULT_PAGE_SIZE;
 $perpagevisible = false;
+$perpagestring = '';
 
 if ($perpage == SHOW_ALL_PAGE_SIZE && $participanttable->totalrows > DEFAULT_PAGE_SIZE) {
-    $perpageurl->param('perpage', DEFAULT_PAGE_SIZE);
+    $perpageurl->param('perpage', $participanttable->totalrows);
+    $perpagesize = SHOW_ALL_PAGE_SIZE;
     $perpagevisible = true;
+    $perpagestring = get_string('showperpage', '', DEFAULT_PAGE_SIZE);
 } else if ($participanttable->get_page_size() < $participanttable->totalrows) {
     $perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE);
-    $pagesize = SHOW_ALL_PAGE_SIZE;
+    $perpagesize = SHOW_ALL_PAGE_SIZE;
     $perpagevisible = true;
+    $perpagestring = get_string('showall', '', $participanttable->totalrows);
 }
 
 $perpageclasses = '';
@@ -328,7 +332,7 @@ if (!$perpagevisible) {
 }
 echo $OUTPUT->container(html_writer::link(
     $perpageurl,
-    get_string('showperpage', '', DEFAULT_PAGE_SIZE),
+    $perpagestring,
     [
         'data-action' => 'showcount',
         'data-target-page-size' => $perpagesize,