MDL-46567 gradereport_history: Fix bug with paging

Part of MDL-46191
This commit is contained in:
Matthew Tavella 2014-05-14 09:59:15 +09:30 committed by Ankit Agarwal
parent f7744e915a
commit 6cbd548061
2 changed files with 6 additions and 3 deletions

View File

@ -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) {

View File

@ -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;