From 9fa010c8ac56ec24f7507a166b88e7d620e1a923 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 19 Jan 2015 16:52:32 +0100 Subject: [PATCH] Fixed errors --- pandora_console/include/class/Tree.class.php | 14 +++++++------- pandora_console/include/functions_groups.php | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 06d0bcc248..cf045193be 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -621,6 +621,10 @@ class Tree { else $parent = $this->root; + function cmpSortNames($a, $b) { + return strcmp($a["name"], $b["name"]); + } + // Get all groups if (empty($parent)) { require_once($config['homedir']."/include/functions_groups.php"); @@ -801,13 +805,13 @@ class Tree { // Add the resulting item $mergedItems[] = $resultItem; } + + usort($mergedItems, "cmpSortNames"); return $mergedItems; } $items = __getMergedItems($item_list); - - html_debug_print($items, true); } if (empty($items)) @@ -821,10 +825,6 @@ class Tree { $this->tree = $this->getAgents($parent, $this->type); } else { - function cmpSortAgentNames($a, $b) { - return strcmp($a["name"], $b["name"]); - } - $agents = array(); foreach ($parent as $server_id => $group_id) { $server = metaconsole_get_servers($server_id); @@ -839,7 +839,7 @@ class Tree { } } if (!empty($agents)) - usort($agents, "cmpSortAgentNames"); + usort($agents, "cmpSortNames"); $this->tree = $agents; } diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index b49c293957..7ae88652c5 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -2019,7 +2019,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu } } - if ($mode == 'group' || $mode == 'tree') { + if ($mode == 'group') { if (! defined ('METACONSOLE')) { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) { unset($list[$i]); @@ -2123,7 +2123,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu } } - if ($mode == 'group' || $mode == 'tree') { + if ($mode == 'group') { if (! defined ('METACONSOLE')) { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) { unset($list[$i]); @@ -2180,7 +2180,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu } } - if ($mode == 'group' || $mode == 'tree') { + if ($mode == 'group') { if (! defined ('METACONSOLE')) { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) { unset($list[$i]);