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

View File

@ -450,7 +450,8 @@ function reporting_make_reporting_data($report = null, $id_report,
$content,
$type,
$force_width_chart,
$force_height_chart);
$force_height_chart,
$pdf);
break;
case '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,
$type = 'dinamic', $force_width_chart = null,
$force_height_chart = null) {
$force_height_chart = null, $pdf=0) {
global $config;
if($pdf){
$ttl = 2;
}
else{
$ttl = 1;
}
$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;
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
@ -858,8 +858,15 @@ function reporting_html_event_report_group($table, $item) {
array_push ($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();
@ -868,10 +875,17 @@ function reporting_html_event_report_group($table, $item) {
$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();
@ -880,10 +894,17 @@ function reporting_html_event_report_group($table, $item) {
$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();
@ -892,10 +913,17 @@ function reporting_html_event_report_group($table, $item) {
$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();
@ -904,14 +932,25 @@ function reporting_html_event_report_group($table, $item) {
$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;
}
}
}
function reporting_html_event_report_module($table, $item) {
function reporting_html_event_report_module($table, $item, $pdf = 0) {
global $config;
$show_summary_group = $item['show_summary_group'];
if (!empty($item['failed'])) {
@ -993,9 +1032,15 @@ function reporting_html_event_report_module($table, $item) {
$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();
@ -1004,10 +1049,17 @@ function reporting_html_event_report_module($table, $item) {
$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();
@ -1016,10 +1068,17 @@ function reporting_html_event_report_module($table, $item) {
$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();
@ -1028,10 +1087,17 @@ function reporting_html_event_report_module($table, $item) {
$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();
@ -1040,11 +1106,22 @@ function reporting_html_event_report_module($table, $item) {
$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;
}
}
}
}
@ -1461,7 +1538,7 @@ function reporting_html_group_report($table, $item) {
</table>";
}
function reporting_html_event_report_agent($table, $item) {
function reporting_html_event_report_agent($table, $item, $pdf = 0) {
global $config;
$table1 = new stdClass();
$table1->width = '99%';
@ -1547,9 +1624,16 @@ function reporting_html_event_report_agent($table, $item) {
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();
@ -1558,10 +1642,17 @@ function reporting_html_event_report_agent($table, $item) {
$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();
@ -1570,10 +1661,17 @@ function reporting_html_event_report_agent($table, $item) {
$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();
@ -1582,10 +1680,21 @@ function reporting_html_event_report_agent($table, $item) {
$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;
}
}
function reporting_html_historical_data($table, $item) {