From c53fa2c9ec02c4ade6ad5d1f84e4c754e1b23951 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 10 Aug 2011 09:31:19 +0000 Subject: [PATCH] 2011-08-10 Miguel de Dios * godmode/groups/modu_group_list.php: added pagination to list. Fixes: #3389009 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4697 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++ .../godmode/groups/modu_group_list.php | 38 +++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 07c82e10a2..4002310707 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-08-10 Miguel de Dios + + * godmode/groups/modu_group_list.php: added pagination to list. + + Fixes: #3389009 + 2011-08-09 Javier Lanz * operation/incidents/incident.incident.php, diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index 8ece070642..e457eff7cd 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -129,9 +129,41 @@ if ($delete_group) { echo "

".__('Group successfully deleted')."

"; } -$sql = "SELECT * - FROM tmodule_group "; -$groups = db_get_all_rows_sql ($sql, true); +$total_groups = db_get_num_rows('SELECT * FROM tmodule_group'); + +$url = ui_get_url_refresh (array ('offset' => false)); + +$offset = (int)get_parameter('offset', 0); + +ui_pagination($total_groups, $url, $offset); + +switch ($config["dbtype"]) { + case "mysql": + $sql = "SELECT * + FROM tmodule_group + ORDER BY name ASC + LIMIT " . $offset . ", " . $config['block_size']; + break; + case "postgresql": + $sql = "SELECT * + FROM tmodule_group + ORDER BY name ASC + LIMIT " . $config['block_size'] . " OFFSET " . $offset; + break; + case "oracle": + $set = array (); + $set['limit'] = $config["block_size"]; + $set['offset'] = $offset; + + $sql = "SELECT * + FROM tmodule_group + ORDER BY name ASC"; + + $sql = oracle_recode_query ($sql, $set); + break; +} + +$groups = db_get_all_rows_sql($sql); $table->width = '98%';