From 6cbd54806105d9d2604d506e2d65627efdae39c9 Mon Sep 17 00:00:00 2001 From: Matthew Tavella Date: Wed, 14 May 2014 09:59:15 +0930 Subject: [PATCH] MDL-46567 gradereport_history: Fix bug with paging Part of MDL-46191 --- grade/report/history/index.php | 7 ++++--- grade/report/history/lib.php | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grade/report/history/index.php b/grade/report/history/index.php index 899c9e91f41..977aaf1aef5 100644 --- a/grade/report/history/index.php +++ b/grade/report/history/index.php @@ -93,10 +93,12 @@ if (!empty($filters['datetill'])) { } $report = new grade_report_history($courseid, $gpr, $context, $filters, $page, $sortitemid); -$numrows = $report->get_history(true); $report->load_users(); +$historytable = $report->get_history_table(); +$numrows = $report->numrows; + $names = array(); foreach ($report->get_selected_users() as $key => $user) { $names[$key] = $user->firstname.' '.$user->lastname; @@ -113,7 +115,6 @@ $mform->set_data($filters); if ($export) { $filename = $COURSE->shortname; - $report->get_history_table(); $data = $report->get_table_data(); csv_export_writer::download_array($filename, $data); } @@ -127,7 +128,7 @@ if (!empty($report->perpage)) { } $mform->display(); -echo $report->get_history_table(); +echo $historytable; // Prints paging bar at bottom for large pages. if (!empty($report->perpage) && $report->perpage >= 20) { diff --git a/grade/report/history/lib.php b/grade/report/history/lib.php index d439b9e187b..cf7f1474a9e 100644 --- a/grade/report/history/lib.php +++ b/grade/report/history/lib.php @@ -39,6 +39,7 @@ class grade_report_history extends grade_report { public $page = 0; public $perpage = 50; + public $numrows = 0; /** * The id of the grade_item by which this report will be sorted. @@ -418,6 +419,7 @@ class grade_report_history extends grade_report { } $lastrow = $row; } + $this->numrows = count($rows); array_unshift($rows, null); $rows = array_slice($rows, $this->perpage * $this->page, $this->perpage + 1); $fulltable->data += $rows;