fixed errors in reports evnts

This commit is contained in:
daniel 2017-02-02 10:13:58 +01:00
parent 707381284e
commit 5dad591b02
4 changed files with 395 additions and 331 deletions

View File

@ -1146,16 +1146,11 @@ switch ($action) {
$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':
case 'event_report_agent':
$style['event_filter_search'] = $event_filter_search;
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
}
$style['event_filter_search'] = $event_filter_search;
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
case 'simple_graph':
// Warning. We are using this column to hold this value to avoid

View File

@ -1315,6 +1315,8 @@ function events_get_agent ($id_agent, $period, $date = 0,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -2647,6 +2649,8 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -2792,6 +2796,8 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -2935,6 +2941,8 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -3091,6 +3099,8 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}

View File

@ -1418,7 +1418,7 @@ function reporting_event_report_group($report, $content,
}
//total_events
if(isset($return['data'])){
if($return['data'] != ''){
$return['total_events'] = count($return['data']);
}
else{
@ -1496,6 +1496,14 @@ function reporting_event_report_module($report, $content,
if ($config['metaconsole']) {
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);
}
@ -2306,7 +2314,7 @@ function reporting_event_report_agent($report, $content,
}
//total_events
if(isset($return['data'])){
if($return['data'] != ''){
$return['total_events'] = count($return['data']);
}
else{

View File

@ -163,13 +163,9 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) {
$table->data['description_row']['description'] = $item['description'];
if($item['type']=='event_report_agent' || $item['type']=='event_report_group'){
if($item['description'] != '' && $item['description'] != null){
$table->data['description_row']['description'] .= " - ";
}
$table->data['description_row']['description'] .= "Total events: ".$item["total_events"];
if($item['type']=='event_report_agent' || $item['type']=='event_report_group' || $item['type']=='event_report_module'){
$table->data['count_row']['count'] = "Total events: ".$item["total_events"];
}
$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) {
global $config;
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed'];
}
else {
if($item['total_events']){
$table1 = new stdClass();
$table1->width = '99%';
@ -865,7 +857,6 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
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']))
@ -892,8 +883,14 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
}
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 .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
@ -981,181 +978,215 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
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) {
global $config;
$show_summary_group = $item['show_summary_group'];
if (!empty($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 ();
if($show_summary_group){
$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)){
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;
}
if($item['total_events']){
if (!empty($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;';
$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{
$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;
}
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);
}
}
$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);
if($pdf){
return $pdf_export;
$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{
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_inventory_changes($table, $item) {
@ -1573,160 +1604,180 @@ function reporting_html_group_report($table, $item) {
function reporting_html_event_report_agent($table, $item, $pdf = 0) {
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 ();
$table1->head = 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) {
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->data = array ();
$table1->head = array ();
$table1->head[0] = __('Status');
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"]);
$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) {
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{
$table1->cellclass[$i][1] =
$table1->cellclass[$i][3] =
$table1->cellclass[$i][4] =
$table1->cellclass[$i][5] =
get_priority_class ($event["criticity"]);
$table->colspan['event_list']['cell'] = 3;
$table->cellstyle['event_list']['cell'] = 'text-align: center;';
$table->data['event_list']['cell'] = html_print_table($table1, true);
}
$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'];
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){
$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] = __('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);
}
}
$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>';
if($pdf){
return $pdf_export;
}
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){
$table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true);
$pdf_export .= '<br>';
}
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){
$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] = __('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;
$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;
}
}
}