mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
MDL-46567 gradereport_history: Fix bug with paging
Part of MDL-46191
This commit is contained in:
parent
f7744e915a
commit
6cbd548061
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user