summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 7b11595..c142742 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -437,6 +437,8 @@ class PHPFSPOT {
$this->tmpl->assign('searchfor', $_SESSION['searchfor']);
if($this->cfg->rows_per_page != 0) {
+
+ /* calculate the page switchers */
$previous_start = $begin_with - ($this->cfg->rows_per_page * $this->cfg->thumbs_per_row);
$next_start = $begin_with + ($this->cfg->rows_per_page * $this->cfg->thumbs_per_row);
@@ -444,6 +446,47 @@ class PHPFSPOT {
$this->tmpl->assign("previous_url", "javascript:showPhotoIndex(". $previous_start .");");
if($end_with < $count)
$this->tmpl->assign("next_url", "javascript:showPhotoIndex(". $next_start .");");
+
+ /* page selector */
+ $photo_per_page = $this->cfg->rows_per_page * $this->cfg->thumbs_per_row;
+
+ /* until 6 pages we show the selector from 1-6
+ everything large will be
+ 1 ... 2 3 4 (5) 6 7 ... 9
+ */
+ $last_page = ceil($count / $photo_per_page);
+
+ if($begin_with == 0) {
+ $current_page = 1;
+ }
+ else {
+ $current_page = 0;
+ for($i = $begin_with; $i >= 0; $i-=$photo_per_page) {
+ $current_page++;
+ }
+ }
+
+ for($i = 1; $i <= $last_page; $i++) {
+
+
+ if($current_page == $i)
+ $style = "style=\"font-size: 125%;\"";
+ elseif($current_page-1 == $i || $current_page+1 == $i)
+ $style = "style=\"font-size: 105%;\"";
+ elseif(($current_page-5 >= $i) && ($i != 1) ||
+ ($current_page+5 <= $i) && ($i != $last_page))
+ $style = "style=\"font-size: 75%;\"";
+ else
+ $style = "";
+
+ $page_select.= "<a href=\"javascript:showPhotoIndex(". (($i*$photo_per_page)-$photo_per_page) .");\"";
+ if($style != "")
+ $page_select.= $style;
+ $page_select.= ">". $i ."</a>&nbsp;";
+
+ }
+
+ $this->tmpl->assign('page_selector', $page_select);
}
$current_tags = "";