fixed pdf reports events

This commit is contained in:
daniel 2017-01-18 10:37:08 +01:00
parent 99aa41b32a
commit 8006c1fc0b
3 changed files with 169 additions and 54 deletions

View File

@ -1287,7 +1287,7 @@ function events_get_agent ($id_agent, $period, $date = 0,
if (!empty($filter_event_severity)) { if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) { foreach ($filter_event_severity as $key => $value) {
switch ($value) { switch ($value) {
case 'all': case -1:
$severity_all = 1; $severity_all = 1;
break; break;
case 34: case 34:
@ -2619,7 +2619,7 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
if (!empty($filter_event_severity)) { if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) { foreach ($filter_event_severity as $key => $value) {
switch ($value) { switch ($value) {
case 'all': case -1:
$severity_all = 1; $severity_all = 1;
break; break;
case 34: case 34:
@ -2764,7 +2764,7 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
if (!empty($filter_event_severity)) { if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) { foreach ($filter_event_severity as $key => $value) {
switch ($value) { switch ($value) {
case 'all': case -1:
$severity_all = 1; $severity_all = 1;
break; break;
case 34: case 34:
@ -2907,7 +2907,7 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
if (!empty($filter_event_severity)) { if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) { foreach ($filter_event_severity as $key => $value) {
switch ($value) { switch ($value) {
case 'all': case -1:
$severity_all = 1; $severity_all = 1;
break; break;
case 34: case 34:
@ -3063,7 +3063,7 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
if (!empty($filter_event_severity)) { if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) { foreach ($filter_event_severity as $key => $value) {
switch ($value) { switch ($value) {
case 'all': case -1:
$severity_all = 1; $severity_all = 1;
break; break;
case 34: case 34:

View File

@ -450,7 +450,8 @@ function reporting_make_reporting_data($report = null, $id_report,
$content, $content,
$type, $type,
$force_width_chart, $force_width_chart,
$force_height_chart); $force_height_chart,
$pdf);
break; break;
case 'event_report_group': case 'event_report_group':
$report['contents'][] = reporting_event_report_group( $report['contents'][] = reporting_event_report_group(
@ -1429,11 +1430,16 @@ function reporting_event_report_group($report, $content,
function reporting_event_report_module($report, $content, function reporting_event_report_module($report, $content,
$type = 'dinamic', $force_width_chart = null, $type = 'dinamic', $force_width_chart = null,
$force_height_chart = null) { $force_height_chart = null, $pdf=0) {
global $config; global $config;
$ttl = 1; if($pdf){
$ttl = 2;
}
else{
$ttl = 1;
}
$return['type'] = 'event_report_module'; $return['type'] = 'event_report_module';

View File

@ -746,7 +746,7 @@ function reporting_html_top_n($table, $item) {
} }
} }
function reporting_html_event_report_group($table, $item) { function reporting_html_event_report_group($table, $item, $pdf = 0) {
global $config; global $config;
if (!empty($item['failed'])) { if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3; $table->colspan['events']['cell'] = 3;
@ -858,8 +858,15 @@ function reporting_html_event_report_group($table, $item) {
array_push ($table1->data, $data); array_push ($table1->data, $data);
} }
$table->colspan['events']['cell'] = 3; if($pdf){
$table->data['events']['cell'] = html_print_table($table1, 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'])) { if (!empty($item['chart']['by_agent'])) {
$table1 = new stdClass(); $table1 = new stdClass();
@ -868,9 +875,16 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events by agent'); $table1->head[0] = __('Events by agent');
$table1->data[0][0] = $item['chart']['by_agent']; $table1->data[0][0] = $item['chart']['by_agent'];
$table->colspan['chart_by_agent']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_agent']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_agent']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_user_validator'])) {
@ -880,9 +894,16 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events by user validator'); $table1->head[0] = __('Events by user validator');
$table1->data[0][0] = $item['chart']['by_user_validator']; $table1->data[0][0] = $item['chart']['by_user_validator'];
$table->colspan['chart_by_user_validator']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_criticity'])) {
@ -892,9 +913,16 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events by Severity'); $table1->head[0] = __('Events by Severity');
$table1->data[0][0] = $item['chart']['by_criticity']; $table1->data[0][0] = $item['chart']['by_criticity'];
$table->colspan['chart_by_criticity']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['validated_vs_unvalidated'])) {
@ -904,14 +932,25 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events validated vs unvalidated'); $table1->head[0] = __('Events validated vs unvalidated');
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated']; $table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3; if($pdf){
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true); $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;
} }
} }
} }
function reporting_html_event_report_module($table, $item) { 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 (!empty($item['failed'])) {
@ -993,9 +1032,15 @@ function reporting_html_event_report_module($table, $item) {
$table1->data[] = $data; $table1->data[] = $data;
} }
} }
if($pdf){
$table->colspan['events']['cell'] = 3; $table1->class = 'table-beauty';
$table->data['events']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_agent'])) {
$table1 = new stdClass(); $table1 = new stdClass();
@ -1004,9 +1049,16 @@ function reporting_html_event_report_module($table, $item) {
$table1->head[0] = __('Events by agent'); $table1->head[0] = __('Events by agent');
$table1->data[0][0] = $item['chart']['by_agent']; $table1->data[0][0] = $item['chart']['by_agent'];
$table->colspan['chart_by_agent']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_agent']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_agent']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_user_validator'])) {
@ -1016,9 +1068,16 @@ function reporting_html_event_report_module($table, $item) {
$table1->head[0] = __('Events by user validator'); $table1->head[0] = __('Events by user validator');
$table1->data[0][0] = $item['chart']['by_user_validator']; $table1->data[0][0] = $item['chart']['by_user_validator'];
$table->colspan['chart_by_user_validator']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_criticity'])) {
@ -1028,9 +1087,16 @@ function reporting_html_event_report_module($table, $item) {
$table1->head[0] = __('Events by Severity'); $table1->head[0] = __('Events by Severity');
$table1->data[0][0] = $item['chart']['by_criticity']; $table1->data[0][0] = $item['chart']['by_criticity'];
$table->colspan['chart_by_criticity']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['validated_vs_unvalidated'])) {
@ -1040,9 +1106,20 @@ function reporting_html_event_report_module($table, $item) {
$table1->head[0] = __('Events validated vs unvalidated'); $table1->head[0] = __('Events validated vs unvalidated');
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated']; $table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3; if($pdf){
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true); $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;
} }
} }
} }
@ -1461,7 +1538,7 @@ function reporting_html_group_report($table, $item) {
</table>"; </table>";
} }
function reporting_html_event_report_agent($table, $item) { function reporting_html_event_report_agent($table, $item, $pdf = 0) {
global $config; global $config;
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
@ -1547,9 +1624,16 @@ function reporting_html_event_report_agent($table, $item) {
array_push ($table1->data, $data); array_push ($table1->data, $data);
} }
$table->colspan['event_list']['cell'] = 3; if($pdf){
$table->cellstyle['event_list']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['event_list']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_user_validator'])) {
$table1 = new stdClass(); $table1 = new stdClass();
@ -1558,9 +1642,16 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[0] = __('Events validated by user'); $table1->head[0] = __('Events validated by user');
$table1->data[0][0] = $item['chart']['by_user_validator']; $table1->data[0][0] = $item['chart']['by_user_validator'];
$table->colspan['chart_by_user_validator']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['by_criticity'])) {
@ -1570,9 +1661,16 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[0] = __('Events by severity'); $table1->head[0] = __('Events by severity');
$table1->data[0][0] = $item['chart']['by_criticity']; $table1->data[0][0] = $item['chart']['by_criticity'];
$table->colspan['chart_by_criticity']['cell'] = 3; if($pdf){
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true); $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'])) { if (!empty($item['chart']['validated_vs_unvalidated'])) {
@ -1582,9 +1680,20 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[0] = __('Amount events validated'); $table1->head[0] = __('Amount events validated');
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated']; $table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3; if($pdf){
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;'; $table1->class = 'table-beauty';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true); $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;
} }
} }