mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Working in the refactoring the code of reports (summatory).
This commit is contained in:
parent
4924556a21
commit
1a6a5539c1
pandora_console/include
@ -197,6 +197,12 @@ function reporting_make_reporting_data($id_report, $date, $time,
|
||||
$content,
|
||||
'min');
|
||||
break;
|
||||
case 'sumatory':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'sum');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,6 +223,9 @@ function reporting_value($report, $content, $type) {
|
||||
case 'avg':
|
||||
$return['type'] = 'avg_value';
|
||||
break;
|
||||
case 'sum':
|
||||
$return['type'] = 'sumatory';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -231,6 +240,9 @@ function reporting_value($report, $content, $type) {
|
||||
case 'avg':
|
||||
$content['name'] = __('AVG. Value');
|
||||
break;
|
||||
case 'sum':
|
||||
$content['name'] = __('Summatory');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,6 +269,10 @@ function reporting_value($report, $content, $type) {
|
||||
$value = reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'sum':
|
||||
$value = reporting_get_agentmodule_data_sum(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
}
|
||||
|
||||
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content ['id_agent_module']);
|
||||
|
@ -152,6 +152,9 @@ function reporting_html_print_report($report, $mini = false) {
|
||||
case 'min_value':
|
||||
reporting_html_min_value($table, $item, $mini);
|
||||
break;
|
||||
case 'sumatory':
|
||||
reporting_html_sum_value($table, $item, $mini);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'agent_module')
|
||||
@ -164,6 +167,10 @@ function reporting_html_print_report($report, $mini = false) {
|
||||
}
|
||||
}
|
||||
|
||||
function reporting_html_sum_value(&$table, $item, $mini) {
|
||||
reporting_html_value($table, $item, $mini);
|
||||
}
|
||||
|
||||
function reporting_html_avg_value(&$table, $item, $mini) {
|
||||
reporting_html_value($table, $item, $mini);
|
||||
}
|
||||
@ -3856,45 +3863,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
case 'sumatory':
|
||||
if (empty($item_title)) {
|
||||
$item_title = __('Summatory');
|
||||
}
|
||||
reporting_header_content($mini, $content, $report, $table, $item_title,
|
||||
ui_print_truncate_text($agent_name, 'agent_medium', false) .
|
||||
' <br> ' . ui_print_truncate_text($module_name, 'module_medium', false));
|
||||
|
||||
//RUNNING
|
||||
|
||||
$next_row = 1;
|
||||
|
||||
// Put description at the end of the module (if exists)
|
||||
if ($content["description"] != "") {
|
||||
$data_desc = array();
|
||||
$data_desc[0] = $content["description"];
|
||||
array_push ($table->data, $data_desc);
|
||||
$table->colspan[$next_row][0] = 3;
|
||||
$next_row++;
|
||||
}
|
||||
|
||||
$table->colspan[$next_row][0] = 3;
|
||||
|
||||
$data = array ();
|
||||
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
|
||||
|
||||
$value = reporting_get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if ($value === false) {
|
||||
$value = __('Unknown');
|
||||
}
|
||||
else {
|
||||
$value = format_for_graph($value, 2) . " " . $unit;
|
||||
}
|
||||
|
||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
||||
array_push ($table->data, $data);
|
||||
|
||||
break;
|
||||
case 'agent_detailed_event':
|
||||
case 'event_report_agent':
|
||||
if (empty($item_title)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user