From de9e21ffb691c36c0b59fe77ee44bba4f4e39add Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Thu, 20 Oct 2011 13:05:11 +0200 Subject: [PATCH] fix call-time pass-by-reference --- ipf/orm/pager/layoutarrows.php | 81 +++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/ipf/orm/pager/layoutarrows.php b/ipf/orm/pager/layoutarrows.php index 9e03d00..57c54d0 100644 --- a/ipf/orm/pager/layoutarrows.php +++ b/ipf/orm/pager/layoutarrows.php @@ -9,41 +9,51 @@ class IPF_ORM_Pager_LayoutArrows extends IPF_ORM_Pager_Layout $range = $this->getPagerRange()->rangeAroundPage(); - if ($pager->getFirstPage()!=$pager->getLastPage()){ - - $this->removeMaskReplacement('page'); - - if ($range[0]>1){ - - $options['page_number'] = 1; - $str .= $this->processPage($options); - - if ($range[0]>2){ - $options['page_number'] = 2; - $str .= $this->processPage($options); - } - if ($range[0]>3) - $str .= ' ... '; - } - - // Pages listing - $str .= parent::display(&$options, true); - $last_range = $options['page_number']; - if (($last_range)<$pager->getLastPage()){ - - if (($last_range+2)<$pager->getLastPage()){ - $str .= ' ... '; - } - if (($last_range+1)<$pager->getLastPage()){ - $options['page_number'] = $pager->getLastPage()-1; - $str .= $this->processPage($options); - } - if (($last_range)<$pager->getLastPage()){ - $options['page_number'] = $pager->getLastPage(); - $str .= $this->processPage($options); - } - } - } + if ($pager->getFirstPage() != $pager->getLastPage()) + { + $this->removeMaskReplacement('page'); + + if ($range[0] > 1) + { + $options['page_number'] = 1; + $str .= $this->processPage($options); + + if ($range[0] > 2) + { + $options['page_number'] = 2; + $str .= $this->processPage($options); + } + + if ($range[0]>3) + $str .= ' ... '; + } + + // Pages listing + $str .= parent::display($options, true); + + $range = $this->getPagerRange()->rangeAroundPage(); + $last_range = $range[count($range)-1]; + + if ($last_range < $pager->getLastPage()) + { + if ($last_range < $pager->getLastPage() - 2) + { + $str .= ' ... '; + } + + if ($last_range < $pager->getLastPage() - 1) + { + $options['page_number'] = $pager->getLastPage() - 1; + $str .= $this->processPage($options); + } + + if ($last_range < $pager->getLastPage()) + { + $options['page_number'] = $pager->getLastPage(); + $str .= $this->processPage($options); + } + } + } if ($return) return $str; @@ -51,3 +61,4 @@ class IPF_ORM_Pager_LayoutArrows extends IPF_ORM_Pager_Layout echo $str; } } + -- 2.49.0