Working in the refactoring the code of reports (text).

This commit is contained in:
mdtrooper 2015-03-25 16:58:53 +01:00
parent 803c03956d
commit bc791ad3be
2 changed files with 34 additions and 20 deletions

View File

@ -168,12 +168,37 @@ function reporting_make_reporting_data($id_report, $date, $time,
$force_width_chart,
$force_height_chart);
break;
case 'text':
$report['contents'][] = reporting_text(
$report,
$content);
break;
}
}
return reporting_check_structure_report($report);
}
function reporting_text($report, $content) {
global $config;
$return = array();
$return['type'] = 'text';
if (empty($content['name'])) {
$content['name'] = __('Text');
}
$return['title'] = $content['name'];
$return["description"] = $content["description"];
$return["date"] = reporting_get_date_text();
$return["data"] = html_entity_decode($content['text']);
return reporting_check_structure_content($return);
}
function reporting_sql($report, $content) {
global $config;

View File

@ -137,6 +137,9 @@ function reporting_html_print_report($report, $mini = false) {
case 'custom_graph':
reporting_html_custom_graph($table, $item);
break;
case 'text':
reporting_html_text($table, $item);
break;
}
if ($item['type'] == 'agent_module')
@ -149,6 +152,12 @@ function reporting_html_print_report($report, $mini = false) {
}
}
function reporting_html_text(&$table, $item) {
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: left;';
$table->data['data']['cell'] = $item['data'];
}
function reporting_html_general(&$table, $item) {
if (!empty($item["data"])) {
@ -4057,26 +4066,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data);
}
break;
case 'text':
if (empty($item_title)) {
$item_title = __('Text');
}
reporting_header_content($mini, $content, $report, $table, $item_title,
"", "");
$next_row = 1;
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++;
}
$data[0] = html_entity_decode($content['text']);
array_push($table->data, $data);
$table->colspan[$next_row][0] = 3;
break;
case 'sql_graph_vbar':
case 'sql_graph_hbar':