Added changes to get all hierachy to the chart
This commit is contained in:
parent
06f83825dc
commit
2883e45849
|
@ -5803,9 +5803,12 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
$filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false;
|
||||
|
||||
if ($filter['group'] != 0) {
|
||||
$groups = db_get_row_sql ("SELECT * FROM tgrupo where id_grupo = " . $filter['group']);
|
||||
$groups = db_get_all_rows_sql ("SELECT * FROM tgrupo where id_grupo = " . $filter['group'] . " || parent = " . $filter['group']);
|
||||
|
||||
$groups_ax = array($groups['id_grupo'] => $groups);
|
||||
$groups_ax = array();
|
||||
foreach ($groups as $g) {
|
||||
$groups_ax[$g['id_grupo']] = $g;
|
||||
}
|
||||
|
||||
$groups = $groups_ax;
|
||||
}
|
||||
|
@ -5817,7 +5820,13 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
if (!empty($groups)) {
|
||||
$groups_aux = $groups;
|
||||
|
||||
$data_groups = groups_get_tree($groups);
|
||||
//$data_groups = groups_get_tree($groups);
|
||||
|
||||
$childrens = array();
|
||||
$data_groups = groups_get_tree_good($groups, false, $childrens);
|
||||
foreach ($childrens as $id_c) {
|
||||
unset($data_groups[$id_c]);
|
||||
}
|
||||
$data_groups_keys = array();
|
||||
groups_get_tree_keys($data_groups, $data_groups_keys);
|
||||
|
||||
|
|
|
@ -2265,6 +2265,45 @@ function groups_get_tree(&$groups, $parent = false) {
|
|||
return $return;
|
||||
}
|
||||
|
||||
function groups_get_tree_good (&$groups, $parent = false, &$childs) {
|
||||
$return = array();
|
||||
|
||||
foreach ($groups as $id => $group) {
|
||||
if ($group['parent'] != 0) {
|
||||
$childs[$id] = $id;
|
||||
}
|
||||
if ($parent === false && (!isset($group['parent']) || $group['parent'] == 0 || !in_array($group['parent'], $groups))) {
|
||||
$return[$id] = $group;
|
||||
//unset($groups[$id]);
|
||||
$children = groups_get_tree_good($groups, $id);
|
||||
|
||||
if (!empty($children)) {
|
||||
$return[$id]['children'] = $children;
|
||||
}
|
||||
else {
|
||||
$return[$id]['children'] = array();
|
||||
}
|
||||
}
|
||||
else if ($parent && isset($group['parent']) && $group['parent'] == $parent) {
|
||||
$return[$id] = $group;
|
||||
//unset($groups[$id]);
|
||||
$children = groups_get_tree_good($groups, $id);
|
||||
|
||||
if (!empty($children)) {
|
||||
$return[$id]['children'] = $children;
|
||||
}
|
||||
else {
|
||||
$return[$id]['children'] = array();
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function groups_get_tree_keys ($groups, &$group_keys) {
|
||||
foreach ($groups as $id => $group) {
|
||||
$group_keys[$id] = $id;
|
||||
|
|
Loading…
Reference in New Issue