mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
fixed errors in reports evnts
This commit is contained in:
parent
707381284e
commit
5dad591b02
@ -1146,16 +1146,11 @@ switch ($action) {
|
|||||||
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
|
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
|
||||||
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
|
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
|
||||||
|
|
||||||
switch ($values['type']) {
|
$style['event_filter_search'] = $event_filter_search;
|
||||||
case 'event_report_group':
|
if ($label != '')
|
||||||
case 'event_report_agent':
|
$style['label'] = $label;
|
||||||
$style['event_filter_search'] = $event_filter_search;
|
else
|
||||||
if ($label != '')
|
$style['label'] = '';
|
||||||
$style['label'] = $label;
|
|
||||||
else
|
|
||||||
$style['label'] = '';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'simple_graph':
|
case 'simple_graph':
|
||||||
// Warning. We are using this column to hold this value to avoid
|
// Warning. We are using this column to hold this value to avoid
|
||||||
|
@ -1315,6 +1315,8 @@ function events_get_agent ($id_agent, $period, $date = 0,
|
|||||||
case -1:
|
case -1:
|
||||||
$status_all = 1;
|
$status_all = 1;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$filter_event_status[$key] = ('0, 2');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2647,6 +2649,8 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
|
|||||||
case -1:
|
case -1:
|
||||||
$status_all = 1;
|
$status_all = 1;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$filter_event_status[$key] = ('0, 2');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2792,6 +2796,8 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
|
|||||||
case -1:
|
case -1:
|
||||||
$status_all = 1;
|
$status_all = 1;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$filter_event_status[$key] = ('0, 2');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2935,6 +2941,8 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
|
|||||||
case -1:
|
case -1:
|
||||||
$status_all = 1;
|
$status_all = 1;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$filter_event_status[$key] = ('0, 2');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3091,6 +3099,8 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
|
|||||||
case -1:
|
case -1:
|
||||||
$status_all = 1;
|
$status_all = 1;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$filter_event_status[$key] = ('0, 2');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1418,7 +1418,7 @@ function reporting_event_report_group($report, $content,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//total_events
|
//total_events
|
||||||
if(isset($return['data'])){
|
if($return['data'] != ''){
|
||||||
$return['total_events'] = count($return['data']);
|
$return['total_events'] = count($return['data']);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -1497,6 +1497,14 @@ function reporting_event_report_module($report, $content,
|
|||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//total_events
|
||||||
|
if($return['data'][0]['data'] != ''){
|
||||||
|
$return['total_events'] = count($return['data'][0]['data']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$return['total_events'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2306,7 +2314,7 @@ function reporting_event_report_agent($report, $content,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//total_events
|
//total_events
|
||||||
if(isset($return['data'])){
|
if($return['data'] != ''){
|
||||||
$return['total_events'] = count($return['data']);
|
$return['total_events'] = count($return['data']);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -163,13 +163,9 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) {
|
|||||||
|
|
||||||
$table->data['description_row']['description'] = $item['description'];
|
$table->data['description_row']['description'] = $item['description'];
|
||||||
|
|
||||||
if($item['type']=='event_report_agent' || $item['type']=='event_report_group'){
|
if($item['type']=='event_report_agent' || $item['type']=='event_report_group' || $item['type']=='event_report_module'){
|
||||||
if($item['description'] != '' && $item['description'] != null){
|
|
||||||
|
|
||||||
$table->data['description_row']['description'] .= " - ";
|
$table->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
|
|
||||||
}
|
|
||||||
$table->data['description_row']['description'] .= "Total events: ".$item["total_events"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan['description_row']['description'] = 3;
|
$table->colspan['description_row']['description'] = 3;
|
||||||
@ -781,11 +777,7 @@ function reporting_html_top_n($table, $item) {
|
|||||||
|
|
||||||
function reporting_html_event_report_group($table, $item, $pdf = 0) {
|
function reporting_html_event_report_group($table, $item, $pdf = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
if (!empty($item['failed'])) {
|
if($item['total_events']){
|
||||||
$table->colspan['events']['cell'] = 3;
|
|
||||||
$table->data['events']['cell'] = $item['failed'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
|
|
||||||
@ -865,7 +857,6 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
|
|||||||
io_safe_output($event['evento']),
|
io_safe_output($event['evento']),
|
||||||
140, false, true);
|
140, false, true);
|
||||||
|
|
||||||
//$data[1] = $event['event_type'];
|
|
||||||
$data[] = events_print_type_img ($event["event_type"], true);
|
$data[] = events_print_type_img ($event["event_type"], true);
|
||||||
|
|
||||||
if (!empty($event['id_agente']))
|
if (!empty($event['id_agente']))
|
||||||
@ -892,8 +883,14 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($pdf){
|
if($pdf){
|
||||||
|
$table0 = new stdClass();
|
||||||
|
$table0->width = '99%';
|
||||||
|
$table0->class = 'table-beauty';
|
||||||
|
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
|
$pdf_export = html_print_table($table0, true);
|
||||||
|
|
||||||
$table1->class = 'table-beauty';
|
$table1->class = 'table-beauty';
|
||||||
$pdf_export = html_print_table($table1, true);
|
$pdf_export .= html_print_table($table1, true);
|
||||||
$pdf_export .= '<br>';
|
$pdf_export .= '<br>';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -981,179 +978,213 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
|
|||||||
return $pdf_export;
|
return $pdf_export;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if($pdf){
|
||||||
|
$table0 = new stdClass();
|
||||||
|
$table0->width = '99%';
|
||||||
|
$table0->class = 'table-beauty';
|
||||||
|
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
|
$pdf_export = html_print_table($table0, true);
|
||||||
|
|
||||||
|
return $pdf_export;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reporting_html_event_report_module($table, $item, $pdf = 0) {
|
function reporting_html_event_report_module($table, $item, $pdf = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
$show_summary_group = $item['show_summary_group'];
|
$show_summary_group = $item['show_summary_group'];
|
||||||
if (!empty($item['failed'])) {
|
if($item['total_events']){
|
||||||
$table->colspan['events']['cell'] = 3;
|
if (!empty($item['failed'])) {
|
||||||
$table->data['events']['cell'] = $item['failed'];
|
$table->colspan['events']['cell'] = 3;
|
||||||
|
$table->data['events']['cell'] = $item['failed'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach ($item['data'] as $item) {
|
||||||
|
$table1 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->data = array ();
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->align = array();
|
||||||
|
$table1->align[2] = 'center';
|
||||||
|
if($show_summary_group){
|
||||||
|
$table1->head[0] = __('Status');
|
||||||
|
$table1->head[1] = __('Event name');
|
||||||
|
$table1->head[2] = __('Type');
|
||||||
|
$table1->head[3] = __('Severity');
|
||||||
|
$table1->head[4] = __('Count');
|
||||||
|
$table1->head[5] = __('Timestamp');
|
||||||
|
$table1->style[0] = 'text-align: center;';
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$table1->head[0] = __('Status');
|
||||||
|
$table1->head[1] = __('Event name');
|
||||||
|
$table1->head[2] = __('Type');
|
||||||
|
$table1->head[3] = __('Severity');
|
||||||
|
$table1->head[4] = __('Timestamp');
|
||||||
|
$table1->style[0] = 'text-align: center;';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($item['data']) || is_object($item['data'])){
|
||||||
|
$item_data = array_reverse($item['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($item_data) || is_object($item_data)){
|
||||||
|
foreach ($item_data as $i => $event) {
|
||||||
|
$data = array();
|
||||||
|
if($show_summary_group){
|
||||||
|
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] =
|
||||||
|
$table1->cellclass[$i][3] = $table1->cellclass[$i][4] =
|
||||||
|
$table1->cellclass[$i][5] = get_priority_class($event["criticity"]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$table1->cellclass[$i][1] =
|
||||||
|
$table1->cellclass[$i][3] =
|
||||||
|
$table1->cellclass[$i][4] = get_priority_class($event["criticity"]);
|
||||||
|
}
|
||||||
|
// 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[0] = html_print_image ($img_st, true,
|
||||||
|
array ("class" => "image_status",
|
||||||
|
"width" => 16,
|
||||||
|
"title" => $title_st,
|
||||||
|
"id" => 'status_img_' . $event["id_evento"]));
|
||||||
|
$data[1] = io_safe_output($event['evento']);
|
||||||
|
$data[2] = events_print_type_img ($event["event_type"], true);
|
||||||
|
$data[3] = get_priority_name ($event['criticity']);
|
||||||
|
if($show_summary_group){
|
||||||
|
$data[4] = $event['event_rep'];
|
||||||
|
$data[5] = date($config['date_format'], $event['timestamp_rep']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$data[4] = date($config['date_format'], strtotime($event['timestamp']));
|
||||||
|
}
|
||||||
|
$table1->data[] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($pdf){
|
||||||
|
$table0 = new stdClass();
|
||||||
|
$table0->width = '99%';
|
||||||
|
$table0->class = 'table-beauty';
|
||||||
|
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
|
$pdf_export = html_print_table($table0, true);
|
||||||
|
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$table->colspan['events']['cell'] = 3;
|
||||||
|
$table->data['events']['cell'] = html_print_table($table1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item['chart']['by_agent'])) {
|
||||||
|
$table1 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Events by agent');
|
||||||
|
$table1->data[0][0] = $item['chart']['by_agent'];
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Events by user validator');
|
||||||
|
$table1->data[0][0] = $item['chart']['by_user_validator'];
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Events by Severity');
|
||||||
|
$table1->data[0][0] = $item['chart']['by_criticity'];
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Events validated vs unvalidated');
|
||||||
|
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
return $pdf_export;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
foreach ($item['data'] as $item) {
|
if($pdf){
|
||||||
$table1 = new stdClass();
|
$table0 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table0->width = '99%';
|
||||||
$table1->data = array ();
|
$table0->class = 'table-beauty';
|
||||||
$table1->head = array ();
|
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
if($show_summary_group){
|
$pdf_export = html_print_table($table0, true);
|
||||||
$table1->head[0] = __('Status');
|
|
||||||
$table1->head[1] = __('Event name');
|
|
||||||
$table1->head[2] = __('Event type');
|
|
||||||
$table1->head[3] = __('Severity');
|
|
||||||
$table1->head[4] = __('Count');
|
|
||||||
$table1->head[5] = __('Timestamp');
|
|
||||||
$table1->style[0] = 'text-align: center;';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$table1->head[0] = __('Status');
|
|
||||||
$table1->head[1] = __('Event name');
|
|
||||||
$table1->head[2] = __('Event type');
|
|
||||||
$table1->head[3] = __('Severity');
|
|
||||||
$table1->head[4] = __('Timestamp');
|
|
||||||
$table1->style[0] = 'text-align: center;';
|
|
||||||
}
|
|
||||||
$table->data['tatal_events']['cell'] = "Total events: ".$item["total_events"];
|
|
||||||
if (is_array($item['data']) || is_object($item['data'])){
|
|
||||||
$item_data = array_reverse($item['data']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($item_data) || is_object($item_data)){
|
return $pdf_export;
|
||||||
foreach ($item_data as $i => $event) {
|
|
||||||
$data = array();
|
|
||||||
if($show_summary_group){
|
|
||||||
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] =
|
|
||||||
$table1->cellclass[$i][3] = $table1->cellclass[$i][4] =
|
|
||||||
$table1->cellclass[$i][5] = get_priority_class($event["criticity"]);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] =
|
|
||||||
$table1->cellclass[$i][3] =
|
|
||||||
$table1->cellclass[$i][4] = get_priority_class($event["criticity"]);
|
|
||||||
}
|
|
||||||
// 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[0] = html_print_image ($img_st, true,
|
|
||||||
array ("class" => "image_status",
|
|
||||||
"width" => 16,
|
|
||||||
"title" => $title_st,
|
|
||||||
"id" => 'status_img_' . $event["id_evento"]));
|
|
||||||
$data[1] = io_safe_output($event['evento']);
|
|
||||||
$data[2] = $event['event_type'];
|
|
||||||
$data[3] = get_priority_name ($event['criticity']);
|
|
||||||
if($show_summary_group){
|
|
||||||
$data[4] = $event['event_rep'];
|
|
||||||
$data[5] = date($config['date_format'], $event['timestamp_rep']);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$data[4] = date($config['date_format'], strtotime($event['timestamp']));
|
|
||||||
}
|
|
||||||
$table1->data[] = $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export = html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$table->colspan['events']['cell'] = 3;
|
|
||||||
$table->data['events']['cell'] = html_print_table($table1, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item['chart']['by_agent'])) {
|
|
||||||
$table1 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Events by agent');
|
|
||||||
$table1->data[0][0] = $item['chart']['by_agent'];
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export .= html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$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 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Events by user validator');
|
|
||||||
$table1->data[0][0] = $item['chart']['by_user_validator'];
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export .= html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$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 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Events by Severity');
|
|
||||||
$table1->data[0][0] = $item['chart']['by_criticity'];
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export .= html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$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 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Events validated vs unvalidated');
|
|
||||||
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export .= html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
return $pdf_export;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1573,160 +1604,180 @@ function reporting_html_group_report($table, $item) {
|
|||||||
|
|
||||||
function reporting_html_event_report_agent($table, $item, $pdf = 0) {
|
function reporting_html_event_report_agent($table, $item, $pdf = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
$table1 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->align = array();
|
|
||||||
$table1->align[0] = 'center';
|
|
||||||
$table1->align[1] = 'center';
|
|
||||||
$table1->align[3] = 'center';
|
|
||||||
|
|
||||||
$table1->data = array ();
|
if($item['total_events'] != 0){
|
||||||
|
$table1 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->align = array();
|
||||||
|
$table1->align[0] = 'center';
|
||||||
|
$table1->align[1] = 'center';
|
||||||
|
$table1->align[3] = 'center';
|
||||||
|
|
||||||
$table1->head = array ();
|
$table1->data = array ();
|
||||||
$table1->head[0] = __('Status');
|
|
||||||
if($item['show_summary_group']){
|
|
||||||
$table1->head[1] = __('Count');
|
|
||||||
}
|
|
||||||
$table1->head[2] = __('Name');
|
|
||||||
$table1->head[3] = __('Type');
|
|
||||||
$table1->head[4] = __('Severity');
|
|
||||||
$table1->head[5] = __('Val. by');
|
|
||||||
$table1->head[6] = __('Timestamp');
|
|
||||||
|
|
||||||
foreach ($item['data'] as $i => $event) {
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Status');
|
||||||
if($item['show_summary_group']){
|
if($item['show_summary_group']){
|
||||||
$table1->cellclass[$i][1] =
|
$table1->head[1] = __('Count');
|
||||||
$table1->cellclass[$i][2] =
|
}
|
||||||
$table1->cellclass[$i][4] =
|
$table1->head[2] = __('Name');
|
||||||
$table1->cellclass[$i][5] =
|
$table1->head[3] = __('Type');
|
||||||
$table1->cellclass[$i][6] =
|
$table1->head[4] = __('Severity');
|
||||||
get_priority_class ($event["criticity"]);
|
$table1->head[5] = __('Val. by');
|
||||||
|
$table1->head[6] = __('Timestamp');
|
||||||
|
|
||||||
|
foreach ($item['data'] as $i => $event) {
|
||||||
|
if($item['show_summary_group']){
|
||||||
|
$table1->cellclass[$i][1] =
|
||||||
|
$table1->cellclass[$i][2] =
|
||||||
|
$table1->cellclass[$i][4] =
|
||||||
|
$table1->cellclass[$i][5] =
|
||||||
|
$table1->cellclass[$i][6] =
|
||||||
|
get_priority_class ($event["criticity"]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$table1->cellclass[$i][1] =
|
||||||
|
$table1->cellclass[$i][3] =
|
||||||
|
$table1->cellclass[$i][4] =
|
||||||
|
$table1->cellclass[$i][5] =
|
||||||
|
get_priority_class ($event["criticity"]);
|
||||||
|
}
|
||||||
|
$data = array ();
|
||||||
|
// Colored box
|
||||||
|
switch ($event['status']) {
|
||||||
|
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));
|
||||||
|
|
||||||
|
if($item['show_summary_group']){
|
||||||
|
$data[] = $event['count'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[] = ui_print_truncate_text(
|
||||||
|
io_safe_output($event['name']),
|
||||||
|
140, false, true);
|
||||||
|
//$data[] = $event['event_type'];
|
||||||
|
$data[] = events_print_type_img ($event["type"], true);
|
||||||
|
|
||||||
|
$data[] = get_priority_name ($event['criticity']);
|
||||||
|
if (empty($event['validated_by']) && $event['status'] == EVENT_VALIDATE) {
|
||||||
|
$data[] = '<i>' . __('System') . '</i>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['validated_by']);
|
||||||
|
$data[] = io_safe_output($user_name);
|
||||||
|
}
|
||||||
|
if($item['show_summary_group']){
|
||||||
|
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], $event['timestamp']) . '</font>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], strtotime($event['timestamp'])) . '</font>';
|
||||||
|
}
|
||||||
|
array_push ($table1->data, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table0 = new stdClass();
|
||||||
|
$table0->width = '99%';
|
||||||
|
$table0->class = 'table-beauty';
|
||||||
|
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
|
$pdf_export = html_print_table($table0, true);
|
||||||
|
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$table1->cellclass[$i][1] =
|
$table->colspan['event_list']['cell'] = 3;
|
||||||
$table1->cellclass[$i][3] =
|
$table->cellstyle['event_list']['cell'] = 'text-align: center;';
|
||||||
$table1->cellclass[$i][4] =
|
$table->data['event_list']['cell'] = html_print_table($table1, true);
|
||||||
$table1->cellclass[$i][5] =
|
|
||||||
get_priority_class ($event["criticity"]);
|
|
||||||
}
|
|
||||||
$data = array ();
|
|
||||||
// Colored box
|
|
||||||
switch ($event['status']) {
|
|
||||||
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));
|
|
||||||
|
|
||||||
if($item['show_summary_group']){
|
|
||||||
$data[] = $event['count'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[] = ui_print_truncate_text(
|
if (!empty($item['chart']['by_user_validator'])) {
|
||||||
io_safe_output($event['name']),
|
$table1 = new stdClass();
|
||||||
140, false, true);
|
$table1->width = '99%';
|
||||||
//$data[] = $event['event_type'];
|
$table1->head = array ();
|
||||||
$data[] = events_print_type_img ($event["type"], true);
|
$table1->head[0] = __('Events validated by user');
|
||||||
|
$table1->data[0][0] = $item['chart']['by_user_validator'];
|
||||||
|
|
||||||
$data[] = get_priority_name ($event['criticity']);
|
if($pdf){
|
||||||
if (empty($event['validated_by']) && $event['status'] == EVENT_VALIDATE) {
|
$table1->class = 'table-beauty';
|
||||||
$data[] = '<i>' . __('System') . '</i>';
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['validated_by']);
|
|
||||||
$data[] = io_safe_output($user_name);
|
|
||||||
}
|
|
||||||
if($item['show_summary_group']){
|
|
||||||
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], $event['timestamp']) . '</font>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], strtotime($event['timestamp'])) . '</font>';
|
|
||||||
}
|
|
||||||
array_push ($table1->data, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($pdf){
|
if (!empty($item['chart']['by_criticity'])) {
|
||||||
$table1->class = 'table-beauty';
|
$table1 = new stdClass();
|
||||||
$pdf_export = html_print_table($table1, true);
|
$table1->width = '99%';
|
||||||
$pdf_export .= '<br>';
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Events by severity');
|
||||||
|
$table1->data[0][0] = $item['chart']['by_criticity'];
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Amount events validated');
|
||||||
|
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
$table1->class = 'table-beauty';
|
||||||
|
$pdf_export .= html_print_table($table1, true);
|
||||||
|
$pdf_export .= '<br>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($pdf){
|
||||||
|
return $pdf_export;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$table->colspan['event_list']['cell'] = 3;
|
|
||||||
$table->cellstyle['event_list']['cell'] = 'text-align: center;';
|
|
||||||
$table->data['event_list']['cell'] = html_print_table($table1, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item['chart']['by_user_validator'])) {
|
|
||||||
$table1 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Events validated by user');
|
|
||||||
$table1->data[0][0] = $item['chart']['by_user_validator'];
|
|
||||||
|
|
||||||
if($pdf){
|
if($pdf){
|
||||||
$table1->class = 'table-beauty';
|
$table0 = new stdClass();
|
||||||
$pdf_export .= html_print_table($table1, true);
|
$table0->width = '99%';
|
||||||
$pdf_export .= '<br>';
|
$table0->class = 'table-beauty';
|
||||||
}
|
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
|
||||||
else{
|
$pdf_export = html_print_table($table0, true);
|
||||||
$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'])) {
|
return $pdf_export;
|
||||||
$table1 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Events by severity');
|
|
||||||
$table1->data[0][0] = $item['chart']['by_criticity'];
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export .= html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
$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 = new stdClass();
|
|
||||||
$table1->width = '99%';
|
|
||||||
$table1->head = array ();
|
|
||||||
$table1->head[0] = __('Amount events validated');
|
|
||||||
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
$table1->class = 'table-beauty';
|
|
||||||
$pdf_export .= html_print_table($table1, true);
|
|
||||||
$pdf_export .= '<br>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($pdf){
|
|
||||||
return $pdf_export;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user