From 0232fa7b323eb47542edc355fa70fc6997a4c4f9 Mon Sep 17 00:00:00 2001 From: Jason Fowler Date: Wed, 29 Aug 2012 11:25:20 +0800 Subject: [PATCH] MDL-30316 - Libraries - improving pagination output to allow a shifting start page for displays of less than 18 pages -- original code provided by Martha (martha dot morelos at gmail dot com) --- lib/outputcomponents.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 0be9c091f8f..74f0d370894 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -2272,15 +2272,14 @@ class paging_bar implements renderable { $lastpage = 1; } - if ($this->page > 15) { - $startpage = $this->page - 10; + if ($this->page > round(($this->maxdisplay/3)*2)) { + $currpage = $this->page - round($this->maxdisplay/3); $this->firstlink = html_writer::link(new moodle_url($this->baseurl, array($this->pagevar=>0)), '1', array('class'=>'first')); } else { - $startpage = 0; + $currpage = 0; } - $currpage = $startpage; $displaycount = $displaypage = 0; while ($displaycount < $this->maxdisplay and $currpage < $lastpage) {