2012-03-22 Miguel de Dios <miguel.dedios@artica.es>

& Sergio Martin <sergio.martin@artica.es> using Gobby collaborative
	real-time editor http://obby.0x539.de
	
	* include/functions.php: changed into the function "get_report_types" the
	array types to tree for show better the select box, and changed into the
	function "get_report_name".
	
	* include/functions_forecast.php: fixed into the function
	"forecast_projection_graph" when zero data and change to user the user conf
	style for the dates.

	* include/functions_html.php: the function "html_debug_print" was improved
	to show type and sizes.

	* include/functions_reporting.php: renamed the function "header_content" to
	"reporting_header_content" and in this function change to use the user conf
	style for the dates.
	
	* include/functions_networkmap.php: cleaned source code style.
	
	Merged from the branch pandora_4.0
	



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5816 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-03-22 12:14:15 +00:00
parent ecc1c1a362
commit d68b6be81e
6 changed files with 221 additions and 125 deletions

View File

@ -1,3 +1,27 @@
2012-03-22 Miguel de Dios <miguel.dedios@artica.es>
& Sergio Martin <sergio.martin@artica.es> using Gobby collaborative
real-time editor http://obby.0x539.de
* include/functions.php: changed into the function "get_report_types" the
array types to tree for show better the select box, and changed into the
function "get_report_name".
* include/functions_forecast.php: fixed into the function
"forecast_projection_graph" when zero data and change to user the user conf
style for the dates.
* include/functions_html.php: the function "html_debug_print" was improved
to show type and sizes.
* include/functions_reporting.php: renamed the function "header_content" to
"reporting_header_content" and in this function change to use the user conf
style for the dates.
* include/functions_networkmap.php: cleaned source code style.
Merged from the branch pandora_4.0
2012-03-22 Sergio Martin <sergio.martin@artica.es> 2012-03-22 Sergio Martin <sergio.martin@artica.es>
* godmode/reporting/graph_builder.php: Reallocate * godmode/reporting/graph_builder.php: Reallocate

View File

