diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 9c259451ac..3fe50bede8 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2468,6 +2468,67 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = $config['fontpath'], $config['font_size'], 1, 'bottom'); } +function grafico_eventos_agente ($width = 300, $height = 200, $result = false, $meta = false, $history = false) { + global $config; + global $graphic_type; + + //It was urlencoded, so we urldecode it + $url = html_entity_decode (rawurldecode ($url), ENT_QUOTES); + $data = array (); + $loop = 0; + + if ($result === false) { + $result = array(); + } + + $system_events = 0; + $other_events = 0; + $total = array(); + $i = 0; + + foreach ($result as $row) { + if ($meta) { + $count[] = $row["agent_name"]; + } + else { + if ($row["id_agente"] == 0) { + $count[] = __('SYSTEM'); + } + else + $count[] = agents_get_name ($row["id_agente"]) ; + } + + } + + $total = array_count_values($count); + + foreach ($total as $key => $total) { + if ($meta) { + $name = $key." (".$total.")"; + } + else { + $name = $key." (".$total.")"; + } + $data[$name] = $total; + } + + /* + if ($other_events > 0) { + $name = __('Other')." (".$other_events.")"; + $data[$name] = $other_events; + } + */ + + // Sort the data + arsort($data); + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + + return pie3d_graph($config['flash_charts'], $data, $width, $height, + __('Other'), '', $water_mark, + $config['fontpath'], $config['font_size'], 1, 'bottom'); +} + /** * Print a pie graph with events data in 320x200 size * diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index b049083d92..0ca4564a16 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -731,6 +731,17 @@ else { $history); } +if (!empty($result)) { + + $graph = '
' . + grafico_eventos_agente(350, 185, + $result, $meta, $history, $tags_acls_condition,$pagination) . + '
'; + html_print_div(array('id' => 'events_graph', + 'hidden' => true, 'content' => $graph)); +} + + if (!empty($result)) { //~ Checking the event tags exactly. The event query filters approximated tags to keep events //~ with several tags @@ -744,14 +755,7 @@ if (!empty($result)) { } } -if (!empty($result)) { - $graph = '
' . - grafico_eventos_grupo(350, 185, - rawurlencode ($sql_post), $meta, $history) . - '
'; - html_print_div(array('id' => 'events_graph', - 'hidden' => true, 'content' => $graph)); -} + // Delete rnum field generated by oracle_recode_query() function if (($config['dbtype'] == 'oracle') && ($result !== false)) {