add pdf to report interfaces

This commit is contained in:
daniel 2017-02-28 18:06:23 +01:00
parent 25db947d20
commit 909637c1f8
2 changed files with 38 additions and 11 deletions

@ -399,7 +399,8 @@ function reporting_make_reporting_data($report = null, $id_report,
case 'network_interfaces_report':
$report['contents'][] = reporting_network_interfaces_report(
$report,
$content);
$content,
$type);
break;
case 'group_configuration':
$report['contents'][] = reporting_group_configuration(
@ -2583,11 +2584,11 @@ function reporting_group_configuration($report, $content) {
return reporting_check_structure_content($return);
}
function reporting_network_interfaces_report($report, $content,
$type = 'dinamic', $force_width_chart = null, $force_height_chart = null) {
function reporting_network_interfaces_report($report, $content, $type = 'dinamic') {
global $config;
$return['type'] = 'network_interfaces_report';
if (empty($content['name'])) {
@ -2646,7 +2647,6 @@ function reporting_network_interfaces_report($report, $content,
switch ($type) {
case 'dinamic':
case 'static':
if (!empty($interface['traffic'])) {
$row_interface['chart'] = custom_graphs_print(0,
$height,
@ -2665,10 +2665,31 @@ function reporting_network_interfaces_report($report, $content,
true,
true,
true,
$ttl);
1);
}
break;
case 'data':
case 'static':
if (!empty($interface['traffic'])) {
$row_interface['chart'] = custom_graphs_print(0,
$height,
$width,
$content['period'],
null,
true,
$report["datetime"],
true,
'white',
array_values($interface['traffic']),
$config['homeurl'],
array_keys($interface['traffic']),
array_fill(0, count($interface['traffic']), __("bytes/s")),
false,
true,
true,
true,
2);
}
break;
}
@ -2678,7 +2699,6 @@ function reporting_network_interfaces_report($report, $content,
$return['data'][] = $row_data;
}
}
return reporting_check_structure_content($return);
}

@ -1871,7 +1871,7 @@ function reporting_html_group_configuration($table, $item) {
$table->data['group_configuration']['cell'] = $cell;
}
function reporting_html_network_interfaces_report($table, $item) {
function reporting_html_network_interfaces_report($table, $item, $pdf= false) {
if (!empty($item['failed'])) {
$table->colspan['interfaces']['cell'] = 3;
@ -1891,7 +1891,9 @@ function reporting_html_network_interfaces_report($table, $item) {
$table_agent->style[0] = 'text-align: center';
$table_agent->data['interfaces'] = "";
if($pdf){
$return_pdf .= __("Agent") . " " . $agent['agent'];
}
foreach ($agent['interfaces'] as $interface) {
$table_interface = new StdClass();
$table_interface->width = '100%';
@ -1907,7 +1909,7 @@ function reporting_html_network_interfaces_report($table, $item) {
$table_interface->style['ip'] = 'text-align: center';
$table_interface->style['mac'] = 'text-align: center';
$table_interface->style['status'] = 'width: 150px; text-align: center';
$data = array();
$data['ip'] = !empty($interface['ip']) ? $interface['ip'] : "--";
$data['mac'] = !empty($interface['mac']) ? $interface['mac'] : "--";
@ -1919,7 +1921,10 @@ function reporting_html_network_interfaces_report($table, $item) {
$table_interface->colspan['graph'][0] = 3;
$table_interface->cellstyle['graph'][0] = 'text-align: center;';
}
if($pdf){
$table_interface->class = 'table-beauty';
$return_pdf .= html_print_table($table_interface, true);
}
$table_agent->data['interfaces'] .= html_print_table($table_interface, true);
$table_agent->colspan[$interface_name][0] = 3;
}
@ -1927,9 +1932,11 @@ function reporting_html_network_interfaces_report($table, $item) {
$id = uniqid();
$table->colspan[$id][0] = 3;
$table->data[$id] = html_print_table($table_agent, true);
}
}
if($pdf){
return $return_pdf;
}
}
/**