From: avl Date: Sat, 1 Nov 2008 20:05:44 +0000 (+0200) Subject: Digg Like Paginator X-Git-Tag: 0.5~458 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=067e89e6bbdaef1f9a056e16eb74b5cf3c9bffd6;p=ipf.git Digg Like Paginator --- diff --git a/ipf/admin/media/css/changelists.css b/ipf/admin/media/css/changelists.css index a156c54..7470635 100644 --- a/ipf/admin/media/css/changelists.css +++ b/ipf/admin/media/css/changelists.css @@ -46,5 +46,5 @@ .paginator a.showall { padding:0 !important; border:none !important; } .paginator a.showall:hover { color:#036 !important; background:transparent !important; } .paginator .end { border-width:2px !important; margin-right:6px; } -.paginator .this-page { padding:2px 6px; font-weight:bold; font-size:13px; vertical-align:top; } +.paginator .this-page { border:solid 1px #ccc; padding:2px 6px; font-weight:bold; vertical-align:top; } .paginator a:hover { color:white; background:#5b80b2; border-color:#036; } diff --git a/ipf/admin/model.php b/ipf/admin/model.php index e535844..8d5144e 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -382,7 +382,7 @@ class IPF_Admin_Model{ $pager = new IPF_ORM_Pager_LayoutArrows( new IPF_ORM_Pager($this->q, $currentPage, $this->perPage), - new IPF_ORM_Pager_Range_Sliding(array('chunk' => 15)), + new IPF_ORM_Pager_Range_Sliding(array('chunk' => 10)), $pager_url ); $pager->setTemplate('{%page} '); diff --git a/ipf/orm/pager/layoutarrows.php b/ipf/orm/pager/layoutarrows.php index f8fe16b..76105e0 100644 --- a/ipf/orm/pager/layoutarrows.php +++ b/ipf/orm/pager/layoutarrows.php @@ -8,37 +8,40 @@ class IPF_ORM_Pager_LayoutArrows extends IPF_ORM_Pager_Layout $str = ''; if ($pager->getFirstPage()!=$pager->getLastPage()){ - // First page - if ($pager->getFirstPage()!=$pager->getPage()){ - $this->addMaskReplacement('page', '«', true); - $options['page_number'] = $pager->getFirstPage(); - $str .= $this->processPage($options); - } - - // Previous page - /* - $this->addMaskReplacement('page', '‹', true); - $options['page_number'] = $pager->getPreviousPage(); - $str .= $this->processPage($options); - */ - // Pages listing $this->removeMaskReplacement('page'); - $str .= parent::display($options, true); + if (($pager->getPage()-2)>$pager->getFirstPage()){ + + if (($pager->getPage()-2)>$pager->getFirstPage()){ + $options['page_number'] = $pager->getFirstPage(); + $str .= $this->processPage($options); + } + if (($pager->getPage()-3)>$pager->getFirstPage()){ + $options['page_number'] = $pager->getFirstPage()+1; + $str .= $this->processPage($options); + } + if (($pager->getPage()-4)>$pager->getFirstPage()){ + $str .= ' ... '; + } + } - // Next page - /* - $this->addMaskReplacement('page', '›', true); - $options['page_number'] = $pager->getNextPage(); - $str .= $this->processPage($options); - */ - - // Last page - if ($pager->getLastPage()!=$pager->getPage()){ - $this->addMaskReplacement('page', '»', true); - $options['page_number'] = $pager->getLastPage(); - $str .= $this->processPage($options); + // 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); + } } }