Added new report item 'historical data' for to get a raw data of module'

This commit is contained in:
mdtrooper 2015-08-05 14:05:53 +02:00
parent 2f98c1fc86
commit dd9c2029e2
4 changed files with 69 additions and 2 deletions

View File

@ -313,6 +313,13 @@ switch ($action) {
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
case 'historical_data':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
case 'text':
$description = $item['description'];
$text = $item['text'];
@ -2302,6 +2309,14 @@ function chooseType() {
$("#row_show_in_two_columns").show();
break;
case 'historical_data':
$("#row_description").show();
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
break;
case 'agent_detailed':
$("#row_description").show();
$("#row_agent").show();

View File

@ -3716,6 +3716,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$item_title = $content['name'];
switch ($content["type"]) {
case 1:
case 'simple_graph':
@ -4013,7 +4015,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->colspan[1][0] = 3;
$data = array();
require_once ($config["homedir"] . '/include/functions_graph.php');
$data[0] = graphic_combined_module(
$modules,
@ -4736,6 +4738,50 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
array_push ($table->data, $data);
break;
case 'historical_data':
if (empty($item_title)) {
$item_title = __('Historical data');
}
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;
$table2->class = 'databox alternate';
$table2->width = '100%';
$table2->head = array(__('Date'), __('Data'));
$table2->data = array();
$datelimit = $report["datetime"] - $content['period'];
$result = modules_get_raw_data($content['id_agent_module'],
$datelimit, $report["datetime"]);
foreach ($result as $row) {
$table2->data[] = array(
date ($config["date_format"], $row['utimestamp']),
$row['datos']);
}
$cellContent = html_print_table($table2, true);
array_push($table->data, array($cellContent));
break;
case 10:
case 'sumatory':
@ -4760,7 +4806,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
$table->colspan[$next_row][0] = 3;
$data = array ();
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);

View File

@ -557,6 +557,8 @@ function reports_get_report_types ($template = false, $not_editor = false) {
'name' => __('Serialize data'));
$types['sumatory'] = array('optgroup' => __('Modules'),
'name' => __('Summatory'));
$types['historical_data'] = array('optgroup' => __('Modules'),
'name' => __('Historical Data'));
@ -616,6 +618,8 @@ function reports_get_report_types ($template = false, $not_editor = false) {
}
}
if (!$template) {
$types['agent_configuration'] = array('optgroup' => __('Configuration'),
'name' => __('Agent configuration'));

View File

@ -304,6 +304,8 @@ if ($contents === false) {
return;
}
foreach ($contents as $content) {
$table->data = array ();
$table->head = array ();