diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index f3a9160254..09659d6b02 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -104,6 +104,9 @@ $netflow_filter = 0; $max_values = 0; $resolution = 0; +//Others +$filter_search = ""; + switch ($action) { case 'new': $actionParameter = 'save'; @@ -412,6 +415,8 @@ switch ($action) { $event_graph_by_user_validator = $style['event_graph_by_user_validator']; $event_graph_by_criticity = $style['event_graph_by_criticity']; $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; + + $filter_search = $style['event_filter_search']; break; case 'event_report_module': $description = $item['description']; @@ -1190,6 +1195,14 @@ else ?> + + + + + +
@@ -2066,6 +2079,7 @@ function chooseType() { $("#row_max_values").hide(); $("#row_resolution").hide(); $("#row_last_value").hide(); + $("#row_filter_search").hide(); // SLA list default state $("#sla_list").hide(); @@ -2094,6 +2108,8 @@ function chooseType() { $("#row_event_graph_by_user").show(); $("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_validated").show(); + + $("#row_filter_search").show(); break; case 'simple_graph': $("#row_time_compare_overlapped").show(); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index b842d68a6a..4b727b17e7 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -957,6 +957,8 @@ switch ($action) { $event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0); $event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0); + $event_filter_search = get_parameter('filter_search', ''); + // If metaconsole is activated if ($config['metaconsole'] == 1 && defined('METACONSOLE')) { if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) { @@ -1023,6 +1025,13 @@ switch ($action) { $style['event_graph_by_user_validator'] = $event_graph_by_user_validator; $style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; + + switch ($values['type']) { + case 'event_report_group': + $style['event_filter_search'] = + $event_filter_search; + break; + } break; case 'simple_graph': // Warning. We are using this column to hold this value to avoid @@ -1243,6 +1252,9 @@ switch ($action) { $event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0); $event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0); $event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0); + + $event_filter_search = get_parameter('filter_search', ''); + //Added for events items $style['filter_event_no_validated'] = $filter_event_no_validated; $style['filter_event_validated'] = $filter_event_validated; @@ -1253,6 +1265,14 @@ switch ($action) { $style['event_graph_by_user_validator'] = $event_graph_by_user_validator; $style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; + + switch ($values['type']) { + case 'event_report_group': + $style['event_filter_search'] = + $event_filter_search; + break; + } + break; case 'simple_graph': // Warning. We are using this column to hold this value to avoid diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 8439d3b16c..c79896f86a 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -109,7 +109,9 @@ function events_get_event ($id, $fields = false) { return $event; } -function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $meta = false, $history = false, $total = false) { +function events_get_events_grouped($sql_post, $offset = 0, + $pagination = 1, $meta = false, $history = false, $total = false) { + global $config; $table = events_get_events_table($meta, $history); @@ -1174,7 +1176,8 @@ function events_print_type_description ($type, $return = false) { */ function events_get_group_events ($id_group, $period, $date, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { global $config; @@ -1204,8 +1207,17 @@ function events_get_group_events ($id_group, $period, $date, if ($filter_event_no_validated) { $sql_where .= ' AND estado = 0 '; } - $sql_where .= sprintf(' AND id_grupo IN (%s) AND utimestamp > %d - AND utimestamp <= %d ', implode (",", $id_group), $datelimit, $date); + + if (!empty($filter_event_search)) { + $sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_search) . '%"'. + ' OR id_evento LIKE "%' . io_safe_input($filter_event_search) . '%")'; + } + + $sql_where .= sprintf(' + AND id_grupo IN (%s) + AND utimestamp > %d + AND utimestamp <= %d ', + implode (",", $id_group), $datelimit, $date); return events_get_events_grouped($sql_where, 0, 1000); } @@ -2523,7 +2535,9 @@ function events_clean_tags ($tags) { */ function events_get_count_events_by_agent ($id_group, $period, $date, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { + global $config; $id_group = groups_safe_acl ($config["id_user"], $id_group, "AR"); @@ -2554,6 +2568,11 @@ function events_get_count_events_by_agent ($id_group, $period, $date, $sql_where .= ' AND estado = 0 '; } + if (!empty($filter_event_search)) { + $sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'. + ' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")'; + } + $sql = sprintf ('SELECT id_agente, (SELECT t2.nombre FROM tagente AS t2 @@ -2595,7 +2614,9 @@ function events_get_count_events_by_agent ($id_group, $period, $date, */ function events_get_count_events_validated_by_user ($filter, $period, $date, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { + global $config; $sql_filter = ' AND 1=1 '; @@ -2636,6 +2657,11 @@ function events_get_count_events_validated_by_user ($filter, $period, $date, $sql_where .= ' AND estado = 0 '; } + if (!empty($filter_event_search)) { + $sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'. + ' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")'; + } + $sql = sprintf ('SELECT id_usuario, (SELECT t2.fullname FROM tusuario AS t2 @@ -2677,7 +2703,9 @@ function events_get_count_events_validated_by_user ($filter, $period, $date, */ function events_get_count_events_by_criticity ($filter, $period, $date, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { + global $config; $sql_filter = ' AND 1=1 '; @@ -2718,6 +2746,11 @@ function events_get_count_events_by_criticity ($filter, $period, $date, $sql_where .= ' AND estado = 0 '; } + if (!empty($filter_event_search)) { + $sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'. + ' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")'; + } + $sql = sprintf ('SELECT criticity, COUNT(*) AS count FROM tevento @@ -2752,7 +2785,9 @@ function events_get_count_events_by_criticity ($filter, $period, $date, */ function events_get_count_events_validated ($filter, $period, $date, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { + global $config; $sql_filter = ' AND 1=1 '; @@ -2793,6 +2828,11 @@ function events_get_count_events_validated ($filter, $period, $date, $sql_where .= ' AND estado = 0 '; } + if (!empty($filter_event_search)) { + $sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'. + ' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")'; + } + $sql = sprintf ('SELECT estado, COUNT(*) AS count FROM tevento diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4ae20cb5cc..132ff434c0 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -104,6 +104,11 @@ function reporting_make_reporting_data($id_report, $date, $time, $return = array(); $report = db_get_row ('treport', 'id_report', $id_report); + $report["group"] = $report['id_group']; + $report["group_name"] = groups_get_name ($report['id_group']); + $report['contents'] = array(); + $datetime = strtotime($date . ' ' . $time); + $report["datetime"] = $datetime; switch ($config["dbtype"]) { case "mysql": @@ -120,16 +125,9 @@ function reporting_make_reporting_data($id_report, $date, $time, break; } if ($contents === false) { - return $return; + return reporting_check_structure_report($report); } - $report["group"] = $report['id_group']; - $report["group_name"] = groups_get_name ($report['id_group']); - - $datetime = strtotime($date . ' ' . $time); - $report["datetime"] = $datetime; - - $report['contents'] = array(); foreach ($contents as $content) { if (!empty($period)) { @@ -402,12 +400,136 @@ function reporting_make_reporting_data($id_report, $date, $time, $report, $content); break; + case 'event_report_group': + $report['contents'][] = reporting_event_report_group( + $report, + $content); + break; } } return reporting_check_structure_report($report); } +function reporting_event_report_group($report, $content) { + global $config; + + $return['type'] = 'event_report_group'; + + if (empty($content['name'])) { + $content['name'] = __('Event Report Group'); + } + + $return['title'] = $content['name']; + $return['subtitle'] = groups_get_name($content['id_group'], true); + if (!empty($content['style']['event_filter_search'])) { + $return['subtitle'] .= " (" . $content['style']['event_filter_search'] . ")"; + } + $return["description"] = $content["description"]; + $return["date"] = reporting_get_date_text($report, $content); + + + $filter_event_no_validated = $content['style']['filter_event_no_validated']; + $filter_event_validated = $content['style']['filter_event_validated']; + $filter_event_critical = $content['style']['filter_event_critical']; + $filter_event_warning = $content['style']['filter_event_warning']; + $filter_event_filter_search = $content['style']['event_filter_search']; + + $event_graph_by_agent = $content['style']['event_graph_by_agent']; + $event_graph_by_user_validator = $content['style']['event_graph_by_user_validator']; + $event_graph_by_criticity = $content['style']['event_graph_by_criticity']; + $event_graph_validated_vs_unvalidated = $content['style']['event_graph_validated_vs_unvalidated']; + + + $data = reporting_get_group_detailed_event( + $content['id_group'], $content['period'], $report["datetime"], + true, true, $filter_event_validated, $filter_event_critical, + $filter_event_warning, $filter_event_no_validated, + $filter_event_filter_search, 'hash'); + + if (empty($data)) { + $return['failed'] = __('No events'); + } + else { + $return['data'] = $data; + } + + $return['chart']['by_agent'] = null; + $return['chart']['by_user_validator'] = null; + $return['chart']['by_criticity'] = null; + $return['chart']['validated_vs_unvalidated'] = null; + + if ($event_graph_by_agent) { + $data_graph = reporting_get_count_events_by_agent( + $content['id_group'], $content['period'], + $report["datetime"], + $filter_event_validated, + $filter_event_critical, + $filter_event_warning, + $filter_event_no_validated, + $filter_event_filter_search); + + $return['chart']['by_agent']= pie3d_graph( + false, $data_graph, 500, 150, __("other"), "", + ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); + } + + if ($event_graph_by_user_validator) { + $data_graph = + reporting_get_count_events_validated_by_user( + array('id_group' => $content['id_group']), $content['period'], + $report["datetime"], + $filter_event_validated, + $filter_event_critical, + $filter_event_warning, + $filter_event_no_validated, + $filter_event_filter_search); + + $return['chart']['by_user_validator'] = pie3d_graph( + false, $data_graph, 500, 150, __("other"), "", + ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); + } + + if ($event_graph_by_criticity) { + $data_graph = reporting_get_count_events_by_criticity( + array('id_group' => $content['id_group']), $content['period'], + $report["datetime"], + $filter_event_validated, + $filter_event_critical, + $filter_event_warning, + $filter_event_no_validated, + $filter_event_filter_search); + + $colors = get_criticity_pie_colors($data_graph); + + $return['chart']['by_criticity'] = pie3d_graph( + false, $data_graph, 500, 150, __("other"), "", + ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size'], 1, false, $colors); + } + + if ($event_graph_validated_vs_unvalidated) { + $data_graph = + reporting_get_count_events_validated( + array('id_group' => $content['id_group']), $content['period'], + $report["datetime"], + $filter_event_validated, + $filter_event_critical, + $filter_event_warning, + $filter_event_no_validated, + $filter_event_filter_search); + + $return['chart']['validated_vs_unvalidated'] = pie3d_graph( + false, $data_graph, 500, 150, __("other"), "", + ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); + } + + return reporting_check_structure_content($return); +} + function reporting_event_report_module($report, $content) { global $config; @@ -3119,6 +3241,129 @@ function reporting_set_conf_charts(&$width, &$height, &$only_image, $type, //////////////////////////////////////////////////////////////////////// +/** + * Gets a detailed reporting of groups's events. + * + * @param unknown_type $id_group Id of the group. + * @param unknown_type $period Time period of the report. + * @param unknown_type $date Date of the report. + * @param unknown_type $return Whether to return or not. + * @param unknown_type $html Whether to return HTML code or not. + * + * @return string Report of groups's events + */ +function reporting_get_group_detailed_event ($id_group, $period = 0, + $date = 0, $return = false, $html = true, + $filter_event_validated = false, $filter_event_critical = false, + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_filter_search = null, $return_type = false) { + + global $config; + + if (!is_numeric ($date)) { + $date = strtotime ($date); + } + if (empty ($date)) { + $date = get_system_time (); + } + + $table->width = '99%'; + + $table->align = array(); + $table->align[0] = 'center'; + $table->align[2] = 'center'; + + $table->data = array (); + + $table->head = array (); + $table->head[0] = __('Status'); + $table->head[1] = __('Name'); + $table->head[2] = __('Type'); + $table->head[3] = __('Agent'); + $table->head[4] = __('Criticity'); + $table->head[5] = __('Val. by'); + $table->head[6] = __('Timestamp'); + + $events = events_get_group_events($id_group, $period, $date, + $filter_event_validated, $filter_event_critical, + $filter_event_warning, $filter_event_no_validated, + $filter_event_filter_search); + + if ($return_type === 'hash') { + return $events; + } + + if ($events) { + $note = ''; + if (count($events) >= 1000) { + $note .= '* ' . __('Maximum of events shown') . ' (1000)
'; + } + foreach ($events as $k => $event) { + //First pass along the class of this row + $table->cellclass[$k][1] = $table->cellclass[$k][3] = + $table->cellclass[$k][4] = $table->cellclass[$k][5] = + $table->cellclass[$k][6] = + get_priority_class ($event["criticity"]); + + $data = array (); + + // Colored box + switch ($event['estado']) { + case 0: + $img_st = "images/star.png"; + $title_st = __('New event'); + break; + case 1: + $img_st = "images/tick.png"; + $title_st = __('Event validated'); + break; + case 2: + $img_st = "images/hourglass.png"; + $title_st = __('Event in process'); + break; + } + $data[] = html_print_image ($img_st, true, + array ("class" => "image_status", + "width" => 16, + "title" => $title_st, + "id" => 'status_img_' . $event["id_evento"])); + + $data[] = ui_print_truncate_text( + io_safe_output($event['evento']), + 140, false, true); + + //$data[1] = $event['event_type']; + $data[] = events_print_type_img ($event["event_type"], true); + + if (!empty($event['id_agente'])) + $data[] = agents_get_name($event['id_agente']); + else + $data[] = __('Pandora System'); + $data[] = get_priority_name ($event['criticity']); + if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) { + $data[] = '' . __('System') . ''; + } + else { + $user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['id_usuario']); + $data[] = io_safe_output($user_name); + } + $data[] = '' . + date($config['date_format'], $event['timestamp_rep']) . + ''; + array_push ($table->data, $data); + } + + if ($html) { + return html_print_table ($table, $return) . $note; + } + else { + return $table; + } + } + else { + return false; + } +} /** * Get a detailed report of summarized events per agent diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index d57ba6153d..a410eb5df8 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -249,6 +249,9 @@ function reporting_html_print_report($report, $mini = false) { case 'event_report_module': reporting_html_event_report_module($table, $item); break; + case 'event_report_group': + reporting_html_event_report_group($table, $item); + break; } if ($item['type'] == 'agent_module') @@ -261,6 +264,141 @@ function reporting_html_print_report($report, $mini = false) { } } +function reporting_html_event_report_group($table, $item) { + global $config; + + if (!empty($item['failed'])) { + $table->colspan['events']['cell'] = 3; + $table->data['events']['cell'] = $item['failed']; + } + else { + $table1->width = '99%'; + + $table1->align = array(); + $table1->align[0] = 'center'; + $table1->align[2] = 'center'; + + $table1->data = array (); + + $table1->head = array (); + $table1->head[0] = __('Status'); + $table1->head[1] = __('Name'); + $table1->head[2] = __('Type'); + $table1->head[3] = __('Agent'); + $table1->head[4] = __('Criticity'); + $table1->head[5] = __('Val. by'); + $table1->head[6] = __('Timestamp'); + + foreach ($item['data'] as $k => $event) { + //First pass along the class of this row + $table1->cellclass[$k][1] = $table1->cellclass[$k][3] = + $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = + $table1->cellclass[$k][6] = + get_priority_class ($event["criticity"]); + + $data = array (); + + // Colored box + switch ($event['estado']) { + case 0: + $img_st = "images/star.png"; + $title_st = __('New event'); + break; + case 1: + $img_st = "images/tick.png"; + $title_st = __('Event validated'); + break; + case 2: + $img_st = "images/hourglass.png"; + $title_st = __('Event in process'); + break; + } + $data[] = html_print_image ($img_st, true, + array ("class" => "image_status", + "width" => 16, + "title" => $title_st, + "id" => 'status_img_' . $event["id_evento"])); + + $data[] = ui_print_truncate_text( + io_safe_output($event['evento']), + 140, false, true); + + //$data[1] = $event['event_type']; + $data[] = events_print_type_img ($event["event_type"], true); + + if (!empty($event['id_agente'])) + $data[] = agents_get_name($event['id_agente']); + else + $data[] = __('Pandora System'); + $data[] = get_priority_name ($event['criticity']); + if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) { + $data[] = '' . __('System') . ''; + } + else { + $user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['id_usuario']); + $data[] = io_safe_output($user_name); + } + $data[] = '' . + date($config['date_format'], $event['timestamp_rep']) . + ''; + array_push ($table1->data, $data); + } + + $table->colspan['events']['cell'] = 3; + $table->data['events']['cell'] = html_print_table($table1, true); + + + + if (!empty($item['chart']['by_agent'])) { + $table1 = null; + $table1->width = '99%'; + $table1->head = array (); + $table1->head[0] = __('Events by agent'); + $table1->data[0][0] = $item['chart']['by_agent']; + + $table->colspan['chart_by_agent']['cell'] = 3; + $table->cellstyle['chart_by_agent']['cell'] = 'text-align: center;'; + $table->data['chart_by_agent']['cell'] = html_print_table($table1, true); + } + + if (!empty($item['chart']['by_user_validator'])) { + $table1 = null; + $table1->width = '99%'; + $table1->head = array (); + $table1->head[0] = __('Events by user validator'); + $table1->data[0][0] = $item['chart']['by_user_validator']; + + $table->colspan['chart_by_user_validator']['cell'] = 3; + $table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;'; + $table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true); + } + + if (!empty($item['chart']['by_criticity'])) { + $table1 = null; + $table1->width = '99%'; + $table1->head = array (); + $table1->head[0] = __('Events by criticity'); + $table1->data[0][0] = $item['chart']['by_criticity']; + + $table->colspan['chart_by_criticity']['cell'] = 3; + $table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;'; + $table->data['chart_by_criticity']['cell'] = html_print_table($table1, true); + } + + if (!empty($item['chart']['validated_vs_unvalidated'])) { + $table1 = null; + $table1->width = '99%'; + $table1->head = array (); + $table1->head[0] = __('Events validated vs unvalidated'); + $table1->data[0][0] = $item['chart']['validated_vs_unvalidated']; + + $table->colspan['chart_validated_vs_unvalidated']['cell'] = 3; + $table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;'; + $table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true); + } + } +} + function reporting_html_event_report_module($table, $item) { global $config; @@ -3557,123 +3695,6 @@ function reporting_agents_get_group_agents_detailed ($id_group, $period = 0, $da } -/** - * Gets a detailed reporting of groups's events. - * - * @param unknown_type $id_group Id of the group. - * @param unknown_type $period Time period of the report. - * @param unknown_type $date Date of the report. - * @param unknown_type $return Whether to return or not. - * @param unknown_type $html Whether to return HTML code or not. - * - * @return string Report of groups's events - */ -function reporting_get_group_detailed_event ($id_group, $period = 0, - $date = 0, $return = false, $html = true, - $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { - - global $config; - - if (!is_numeric ($date)) { - $date = strtotime ($date); - } - if (empty ($date)) { - $date = get_system_time (); - } - - $table->width = '99%'; - - $table->align = array(); - $table->align[0] = 'center'; - $table->align[2] = 'center'; - - $table->data = array (); - - $table->head = array (); - $table->head[0] = __('Status'); - $table->head[1] = __('Name'); - $table->head[2] = __('Type'); - $table->head[3] = __('Agent'); - $table->head[4] = __('Criticity'); - $table->head[5] = __('Val. by'); - $table->head[6] = __('Timestamp'); - - $events = events_get_group_events($id_group, $period, $date, - $filter_event_validated, $filter_event_critical, - $filter_event_warning, $filter_event_no_validated); - - if ($events) { - $note = ''; - if (count($events) >= 1000) { - $note .= '* ' . __('Maximum of events shown') . ' (1000)
'; - } - foreach ($events as $k => $event) { - //First pass along the class of this row - $table->cellclass[$k][1] = $table->cellclass[$k][3] = - $table->cellclass[$k][4] = $table->cellclass[$k][5] = - $table->cellclass[$k][6] = - get_priority_class ($event["criticity"]); - - $data = array (); - - // Colored box - switch ($event['estado']) { - case 0: - $img_st = "images/star.png"; - $title_st = __('New event'); - break; - case 1: - $img_st = "images/tick.png"; - $title_st = __('Event validated'); - break; - case 2: - $img_st = "images/hourglass.png"; - $title_st = __('Event in process'); - break; - } - $data[] = html_print_image ($img_st, true, - array ("class" => "image_status", - "width" => 16, - "title" => $title_st, - "id" => 'status_img_' . $event["id_evento"])); - - $data[] = ui_print_truncate_text( - io_safe_output($event['evento']), - 140, false, true); - - //$data[1] = $event['event_type']; - $data[] = events_print_type_img ($event["event_type"], true); - - if (!empty($event['id_agente'])) - $data[] = agents_get_name($event['id_agente']); - else - $data[] = __('Pandora System'); - $data[] = get_priority_name ($event['criticity']); - if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) { - $data[] = '' . __('System') . ''; - } - else { - $user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['id_usuario']); - $data[] = io_safe_output($user_name); - } - $data[] = '' . - date($config['date_format'], $event['timestamp_rep']) . - ''; - array_push ($table->data, $data); - } - - if ($html) { - return html_print_table ($table, $return) . $note; - } - else { - return $table; - } - } - else { - return false; - } -} @@ -4379,158 +4400,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; - case 'event_report_group': - if (empty($item_title)) { - $item_title = __('Group detailed event'); - } - reporting_header_content($mini, $content, $report, $table, $item_title, - ui_print_truncate_text(groups_get_name($content['id_group'], true), 60, false)); - - $next_row = 1; - - // Put description at the end of the module (if exists) - if ($content["description"] != "") { - $data_desc = array(); - $data_desc[0] = $content["description"]; - array_push ($table->data, $data_desc); - $table->colspan[$next_row][0] = 3; - $next_row++; - } - - $data = array (); - - $style = json_decode(io_safe_output($content['style']), true); - - $filter_event_no_validated = $style['filter_event_no_validated']; - $filter_event_validated = $style['filter_event_validated']; - $filter_event_critical = $style['filter_event_critical']; - $filter_event_warning = $style['filter_event_warning']; - - $event_graph_by_agent = $style['event_graph_by_agent']; - $event_graph_by_user_validator = $style['event_graph_by_user_validator']; - $event_graph_by_criticity = $style['event_graph_by_criticity']; - $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; - - $data[0] = reporting_get_group_detailed_event( - $content['id_group'], $content['period'], - $report["datetime"], true, true, - $filter_event_validated, - $filter_event_critical, - $filter_event_warning, - $filter_event_no_validated); - if(!empty($data[0])) { - array_push ($table->data, $data); - - $table->colspan[$next_row][0] = 3; - $next_row++; - } - - if ($event_graph_by_agent) { - $data_graph = reporting_get_count_events_by_agent( - $content['id_group'], $content['period'], - $report["datetime"], - $filter_event_validated, - $filter_event_critical, - $filter_event_warning, - $filter_event_no_validated); - - $table_event_graph = null; - $table_event_graph->width = '100%'; - $table_event_graph->style[0] = 'text-align: center;'; - $table_event_graph->head[0] = __('Events by agent'); - - $table_event_graph->data[0][0] = pie3d_graph( - false, $data_graph, 500, 150, __("other"), "", - ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); - - $data[0] = html_print_table($table_event_graph, true); - - $table->colspan[$next_row][0] = 3; - $next_row++; - array_push ($table->data, $data); - } - - if ($event_graph_by_user_validator) { - $data_graph = reporting_get_count_events_validated_by_user( - array('id_group' => $content['id_group']), $content['period'], - $report["datetime"], - $filter_event_validated, - $filter_event_critical, - $filter_event_warning, - $filter_event_no_validated); - - $table_event_graph = null; - $table_event_graph->head[0] = __('Events validated by user'); - $table_event_graph->width = '100%'; - $table_event_graph->style[0] = 'text-align: center;'; - - $table_event_graph->data[0][0] = pie3d_graph( - false, $data_graph, 500, 150, __("other"), "", - ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); - - $data[0] = html_print_table($table_event_graph, true); - - $table->colspan[$next_row][0] = 3; - $next_row++; - array_push ($table->data, $data); - } - - if ($event_graph_by_criticity) { - $data_graph = reporting_get_count_events_by_criticity( - array('id_group' => $content['id_group']), $content['period'], - $report["datetime"], - $filter_event_validated, - $filter_event_critical, - $filter_event_warning, - $filter_event_no_validated); - - $colors = get_criticity_pie_colors($data_graph); - - $table_event_graph = null; - $table_event_graph->head[0] = __('Events by criticity'); - $table_event_graph->width = '100%'; - $table_event_graph->style[0] = 'text-align: center;'; - - $table_event_graph->data[0][0] = pie3d_graph( - false, $data_graph, 500, 150, __("other"), "", - ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size'], 1, false, $colors); - - $data[0] = html_print_table($table_event_graph, true); - - $table->colspan[$next_row][0] = 3; - $next_row++; - array_push ($table->data, $data); - } - - if ($event_graph_validated_vs_unvalidated) { - $data_graph = reporting_get_count_events_validated( - array('id_group' => $content['id_group']), $content['period'], - $report["datetime"], - $filter_event_validated, - $filter_event_critical, - $filter_event_warning, - $filter_event_no_validated); - - $table_event_graph = null; - $table_event_graph->head[0] = __('Amount events validated'); - $table_event_graph->width = '100%'; - $table_event_graph->style[0] = 'text-align: center;'; - - $table_event_graph->data[0][0] = pie3d_graph( - false, $data_graph, 500, 150, __("other"), "", - ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size']); - - $data[0] = html_print_table($table_event_graph, true); - - $table->colspan[$next_row][0] = 3; - $next_row++; - array_push ($table->data, $data); - } - break; + case 'top_n': $top_n = $content['top_n']; @@ -4942,7 +4812,8 @@ function reporting_template_graphs_get_user ($id_user = 0, $only_names = false, function reporting_get_count_events_by_agent ($id_group, $period = 0, $date = 0, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_filter_search = null) { if (!is_numeric ($date)) { $date = strtotime ($date); @@ -4953,7 +4824,8 @@ function reporting_get_count_events_by_agent ($id_group, $period = 0, return events_get_count_events_by_agent($id_group, $period, $date, $filter_event_validated, $filter_event_critical, - $filter_event_warning, $filter_event_no_validated); + $filter_event_warning, $filter_event_no_validated, + $filter_event_filter_search); } /** @@ -4970,7 +4842,8 @@ function reporting_get_count_events_by_agent ($id_group, $period = 0, function reporting_get_count_events_validated_by_user ($filter, $period = 0, $date = 0, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { if (!is_numeric ($date)) { $date = strtotime ($date); @@ -4981,7 +4854,7 @@ function reporting_get_count_events_validated_by_user ($filter, $period = 0, return events_get_count_events_validated_by_user($filter, $period, $date, $filter_event_validated, $filter_event_critical, - $filter_event_warning, $filter_event_no_validated); + $filter_event_warning, $filter_event_no_validated, $filter_event_search); } /** @@ -4998,7 +4871,8 @@ function reporting_get_count_events_validated_by_user ($filter, $period = 0, function reporting_get_count_events_by_criticity ($filter, $period = 0, $date = 0, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { if (!is_numeric ($date)) { $date = strtotime ($date); @@ -5009,7 +4883,8 @@ function reporting_get_count_events_by_criticity ($filter, $period = 0, return events_get_count_events_by_criticity($filter, $period, $date, $filter_event_validated, $filter_event_critical, - $filter_event_warning, $filter_event_no_validated); + $filter_event_warning, $filter_event_no_validated, + $filter_event_search); } /** @@ -5026,7 +4901,8 @@ function reporting_get_count_events_by_criticity ($filter, $period = 0, function reporting_get_count_events_validated ($filter, $period = 0, $date = 0, $filter_event_validated = false, $filter_event_critical = false, - $filter_event_warning = false, $filter_event_no_validated = false) { + $filter_event_warning = false, $filter_event_no_validated = false, + $filter_event_search = false) { if (!is_numeric ($date)) { $date = strtotime ($date); @@ -5037,7 +4913,8 @@ function reporting_get_count_events_validated ($filter, $period = 0, return events_get_count_events_validated($filter, $period, $date, $filter_event_validated, $filter_event_critical, - $filter_event_warning, $filter_event_no_validated); + $filter_event_warning, $filter_event_no_validated, + $filter_event_search); } function reporting_get_agents_by_status ($data, $graph_width = 250, $graph_height = 150, $links = false) {