From: hickert Date: Thu, 24 Jan 2008 08:35:26 +0000 (+0000) Subject: Added simple paging to gosa deamon X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=05fec747ac12a4fc23cf3f9f40be01e505f2088d;p=gosa.git Added simple paging to gosa deamon git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8580 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc index 4225b18f7..0bafd5212 100644 --- a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc +++ b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc @@ -19,6 +19,9 @@ class gotomasses extends plugin var $sort_by = "QueuePosition"; var $sort_dir = "up"; + var $range = 25; + var $start = 0; + function gotomasses(&$config, $dn= NULL) { /* Include config object */ @@ -207,7 +210,21 @@ class gotomasses extends plugin $this->divlist->execute(); $entries = $this->get_queued_entries(); $this->divlist->SetEntries($entries); - return($this->divlist->Draw()); + + + $smarty = get_smarty(); + $smarty->assign("start",$this->start); + $smarty->assign("start_real", ($this->start + 1)); + $smarty->assign("ranges", array("10" => "10", + "20" => "20", + "25" => "25", + "50" => "50", + "100"=> "100", + "200"=> "200", + "9999" => "*")); + $smarty->assign("range",$this->range); + $smarty->assign("div",$this->divlist->Draw()); + return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__)))); } @@ -257,7 +274,11 @@ class gotomasses extends plugin function get_queued_entries() { - $entries = $this->o_queue->get_queued_entries(); + + $start = $this->range * $this->start; + $stop = $start + $this->range; + + $entries = $this->o_queue->get_queued_entries($start,$stop); if(!is_array($entries)){ msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "

".$this->o_queue->get_error()), ERROR_DIALOG); @@ -308,6 +329,18 @@ class gotomasses extends plugin } $this->sort_by = $sort; } + if(isset($_POST['range']) && is_numeric($_POST['range'])){ + $this->range = $_POST['range']; + } + if(isset($_POST['next_page'])){ + $this->start ++; + } + if(isset($_POST['last_page'])){ + $this->start --; + if($this->start < 0 ){ + $this->start = 0; + } + } }