MDL-30316 - Libraries - improving pagination output to allow a shifting start page...
authorJason Fowler <phalacee@gmail.com>
Wed, 29 Aug 2012 03:25:20 +0000 (11:25 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 15 Jan 2013 04:50:05 +0000 (12:50 +0800)
lib/outputcomponents.php

index 5e1cf96..d00f634 100644 (file)
@@ -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) {