mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
[Netflow live] Removed aggregate and resolution from report content and move to header subtitle
Former-commit-id: 205e5f8ff7633016fe83667b2fc237bc1bdae03f
This commit is contained in:
parent
e91335ae21
commit
60870efad6
pandora_console/include
@ -1099,11 +1099,6 @@ function netflow_draw_item(
|
||||
}
|
||||
|
||||
if ($output == 'HTML' || $output == 'PDF') {
|
||||
$html .= ' <b>'.__('Aggregate').':</b> '.netflow_format_aggregate($aggregate);
|
||||
if ($interval_length != 0) {
|
||||
$html .= ' <b>'._('Resolution').':</b> '.netflow_get_resolution_name($interval_length);
|
||||
}
|
||||
|
||||
$html .= graph_netflow_aggregate_area(
|
||||
$data,
|
||||
$interval,
|
||||
@ -1140,11 +1135,6 @@ function netflow_draw_item(
|
||||
}
|
||||
|
||||
if ($output == 'HTML' || $output == 'PDF') {
|
||||
$html .= ' <b>'.__('Aggregate').':</b> '.netflow_format_aggregate($aggregate);
|
||||
if ($interval_length != 0) {
|
||||
$html .= ' <b>'._('Resolution').':</b> '.netflow_get_resolution_name($interval_length);
|
||||
}
|
||||
|
||||
$html .= "<div style='width: 100%; overflow: auto;'>";
|
||||
$html .= netflow_data_table($data, $start_date, $end_date, $aggregate);
|
||||
$html .= '</div>';
|
||||
@ -1219,16 +1209,10 @@ function netflow_draw_item(
|
||||
}
|
||||
|
||||
if ($output == 'HTML') {
|
||||
$html .= ' <b>'.__('Aggregate').':</b> '.netflow_format_aggregate($aggregate);
|
||||
$html .= graph_netflow_aggregate_pie($data_pie, netflow_format_aggregate($aggregate));
|
||||
return $html;
|
||||
} else if ($output == 'PDF') {
|
||||
$html .= ' <b>'.__('Aggregate').':</b> '.$aggregate;
|
||||
$html .= graph_netflow_aggregate_pie($data_pie, netflow_format_aggregate($aggregate), 2, true);
|
||||
return $html;
|
||||
} else if ($output == 'XML') {
|
||||
$xml .= '<aggregate>'.$aggregate."</aggregate>\n";
|
||||
$xml .= netflow_aggregate_pie_xml($data_pie);
|
||||
return $xml;
|
||||
}
|
||||
break;
|
||||
@ -1264,7 +1248,6 @@ function netflow_draw_item(
|
||||
$html .= '<tr>';
|
||||
$html .= '<td>';
|
||||
$html .= netflow_summary_table($data_summary);
|
||||
$html .= ' <b>'.__('Aggregate').':</b> '.netflow_format_aggregate($aggregate);
|
||||
$html .= '</td>';
|
||||
$html .= '<td>';
|
||||
$html .= graph_netflow_aggregate_pie($data_pie, netflow_format_aggregate($aggregate));
|
||||
@ -1789,3 +1772,32 @@ function netflow_get_resolution_name($value)
|
||||
$resolutions = netflow_resolution_select_params();
|
||||
return (isset($resolutions[$value])) ? $resolutions[$value] : __('Unknown');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Report formatted subtitle.
|
||||
*
|
||||
* @param string $aggreagate Aggregate by param.
|
||||
* @param string $resolution Netfow live view resolution.
|
||||
* @param string $type Type of view.
|
||||
*
|
||||
* @return string HTML with formatted subtitle.
|
||||
*/
|
||||
function netflow_generate_subtitle_report($aggregate, $resolution, $type)
|
||||
{
|
||||
$subt = __(
|
||||
'Agregate by %s',
|
||||
netflow_format_aggregate($aggregate)
|
||||
);
|
||||
|
||||
// Display the resolution only in required reports.
|
||||
if (in_array($type, ['netflow_area', 'netflow_data']) === true) {
|
||||
$subt .= ' - ';
|
||||
$subt .= __(
|
||||
'Resolution %s',
|
||||
netflow_get_resolution_name($resolution)
|
||||
);
|
||||
}
|
||||
|
||||
return $subt;
|
||||
}
|
||||
|
@ -3964,6 +3964,20 @@ function reporting_monitor_report($report, $content)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the data structure to build a netflow report.
|
||||
*
|
||||
* @param array $report Global report info.
|
||||
* @param array $content Report item info.
|
||||
* @param string $type Report type (static, dynamic, data).
|
||||
* @param integer $force_width_chart Fixed width chart.
|
||||
* @param integer $force_height_chart Fixed height chart.
|
||||
* @param string $type_netflow One of netflow_area, netflow_pie,
|
||||
* netflow_data, netflow_statistics, netflow_summary.
|
||||
* @param boolean $pdf True if a pdf report is generating.
|
||||
*
|
||||
* @return array Report item structure.
|
||||
*/
|
||||
function reporting_netflow(
|
||||
$report,
|
||||
$content,
|
||||
@ -3995,6 +4009,10 @@ function reporting_netflow(
|
||||
case 'netflow_summary':
|
||||
$return['type'] = 'netflow_summary';
|
||||
break;
|
||||
|
||||
default:
|
||||
$return['type'] = 'unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($content['name'])) {
|
||||
@ -4018,6 +4036,10 @@ function reporting_netflow(
|
||||
case 'netflow_summary':
|
||||
$content['name'] = __('Netflow Summary');
|
||||
break;
|
||||
|
||||
default:
|
||||
$content['name'] = __('Unknown report');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4025,7 +4047,7 @@ function reporting_netflow(
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
// Get chart
|
||||
// Get chart.
|
||||
reporting_set_conf_charts(
|
||||
$width,
|
||||
$height,
|
||||
@ -4043,7 +4065,7 @@ function reporting_netflow(
|
||||
$height = $force_height_chart;
|
||||
}
|
||||
|
||||
// Get item filters
|
||||
// Get item filters.
|
||||
$filter = db_get_row_sql(
|
||||
"SELECT *
|
||||
FROM tnetflow_filter
|
||||
@ -4068,9 +4090,17 @@ function reporting_netflow(
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
$return['subtitle'] = netflow_generate_subtitle_report(
|
||||
$filter['aggregate'],
|
||||
$content['top_n'],
|
||||
$type_netflow
|
||||
);
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user