From 3686255f4eda8cc53585ba7d678a82e4b04845c9 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 23 Nov 2005 11:03:21 +0000 Subject: [PATCH] Added range selector for phone report git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2021 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/functions.inc | 34 ++++++++++++++++++++--- plugins/gofon/reports/class_fonreport.inc | 9 ++++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/include/functions.inc b/include/functions.inc index 6db14c0b8..20ab5ed8e 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1186,7 +1186,7 @@ function get_global($name) } -function range_selector($dcnt,$start,$range=25) +function range_selector($dcnt,$start,$range=25,$post_var=false) { /* Entries shown left and right from the selected entry */ @@ -1197,6 +1197,10 @@ function range_selector($dcnt,$start,$range=25) if ($max_entries & 1){ $max_entries++; } + + if((!empty($post_var))&&(isset($_POST[$post_var]))){ + $range= $_POST[$post_var]; + } /* Prevent output to start or end out of range */ if ($start < 0 ){ @@ -1210,7 +1214,7 @@ function range_selector($dcnt,$start,$range=25) if(((int)($numpages))!=($numpages)){ $numpages = (int)$numpages + 1; } - if (((int)$numpages) <= 1 ){ + if ((((int)$numpages) <= 1 )&&(!$post_var)){ return (""); } $ppage= (int)(($start / $range) + 0.5); @@ -1233,7 +1237,12 @@ function range_selector($dcnt,$start,$range=25) $begin= $end - $max_entries; } - $output.= "
"; + if($post_var){ + $output.= "
+
"; + }else{ + $output.= "
"; + } /* Draw decrement */ if ($start > 0 ) { @@ -1261,7 +1270,24 @@ function range_selector($dcnt,$start,$range=25) "\"\""; } - $output.= "
"; + if($post_var){ + $output.= "
 "._("Entries per page")." : 
"; + }else{ + $output.= "
"; + } return($output); } diff --git a/plugins/gofon/reports/class_fonreport.inc b/plugins/gofon/reports/class_fonreport.inc index a2ef80dcf..4a08c04ca 100644 --- a/plugins/gofon/reports/class_fonreport.inc +++ b/plugins/gofon/reports/class_fonreport.inc @@ -18,6 +18,7 @@ class fonreport extends plugin var $userfilter= ""; var $ui= NULL; var $fields= array("calldate", "src", "dst", "channel", "lastapp", "disposition", "duration"); + var $range = 20; /* attribute list for save action */ var $attributes= array(); @@ -55,6 +56,10 @@ class fonreport extends plugin /* Call parent execute */ plugin::execute(); + if(isset($_POST['EntryPerPage'])){ + $this->range = $_POST['EntryPerPage']; + } + /* Get template engine */ $smarty= get_smarty(); $fonfilter= get_global("fonfilter"); @@ -197,7 +202,7 @@ class fonreport extends plugin $mod++; continue; } - if ($mod >= ($this->start + 20)){ + if ($mod >= ($this->start + $this->range)){ $mod++; break; } @@ -229,7 +234,7 @@ class fonreport extends plugin if ($output != ""){ $smarty->assign("search_result", $output); - $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start, 20)); + $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start,$this->range,"EntryPerPage")); } else { $smarty->assign("search_result", ""); } -- 2.30.2