New networkmaps in progress... (Fixed agents count)

This commit is contained in:
Arturo Gonzalez 2016-10-10 11:17:24 +02:00
parent 35d7989dab
commit 16ff172bc3
2 changed files with 20 additions and 7 deletions

View File

@ -75,7 +75,7 @@ function networkmap_process_networkmap($id = 0) {
$show_snmp_modules = false;
$dont_show_subgroups = false;
$id_group = $networkmap['id_group'];;
$id_group = $networkmap['id_group'];
$ip_mask = "";
switch ($networkmap['source']) {
case 1:
@ -158,8 +158,6 @@ function networkmap_process_networkmap($id = 0) {
}
}
$nodes_and_relations['nodes'] = array();
$index = 0;
foreach ($nodes as $key => $node) {

View File

@ -376,10 +376,25 @@ switch ($tab) {
$network_map['name'] . '</a>';
}
$count = db_get_value_sql(
'SELECT COUNT(*)
FROM titem
WHERE id_map = ' . $network_map['id'] . ' AND deleted = 0');
if ($network_map['id_group'] > 0) {
$nodes = db_get_all_rows_sql("SELECT style FROM titem WHERE id_map = " . $network_map['id'] . " AND deleted = 0");
$count = 0;
foreach ($nodes as $node) {
$node_style = json_decode($node['style'], true);
if ($node_style['id_group'] == $network_map['id_group']) {
$count++;
}
}
}
else {
$count = db_get_value_sql(
'SELECT COUNT(*)
FROM titem
WHERE id_map = ' . $network_map['id'] . ' AND deleted = 0');
}
if (empty($count))
$count = 0;