@ -528,9 +528,10 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
* @return int The current time minus the seconds given. * @return int The current time minus the seconds given.
*/ */
function human_date_relative ($seconds) { function human_date_relative ($seconds) {
$ahora=date("Y/m/d H:i:s"); $ahora = date("Y/m/d H:i:s");
$ahora_s = date("U"); $ahora_s = date("U");
$ayer = date ("Y/m/d H:i:s", $ahora_s - $seconds); $ayer = date ("Y/m/d H:i:s", $ahora_s - $seconds);
return $ayer; return $ayer;
} }
@ -549,6 +550,7 @@ function render_time ($lapse) {
$output .= "00"; $output .= "00";
else else
$output .= $mymin; $output .= $mymin;
return $output; return $output;
} }
@ -569,7 +571,7 @@ function get_parameterBetweenListValues ($name, $values, $default) {
// POST has precedence // POST has precedence
if (isset($_POST[$name])) if (isset($_POST[$name]))
$parameter = get_parameter_post ($name, $default); $parameter = get_parameter_post ($name, $default);
if (isset($_GET[$name])) if (isset($_GET[$name]))
$parameter = get_parameter_get ($name, $default); $parameter = get_parameter_get ($name, $default);
@ -737,58 +739,105 @@ function get_report_types () {
global $config; global $config;
$types = array (); $types = array ();
$types['simple_graph'] = __('Simple graph');
if($config['enterprise_installed']) {
$types['simple_baseline_graph'] = __('Simple baseline graph');
}
$types['custom_graph'] = __('Custom graph');
$types['SLA'] = __('S.L.A.');
$types['monitor_report'] = __('Monitor report');
$types['avg_value'] = __('Avg. Value');
$types['max_value'] = __('Max. Value');
$types['min_value'] = __('Min. Value');
$types['sumatory'] = __('Summatory');
//$types['agent_detailed'] = __('Agent detailed view');
$types['text'] = __ ('Text');
$types['simple_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Simple graph'));
if($config['enterprise_installed']) {
$types['simple_baseline_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Simple baseline graph'));
}
$types['custom_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Custom graph'));
# Only pandora managers have access to the whole database # Only pandora managers have access to the whole database
if (check_acl ($config['id_user'], 0, "PM")) { if (check_acl ($config['id_user'], 0, "PM")) {
$types['sql'] = __('SQL query'); $types['sql_graph_vbar'] = array('optgroup' => __('Graphs'),
$types['sql_graph_vbar'] = __('SQL vertical bar graph'); 'name' => __('SQL vertical bar graph'));
$types['sql_graph_pie'] = __('SQL pie graph'); $types['sql_graph_pie'] = array('optgroup' => __('Graphs'),
$types['sql_graph_hbar'] = __('SQL horizonal bar graph'); 'name' => __('SQL pie graph'));
$types['sql_graph_hbar'] = array('optgroup' => __('Graphs'),
'name' => __('SQL horizonal bar graph'));
} }
$types['url'] = __('Import text from URL');
$types['database_serialized'] = __('Serialize data');
$types['TTRT'] = __('TTRT'); $types['TTRT'] = array('optgroup' => __('ITIL'),
$types['TTO'] = __('TTO'); 'name' => __('TTRT'));
$types['MTBF'] = __('MTBF'); $types['TTO'] = array('optgroup' => __('ITIL'),
$types['MTTR'] = __('MTTR'); 'name' => __('TTO'));
$types['alert_report_module'] = __('Alert report module'); $types['MTBF'] = array('optgroup' => __('ITIL'),
$types['alert_report_agent'] = __('Alert report agent'); 'name' => __('MTBF'));
$types['event_report_agent'] = __('Event report agent'); $types['MTTR'] = array('optgroup' => __('ITIL'),
$types['event_report_module'] = __('Event report module'); 'name' => __('MTTR'));
$types['event_report_group'] = __('Event report group');
$types['general'] = __('General');
$types['group_report'] = __('Group report');
$types['top_n'] = __('Top n'); $types['SLA'] = array('optgroup' => __('SLA'),
$types['exception'] = __('Exception'); 'name' => __('S.L.A.'));
$types['prediction_date'] = array('optgroup' => __('Forecating'),
'name' => __('Prediction date'));
$types['projection_graph'] = array('optgroup' => __('Forecating'),
'name' => __('Projection graph'));
$types['avg_value'] = array('optgroup' => __('Modules'),
'name' => __('Avg. Value'));
$types['max_value'] = array('optgroup' => __('Modules'),
'name' => __('Max. Value'));
$types['min_value'] = array('optgroup' => __('Modules'),
'name' => __('Min. Value'));
$types['monitor_report'] = array('optgroup' => __('Modules'),
'name' => __('Monitor report'));
$types['database_serialized'] = array('optgroup' => __('Modules'),
'name' => __('Serialize data'));
$types['sumatory'] = array('optgroup' => __('Modules'),
'name' => __('Summatory'));
$types['general'] = array('optgroup' => __('Grouped'),
'name' => __('General'));
$types['group_report'] = array('optgroup' => __('Grouped'),
'name' => __('Group report'));
$types['exception'] = array('optgroup' => __('Grouped'),
'name' => __('Exception'));
if ($config['metaconsole'] != 1) if ($config['metaconsole'] != 1)
$types['agent_module'] = __('Agents/Modules'); $types['agent_module'] = array('optgroup' => __('Grouped'),
$types['projection_graph'] = __('Projection graph'); 'name' => __('Agents/Modules'));
$types['prediction_date'] = __('Prediction date'); # Only pandora managers have access to the whole database
// $types['agent_detailed_event'] = __('Agent detailed event'); if (check_acl ($config['id_user'], 0, "PM")) {
// $types['list_events_module'] = __('List events of module'); $types['sql'] = array('optgroup' => __('Grouped'),
// $types['list_events_agent'] = __('List events of agent'); 'name' => __('SQL query'));
// $types['list_alerts_agent'] = __('List alerts of agent'); }
// $types['list_alerts_module'] = __('List alerts of module'); $types['top_n'] = array('optgroup' => __('Grouped'),
// $types['agent_detailed_event_pie_char'] = __('Agent detailed pie chart events'); 'name' => __('Top n'));
// $types['agent_detailed_event_last_hours'] = __('Agent detailed event in last hours');
// $types['agent_detailed_alert_last_hours'] = __('Agent detailed alerts in last hours');
// $types['agent_detailed_num_modules'] = __('Agent detailed num modules');
// $types['agent_detailed_num_alerts'] = __('Agent detailed num alerts'); $types['text'] = array('optgroup' => __('Text/HTML '),
'name' => __ ('Text'));
$types['url'] = array('optgroup' => __('Text/HTML '),
'name' => __('Import text from URL'));
$types['alert_report_module'] = array('optgroup' => __('Alerts'),
'name' => __('Alert report module'));
$types['alert_report_agent'] = array('optgroup' => __('Alerts'),
'name' => __('Alert report agent'));
$types['event_report_agent'] = array('optgroup' => __('Events'),
'name' => __('Event report agent'));
$types['event_report_module'] = array('optgroup' => __('Events'),
'name' => __('Event report module'));
$types['event_report_group'] = array('optgroup' => __('Events'),
'name' => __('Event report group'));
return $types; return $types;
} }
@ -803,7 +852,8 @@ function get_report_name ($type) {
$types = get_report_types (); $types = get_report_types ();
if (! isset ($types[$type])) if (! isset ($types[$type]))
return __('Unknown'); return __('Unknown');
return $types[$type];
return $types[$type]['name'];
} }
/** /**
@ -817,37 +867,41 @@ function get_report_name ($type) {
*/ */
function get_report_type_data_source ($type) { function get_report_type_data_source ($type) {
switch ($type) { switch ($type) {
case 1: case 1:
case 'simple_graph': case 'simple_graph':
case 6: case 6:
case 'monitor_report': case 'monitor_report':
case 7: case 7:
case 'avg_value': case 'avg_value':
case 8: case 8:
case 'max_value': case 'max_value':
case 9: case 9:
case 'min_value': case 'min_value':
case 10: case 10:
case 'sumatory': case 'sumatory':
case 'agent_detailed_event': case 'agent_detailed_event':
return 'module'; return 'module';
case 2: break;
case 'custom_graph': case 2:
return 'custom-graph'; case 'custom_graph':
case 3: return 'custom-graph';
case 'SLA': break;
case 4: case 3:
case 'event_report': case 'SLA':
case 5: case 4:
case 'alert_report': case 'event_report':
case 11: case 5:
case 'general_group_report': case 'alert_report':
case 12: case 11:
case 'monitor_health': case 'general_group_report':
case 13: case 12:
case 'agents_detailed': case 'monitor_health':
return 'agent-group'; case 13:
case 'agents_detailed':
return 'agent-group';
break;
} }
return 'unknown'; return 'unknown';
} }

