From fa3b38718523539e4222404f8a1a092c2a15d0c2 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Mon, 24 Aug 2020 09:28:44 +0800 Subject: [PATCH] MDL-69458 report_insights: Respect perpage value in pagination bar --- report/insights/classes/output/insights_list.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/report/insights/classes/output/insights_list.php b/report/insights/classes/output/insights_list.php index 60f3cea7ec6dd..55227ecf5d342 100644 --- a/report/insights/classes/output/insights_list.php +++ b/report/insights/classes/output/insights_list.php @@ -199,6 +199,8 @@ public function export_for_template(\renderer_base $output) { $data->noinsights = $notification->export_for_template($output); } + $url = $PAGE->url; + if ($this->othermodels) { $options = array(); @@ -207,14 +209,15 @@ public function export_for_template(\renderer_base $output) { } // New moodle_url instance returned by magic_get_url. - $url = $PAGE->url; $url->remove_params('modelid'); $modelselector = new \single_select($url, 'modelid', $options, '', array('' => get_string('selectotherinsights', 'report_insights'))); $data->modelselector = $modelselector->export_for_template($output); } - $data->pagingbar = $output->render(new \paging_bar($total, $this->page, $this->perpage, $PAGE->url)); + // Add the 'perpage' parameter to the url which is later used to generate the pagination links. + $url->param('perpage', $this->perpage); + $data->pagingbar = $output->render(new \paging_bar($total, $this->page, $this->perpage, $url)); return $data; }