Working in the refactoring the code of reports (max_value).
This commit is contained in:
parent
958b9c8ce3
commit
13e78e44eb
|
@ -179,12 +179,42 @@ function reporting_make_reporting_data($id_report, $date, $time,
|
|||
$content,
|
||||
$type);
|
||||
break;
|
||||
case 'max_value':
|
||||
$report['contents'][] = reporting_max_value(
|
||||
$report,
|
||||
$content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return reporting_check_structure_report($report);
|
||||
}
|
||||
|
||||
function reporting_max_value($report, $content) {
|
||||
global $config;
|
||||
|
||||
$return = array();
|
||||
$return['type'] = 'max_value';
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Max. Value');
|
||||
}
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return["description"] = $content["description"];
|
||||
$return["date"] = reporting_get_date_text();
|
||||
|
||||
$value = reporting_get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
|
||||
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content ['id_agent_module']);
|
||||
|
||||
$return['data'] = array(
|
||||
'value' => $value,
|
||||
'formated_value' => format_for_graph($value, 2) . " " . $unit);
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
function reporting_url($report, $content, $type = 'dinamic') {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -143,6 +143,9 @@ function reporting_html_print_report($report, $mini = false) {
|
|||
case 'url':
|
||||
reporting_html_url($table, $item, $key);
|
||||
break;
|
||||
case 'max_value':
|
||||
reporting_html_max_value($table, $item, $mini);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'agent_module')
|
||||
|
@ -155,6 +158,22 @@ function reporting_html_print_report($report, $mini = false) {
|
|||
}
|
||||
}
|
||||
|
||||
function reporting_html_max_value($table, $item, $mini) {
|
||||
if ($mini) {
|
||||
$font_size = '1.5';
|
||||
}
|
||||
else {
|
||||
$font_size = '3';
|
||||
}
|
||||
|
||||
$table->colspan['data']['cell'] = 3;
|
||||
$table->cellstyle['data']['cell'] = 'text-align: left;';
|
||||
$table->data['data']['cell'] =
|
||||
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: #000000;">' .
|
||||
$item['data']['formated_value'] .
|
||||
'</p>';
|
||||
}
|
||||
|
||||
function reporting_html_url(&$table, $item, $key) {
|
||||
$table->colspan['data']['cell'] = 3;
|
||||
$table->cellstyle['data']['cell'] = 'text-align: left;';
|
||||
|
@ -3851,36 +3870,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
array_push ($table->data, $data);
|
||||
|
||||
break;
|
||||
case 8:
|
||||
case 'max_value':
|
||||
if (empty($item_title)) {
|
||||
$item_title = __('Max. Value');
|
||||
}
|
||||
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
|
||||
|
||||
// Put description at the end of the module (if exists)
|
||||
$table->colspan[1][0] = 3;
|
||||
if ($content["description"] != ""){
|
||||
$data_desc = array();
|
||||
$data_desc[0] = $content["description"];
|
||||
array_push ($table->data, $data_desc);
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
$table->colspan[2][0] = 3;
|
||||
|
||||
$value = reporting_get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
|
||||
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content ['id_agent_module']);
|
||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">' .
|
||||
format_for_graph($value, 2) . " " . $unit .'</p>';
|
||||
array_push ($table->data, $data);
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
case 'min_value':
|
||||
if (empty($item_title)) {
|
||||
|
|
Loading…
Reference in New Issue