]> git.andy128k.dev Git - ipf.git/commitdiff
Digg Like Paginator
authoravl <alex.litovchenko@gmail.com>
Sat, 1 Nov 2008 20:05:44 +0000 (22:05 +0200)
committeravl <alex.litovchenko@gmail.com>
Sat, 1 Nov 2008 20:05:44 +0000 (22:05 +0200)
ipf/admin/media/css/changelists.css
ipf/admin/model.php
ipf/orm/pager/layoutarrows.php

index a156c54e82219db39edfb660349b018035320d55..74706351955d7cf19fa48f241610c0d34afd6315 100644 (file)
@@ -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; }
index e535844ba07c3660157685b6892c03760b1b50e6..8d5144ec753c6d9dd60d1375c80663812e655d2d 100644 (file)
@@ -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('<a href="{%url}">{%page}</a> ');
index f8fe16b537faced0455be62a5a7bba6168c566c6..76105e043ffa63dcb49dd9c3deb29736b41ea409 100644 (file)
@@ -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', '&laquo;', true);
-                       $options['page_number'] = $pager->getFirstPage();
-                       $str .= $this->processPage($options);
-               }
-
-               // Previous page
-                       /*
-               $this->addMaskReplacement('page', '&lsaquo;', 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', '&rsaquo;', true);
-               $options['page_number'] = $pager->getNextPage();
-               $str .= $this->processPage($options);
-               */
-
-               // Last page
-               if ($pager->getLastPage()!=$pager->getPage()){
-                       $this->addMaskReplacement('page', '&raquo;', 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);
+                       }
                }
                }