Skip to content

Commit

Permalink
MDL-46567 gradereport_history: Move paging implementation to db layer
Browse files Browse the repository at this point in the history
Part of MDL-46191
  • Loading branch information
Luke Tucker authored and ankitagarwal committed Aug 22, 2014
1 parent 6cbd548 commit d94d6e8
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 135 deletions.
13 changes: 8 additions & 5 deletions grade/report/history/index.php
Expand Up @@ -77,6 +77,10 @@
$filters = array();
if ($data = $mform->get_data()) {
$filters = (array)$data;

if (!empty($filters['datetill'])) {
$filters['datetill'] += DAYSECS - 1; // Set to end of the chosen day.
}
} else {
$filters = array(
'id' => $courseid,
Expand All @@ -88,9 +92,8 @@
'revisedonly' => optional_param('revisedonly', 0, PARAM_INT),
);
}
if (!empty($filters['datetill'])) {
$filters['datetill'] += DAYSECS - 1; // Set to end of the chosen day.
}



$report = new grade_report_history($courseid, $gpr, $context, $filters, $page, $sortitemid);

Expand Down Expand Up @@ -123,15 +126,15 @@
// Print header.
print_grade_page_head($COURSE->id, 'report', 'history', $reportname, false, '');

if (!empty($report->perpage)) {
if (!empty($report->perpage) && $report->perpage < $report->numrows) {
echo $OUTPUT->paging_bar($numrows, $report->page, $report->perpage, $report->pbarurl);
}

$mform->display();
echo $historytable;

// Prints paging bar at bottom for large pages.
if (!empty($report->perpage) && $report->perpage >= 20) {
if (!empty($report->perpage) && $report->perpage < $report->numrows) {
echo $OUTPUT->paging_bar($numrows, $report->page, $report->perpage, $report->pbarurl);
}
echo $OUTPUT->footer();
2 changes: 2 additions & 0 deletions grade/report/history/lang/en/gradereport_history.php
Expand Up @@ -38,6 +38,8 @@
$string['grader'] = 'Grader';
$string['history:manage'] = 'Manage the grade history';
$string['history:view'] = 'View the grade history';
$string['historyperpage'] = 'History entries per page';
$string['historyperpage_help'] = 'This setting determines the number of history entries displayed per page in the history report.';
$string['locked'] = 'Locked';
$string['overridden'] = 'Overridden';
$string['pluginname'] = 'Grade history';
Expand Down

0 comments on commit d94d6e8

Please sign in to comment.