Added changes to filter by group. Not finished
This commit is contained in:
parent
c7df344de3
commit
f4d035cfa5
|
@ -5802,17 +5802,34 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
|
||||
$filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false;
|
||||
|
||||
$groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null));
|
||||
if ($filter['group'] != 0) {
|
||||
$groups = db_get_row_sql ("SELECT * FROM tgrupo where id_grupo = " . $filter['group']);
|
||||
|
||||
$groups_ax = array($groups['id_grupo'] => $groups);
|
||||
|
||||
$groups = $groups_ax;
|
||||
}
|
||||
else {
|
||||
$groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null));
|
||||
}
|
||||
$data_groups = array();
|
||||
if (!empty($groups)) {
|
||||
$groups_aux = $groups;
|
||||
$data_groups = groups_get_tree($groups);
|
||||
|
||||
if ($filter['group'] != 0) {
|
||||
$data_groups[$filter['group']] = $groups[$filter['group']];
|
||||
groups_get_all_hierarchy_group_to_childrens($groups[$filter['group']], $filter['group'], $data_groups);
|
||||
}
|
||||
else {
|
||||
groups_get_all_hierarchy_groups_to_childrens($groups, $data_groups);
|
||||
}
|
||||
|
||||
$groups_aux = null;
|
||||
}
|
||||
|
||||
if (!empty($data_groups)) {
|
||||
$filter = array('id_grupo' => array_keys($data_groups));
|
||||
|
||||
$fields = array('id_agente', 'id_parent', 'id_grupo', 'alias');
|
||||
$agents = agents_get_agents($filter, $fields);
|
||||
|
||||
|
@ -6029,7 +6046,6 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
}
|
||||
|
||||
function iterate_group_array ($groups, &$data_agents) {
|
||||
|
||||
$data = array();
|
||||
|
||||
foreach ($groups as $id => $group) {
|
||||
|
@ -6068,6 +6084,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
|
||||
if (!isset($group['children']))
|
||||
$group_aux['children'] = array();
|
||||
|
||||
if (!empty($group['children']))
|
||||
$group_aux['children'] = iterate_group_array($group['children'], $data_agents);
|
||||
|
||||
|
|
|
@ -2241,6 +2241,9 @@ function groups_get_tree(&$groups, $parent = false) {
|
|||
if (!empty($children)) {
|
||||
$return[$id]['children'] = $children;
|
||||
}
|
||||
else {
|
||||
$return[$id]['children'] = array();
|
||||
}
|
||||
}
|
||||
else if ($parent && isset($group['parent']) && $group['parent'] == $parent) {
|
||||
$return[$id] = $group;
|
||||
|
@ -2250,6 +2253,9 @@ function groups_get_tree(&$groups, $parent = false) {
|
|||
if (!empty($children)) {
|
||||
$return[$id]['children'] = $children;
|
||||
}
|
||||
else {
|
||||
$return[$id]['children'] = array();
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
|
@ -2258,6 +2264,7 @@ function groups_get_tree(&$groups, $parent = false) {
|
|||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
|
||||
global $config;
|
||||
|
||||
|
@ -2289,6 +2296,37 @@ function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
|
|||
return $hierarchy;
|
||||
}
|
||||
|
||||
function groups_get_all_hierarchy_group_to_childrens ($group, $parent, &$hierachy) {
|
||||
$childrens = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE parent = " . $group['id_grupo']);
|
||||
if ($childrens) {
|
||||
foreach ($childrens as $child) {
|
||||
$hierachy[$parent]['children'][$child['id_grupo']] = $child;
|
||||
groups_get_all_hierarchy_group_to_childrens($child, $child['id_grupo'], $hierachy);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$hierachy[$parent]['children'] = array();
|
||||
}
|
||||
}
|
||||
|
||||
function groups_get_all_hierarchy_groups_to_childrens ($groups, &$hierachy, $is_children = false) {
|
||||
foreach ($groups as $id => $group) {
|
||||
if (!$is_children) {
|
||||
$hierachy[$group['id_grupo']] = $group;
|
||||
}
|
||||
|
||||
$childrens = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE parent = " . $group['id_grupo']);
|
||||
if ($childrens) {
|
||||
foreach ($childrens as $child) {
|
||||
$hierachy[$group['id_grupo']]['children'][$child['id_grupo']] = $child;
|
||||
|
||||
unset($hierachy[$child['id_grupo']]);
|
||||
groups_get_all_hierarchy_groups_to_childrens($childrens, $hierachy, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function group_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $mode = 'group', $agent_filter = array(), $module_filter = array()) {
|
||||
global $config;
|
||||
if ($id_user == false) {
|
||||
|
|
|
@ -136,11 +136,12 @@ if ($activeTab == "radial_dynamic") {
|
|||
echo "<div style='width: auto; text-align: center;'>";
|
||||
|
||||
$filter = array();
|
||||
if (!empty($group))
|
||||
$filter['group'] = $group;
|
||||
if ($networkmap['source'] == 0) {
|
||||
$filter['group'] = $networkmap['source_data'];
|
||||
}
|
||||
if (!empty($module_group))
|
||||
$filter['module_group'] = $module_group;
|
||||
|
||||
html_debug($filter, true);
|
||||
echo graph_monitor_wheel($width, $height, $filter, $strict_user);
|
||||
|
||||
echo "</div>";
|
||||
|
|
Loading…
Reference in New Issue