View File

@ -70,7 +70,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$data[0] = ''; $data[0] = '';
$data[1] = $cont; $data[1] = $cont;
$data[2] = date('d M Y H:i:s', $utimestamp); $data[2] = date($config["date_format"], $utimestamp);
$data[3] = $utimestamp; $data[3] = $utimestamp;
$data[4] = $row['sum']; $data[4] = $row['sum'];
$data[5] = $utimestamp * $row['sum']; $data[5] = $utimestamp * $row['sum'];
@ -141,6 +141,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$b_num = (($cont * $sum_xi_yi) - ($sum_xi * $sum_yi)); $b_num = (($cont * $sum_xi_yi) - ($sum_xi * $sum_yi));
$b_den = (($cont * $sum_xi2) - ($sum_xi * $sum_xi)); $b_den = (($cont * $sum_xi2) - ($sum_xi * $sum_xi));
if ($b_den == 0) return;
$b = $b_num / $b_den; $b = $b_num / $b_den;
$a_num = ($sum_yi) - ($b * $sum_xi); $a_num = ($sum_yi) - ($b * $sum_xi);

View File

@ -45,7 +45,21 @@ function html_debug_print ($var, $file = '') {
if (strlen($file) > 0) { if (strlen($file) > 0) {
$f = fopen($file, "a"); $f = fopen($file, "a");
ob_start(); ob_start();
echo date("Y/m/d H:i:s") . "\n"; $more_info = '';
if (is_string($var)) {
$more_info = 'size: ' . strlen($var);
}
elseif (is_bool($var)) {
$more_info = 'val: ' .
($var ? 'true' : 'false');
}
elseif (is_null($var)) {
$more_info = 'is null';
}
elseif (is_array($var)) {
$more_info = count($var);
}
echo date("Y/m/d H:i:s") . " (" . gettype($var) . ") " . $more_info . "\n";
print_r($var); print_r($var);
echo "\n\n"; echo "\n\n";
$output = ob_get_clean(); $output = ob_get_clean();
@ -463,7 +477,7 @@ function html_print_extended_select_for_time ($name, $selected = '', $script = '
"; ";
$returnString = ob_get_clean(); $returnString = ob_get_clean();
if ($return) if ($return)
return $returnString; return $returnString;
else else

View File

@ -708,8 +708,9 @@ function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = tr
$networkmaps = array(); $networkmaps = array();
foreach($networkmaps_raw as $key => $networkmapitem) { foreach($networkmaps_raw as $key => $networkmapitem) {
if($optgrouped) { if($optgrouped) {
$networkmaps[$networkmapitem['id_networkmap']] = array('name' => $networkmapitem['name'], $networkmaps[$networkmapitem['id_networkmap']] =
'optgroup' => $networkmapitem['type']); array('name' => $networkmapitem['name'],
'optgroup' => $networkmapitem['type']);
} }
else { else {
$networkmaps[$networkmapitem['id_networkmap']] = $networkmapitem['name']; $networkmaps[$networkmapitem['id_networkmap']] = $networkmapitem['name'];

View File

@ -2128,7 +2128,9 @@ function sla_value_asc_cmp($a, $b)
/** /**
* Make the header for each content. * Make the header for each content.
*/ */
function header_content($mini, $content, $report, &$table, $title = false, $name = false, $period = false) { function reporting_header_content($mini, $content, $report, &$table, $title = false, $name = false, $period = false) {
global $config;
if ($mini) { if ($mini) {
$sizh = ''; $sizh = '';
$sizhfin = ''; $sizhfin = '';
@ -2157,8 +2159,8 @@ function header_content($mini, $content, $report, &$table, $title = false, $name
else { else {
$data[] = "<div style='text-align: right;'>" . $sizh . $data[] = "<div style='text-align: right;'>" . $sizh .
"(" . human_time_description_raw ($content['period']) . ") " . "(" . human_time_description_raw ($content['period']) . ") " .
__("From:") . " " . date("Y-m-d H:i", $report["datetime"] - $content['period']) . "<br />" . __("From:") . " " . date($config["date_format"], $report["datetime"]) . "<br />" .
__("To:") . " " . date("Y-m-d H:i", $report["datetime"]) . "<br />" . __("To:") . " " . date($config["date_format"], $report["datetime"] - $content['period']) . "<br />" .
$sizhfin . "</div>"; $sizhfin . "</div>";
} }
@ -2214,7 +2216,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
switch ($content["type"]) { switch ($content["type"]) {
case 1: case 1:
case 'simple_graph': case 'simple_graph':
header_content($mini, $content, $report, $table, __('Simple graph'), reporting_header_content($mini, $content, $report, $table, __('Simple graph'),
ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2238,7 +2240,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 'projection_graph': case 'projection_graph':
header_content($mini, $content, $report, $table, __('Projection graph'), reporting_header_content($mini, $content, $report, $table, __('Projection graph'),
ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2287,7 +2289,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'prediction_date': case 'prediction_date':
header_content($mini, $content, $report, $table, __('Prediction date'), reporting_header_content($mini, $content, $report, $table, __('Prediction date'),
ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2320,7 +2322,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'simple_baseline_graph': case 'simple_baseline_graph':
header_content($mini, $content, $report, $table, __('Simple baseline graph'), reporting_header_content($mini, $content, $report, $table, __('Simple baseline graph'),
ui_print_truncate_text($agent_name, 65, false).' <br> ' . ui_print_truncate_text($module_name, 65, false)); ui_print_truncate_text($agent_name, 65, false).' <br> ' . ui_print_truncate_text($module_name, 65, false));
//RUNNING //RUNNING
@ -2360,7 +2362,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
case 'custom_graph': case 'custom_graph':
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
header_content($mini, $content, $report, $table, __('Custom graph'), reporting_header_content($mini, $content, $report, $table, __('Custom graph'),
ui_print_truncate_text($graph['name'], 25, false)); ui_print_truncate_text($graph['name'], 25, false));
//RUNNING //RUNNING
@ -2412,7 +2414,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 3: case 3:
case 'SLA': case 'SLA':
header_content($mini, $content, $report, $table, __('S.L.A.')); reporting_header_content($mini, $content, $report, $table, __('S.L.A.'));
$show_graph = $content['show_graph']; $show_graph = $content['show_graph'];
//RUNNING //RUNNING
@ -2640,7 +2642,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 6: case 6:
case 'monitor_report': case 'monitor_report':
header_content($mini, $content, $report, $table, __('Monitor report'), reporting_header_content($mini, $content, $report, $table, __('Monitor report'),
ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false));
//RUNNING //RUNNING
@ -2673,7 +2675,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 7: case 7:
case 'avg_value': case 'avg_value':
header_content($mini, $content, $report, $table, __('Avg. Value'), reporting_header_content($mini, $content, $report, $table, __('Avg. Value'),
ui_print_truncate_text($agent_name, 75, false).' <br> '.ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> '.ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2702,7 +2704,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 8: case 8:
case 'max_value': case 'max_value':
header_content($mini, $content, $report, $table, __('Max. Value'), reporting_header_content($mini, $content, $report, $table, __('Max. Value'),
ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> ' . ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2726,7 +2728,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 9: case 9:
case 'min_value': case 'min_value':
header_content($mini, $content, $report, $table, __('Min. Value'), reporting_header_content($mini, $content, $report, $table, __('Min. Value'),
ui_print_truncate_text($agent_name, 75, false).' <br> '.ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> '.ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2755,7 +2757,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 10: case 10:
case 'sumatory': case 'sumatory':
header_content($mini, $content, $report, $table, __('Summatory'), reporting_header_content($mini, $content, $report, $table, __('Summatory'),
ui_print_truncate_text($agent_name, 75, false).' <br> '.ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($agent_name, 75, false).' <br> '.ui_print_truncate_text($module_name, 75, false));
//RUNNING //RUNNING
@ -2786,7 +2788,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 'agent_detailed_event': case 'agent_detailed_event':
case 'event_report_agent': case 'event_report_agent':
header_content($mini, $content, $report, $table, __('Agent detailed event'), reporting_header_content($mini, $content, $report, $table, __('Agent detailed event'),
ui_print_truncate_text(agents_get_name($content['id_agent']), 75, false)); ui_print_truncate_text(agents_get_name($content['id_agent']), 75, false));
//RUNNING //RUNNING
@ -2805,7 +2807,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'text': case 'text':
header_content($mini, $content, $report, $table, __('Text'), reporting_header_content($mini, $content, $report, $table, __('Text'),
"", ""); "", "");
if ($content["description"] != ""){ if ($content["description"] != ""){
@ -2818,7 +2820,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->colspan[2][0] = 2; $table->colspan[2][0] = 2;
break; break;
case 'sql': case 'sql':
header_content($mini, $content, $report, $table, __('SQL'), reporting_header_content($mini, $content, $report, $table, __('SQL'),
"", ""); "", "");
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -2888,7 +2890,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
case 'sql_graph_pie': case 'sql_graph_pie':
case 'sql_graph_vbar': case 'sql_graph_vbar':
case 'sql_graph_hbar': case 'sql_graph_hbar':
header_content($mini, $content, $report, $table, __('User defined graph') . " (".__($content["type"]) .")", reporting_header_content($mini, $content, $report, $table, __('User defined graph') . " (".__($content["type"]) .")",
"", ""); "", "");
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -2916,7 +2918,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 'event_report_group': case 'event_report_group':
header_content($mini, $content, $report, $table, __('Group detailed event'), reporting_header_content($mini, $content, $report, $table, __('Group detailed event'),
ui_print_truncate_text(groups_get_name($content['id_group'], true), 60, false)); ui_print_truncate_text(groups_get_name($content['id_group'], true), 60, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -2934,7 +2936,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 'event_report_module': case 'event_report_module':
header_content($mini, $content, $report, $table, __('Module detailed event'), reporting_header_content($mini, $content, $report, $table, __('Module detailed event'),
ui_print_truncate_text($agent_name, 70, false).' <br> ' . ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> ' . ui_print_truncate_text($module_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -2951,7 +2953,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'alert_report_module': case 'alert_report_module':
header_content($mini, $content, $report, $table, __('Alert report module'), reporting_header_content($mini, $content, $report, $table, __('Alert report module'),
ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -2968,7 +2970,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'alert_report_agent': case 'alert_report_agent':
header_content($mini, $content, $report, $table, __('Alert report agent'), reporting_header_content($mini, $content, $report, $table, __('Alert report agent'),
ui_print_truncate_text($agent_name, 70, false)); ui_print_truncate_text($agent_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -2985,7 +2987,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'url': case 'url':
header_content($mini, $content, $report, $table, __('Import text from URL'), reporting_header_content($mini, $content, $report, $table, __('Import text from URL'),
ui_print_truncate_text($content["external_source"], 70, false)); ui_print_truncate_text($content["external_source"], 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -3007,7 +3009,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'database_serialized': case 'database_serialized':
header_content($mini, $content, $report, $table, __('Serialize data'), reporting_header_content($mini, $content, $report, $table, __('Serialize data'),
ui_print_truncate_text($module_name, 75, false)); ui_print_truncate_text($module_name, 75, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -3065,7 +3067,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->colspan[1][0] = 2; $table->colspan[1][0] = 2;
break; break;
case 'TTRT': case 'TTRT':
header_content($mini, $content, $report, $table, __('TTRT'), reporting_header_content($mini, $content, $report, $table, __('TTRT'),
ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -3091,7 +3093,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'TTO': case 'TTO':
header_content($mini, $content, $report, $table, __('TTO'), reporting_header_content($mini, $content, $report, $table, __('TTO'),
ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -3117,7 +3119,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'MTBF': case 'MTBF':
header_content($mini, $content, $report, $table, __('MTBF'), reporting_header_content($mini, $content, $report, $table, __('MTBF'),
ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -3143,7 +3145,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 'MTTR': case 'MTTR':
header_content($mini, $content, $report, $table, __('MTTR'), reporting_header_content($mini, $content, $report, $table, __('MTTR'),
ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false)); ui_print_truncate_text($agent_name, 70, false).' <br> '.ui_print_truncate_text($module_name, 70, false));
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
@ -3174,7 +3176,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
// Get events of the last 8 hours // Get events of the last 8 hours
$events = events_get_group_events ($content['id_group'], 28800, $report['datetime']); $events = events_get_group_events ($content['id_group'], 28800, $report['datetime']);
header_content($mini, $content, $report, $table, __('Group report').': "'.$group_name.'"'); reporting_header_content($mini, $content, $report, $table, __('Group report').': "'.$group_name.'"');
$data = array (); $data = array ();
$table->colspan[0][0] = 7; $table->colspan[0][0] = 7;
@ -3245,7 +3247,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 'general': case 'general':
header_content($mini, $content, $report, $table, __('General')); reporting_header_content($mini, $content, $report, $table, __('General'));
$group_by_agent = $content['group_by_agent']; $group_by_agent = $content['group_by_agent'];
$order_uptodown = $content['order_uptodown']; $order_uptodown = $content['order_uptodown'];
@ -3560,7 +3562,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
break; break;
case 'top_n': case 'top_n':
header_content($mini, $content, $report, $table, __('Top').' '.$content['top_n_value']); reporting_header_content($mini, $content, $report, $table, __('Top').' '.$content['top_n_value']);
$order_uptodown = $content['order_uptodown']; $order_uptodown = $content['order_uptodown'];
$top_n = $content['top_n']; $top_n = $content['top_n'];
@ -3662,16 +3664,16 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
switch ($top_n) { switch ($top_n) {
//Max //Max
case 1: case 1:
array_multisort($data_top, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); array_multisort($data_top, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break; break;
//Min //Min
case 2: case 2:
array_multisort($data_top, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); array_multisort($data_top, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break; break;
//By agent name or without selection //By agent name or without selection
case 0: case 0:
case 3: case 3:
array_multisort($agent_name, SORT_ASC, $data_top, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); array_multisort($agent_name, SORT_ASC, $data_top, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break; break;
} }
@ -3689,16 +3691,16 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
switch ($order_uptodown) { switch ($order_uptodown) {
//Descending //Descending
case 1: case 1:
array_multisort($data_top, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); array_multisort($data_top, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break; break;
//Ascending //Ascending
case 2: case 2:
array_multisort($data_top, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); array_multisort($data_top, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break; break;
//By agent name or without selection //By agent name or without selection
case 0: case 0:
case 3: case 3:
array_multisort($agent_name, SORT_ASC, $data_top, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC); array_multisort($agent_name, SORT_ASC, $data_top, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break; break;
} }
@ -3848,7 +3850,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$title_exeption .= ' - '.__('Modules at critical or warning status'); $title_exeption .= ' - '.__('Modules at critical or warning status');
break; break;
} }
header_content($mini, $content, $report, $table, $title_exeption); reporting_header_content($mini, $content, $report, $table, $title_exeption);
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
$table->colspan[1][0] = 3; $table->colspan[1][0] = 3;
@ -4099,7 +4101,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
break; break;
case 'agent_module': case 'agent_module':
header_content($mini, $content, $report, $table, __('Agents/Modules')); reporting_header_content($mini, $content, $report, $table, __('Agents/Modules'));
$id_group = $content['id_group']; $id_group = $content['id_group'];
$id_module_group = $content['id_module_group']; $id_module_group = $content['id_module_group'];
@ -4178,7 +4180,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
continue; continue;
} }
$file_name = string2image(ui_print_truncate_text($module['name'], 30, false, true, false, '...'), false, false, 6, 270, '#9EAC8B', 'FFF', 4, 0); $file_name = string2image(ui_print_truncate_text($module['name'], 30, false, true, false, '...'), false, false, 6, 270, '#90B165', 'FFF', 4, 0);
$table_data .= '<th width="22px">'.html_print_image($file_name, true, array('title' => $module['name']))."</th>"; $table_data .= '<th width="22px">'.html_print_image($file_name, true, array('title' => $module['name']))."</th>";
} }