Permalink
Browse files

MDL-30316 - Libraries - improving pagination output to allow a shifti…

…ng start page for displays of less than 18 pages -- original code provided by Martha (martha dot morelos at gmail dot com)
  • Loading branch information...
jsnfwlr authored and danpoltawski committed Aug 29, 2012
1 parent 25ad1de commit 0da02e0a2002e92821e1f91774bf8185c022c529
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/outputcomponents.php
View
@@ -2272,15 +2272,14 @@ public function prepare(renderer_base $output, moodle_page $page, $target) {
$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) {

0 comments on commit 0da02e0

Please sign in to comment.