diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d11fab5c6b..9c775e7b25 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-03-14 Miguel de Dios + + * include/functions_reporting.php: fixes and changes for to show better the + html reports. + + * include/functions_groups.php: cleaned source code. + + * include/functions.php: fixed and changed the function "string2image" to + create the text with any size and use ttf font. + + Merged from the branch pandora_4.0 + 2012-03-14 Vanessa Gil * godmode/alerts/alert_actions.php diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index d3ff11cba0..eec270b6c7 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1263,6 +1263,27 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', $snmp3_au return $snmpwalk; } +/** + * Copy from: + * http://stackoverflow.com/questions/1605844/imagettfbbox-returns-wrong-dimensions-when-using-space-characters-inside-text + */ +function calculateTextBox($font_size, $font_angle, $font_file, $text) { + $box = imagettfbbox($font_size, $font_angle, $font_file, $text); + + $min_x = min(array($box[0], $box[2], $box[4], $box[6])); + $max_x = max(array($box[0], $box[2], $box[4], $box[6])); + $min_y = min(array($box[1], $box[3], $box[5], $box[7])); + $max_y = max(array($box[1], $box[3], $box[5], $box[7])); + + return array( + 'left' => ($min_x >= -1) ? -abs($min_x + 1) : abs($min_x + 2), + 'top' => abs($min_y), + 'width' => $max_x - $min_x, + 'height' => $max_y - $min_y, + 'box' => $box + ); +} + /** * Convert a string to an image * @@ -1271,17 +1292,32 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', $snmp3_au * @return array SNMP result. */ function string2image($string, $width, $height, $fontsize = 3, - $degrees = '0', $bgcolor = '#FFFFFF', $textcolor = '#000000', - $padding_left = 4, $padding_top = 1, $home_url = '') { - + $degrees = '0', $bgcolor = '#FFFFFF', $textcolor = '#000000', + $padding_left = 4, $padding_top = 1, $home_url = '') { + global $config; - + + //Set the size of image from the size of text + if ($width === false) { + $size = calculateTextBox($fontsize, 0, $config['fontpath'], $string); + + $fix_value = 1 * $fontsize; //Fix the imagettfbbox cut the tail of "p" character. + + $width = $size['width'] + $padding_left + $fix_value; + $height = $size['height'] + $padding_top + $fix_value; + + $padding_top = $padding_top + $fix_value; + } + $im = ImageCreate($width,$height); $bgrgb = html_html2rgb($bgcolor); $bgc = ImageColorAllocate($im,$bgrgb[0],$bgrgb[1],$bgrgb[2]); // Set the string $textrgb = html_html2rgb($textcolor); - imagestring($im, $fontsize, $padding_left, $padding_top, $string, ImageColorAllocate($im,$textrgb[0],$textrgb[1],$textrgb[2])); + imagettftext ($im, $fontsize, 0, $padding_left, $height - $padding_top, + ImageColorAllocate($im,$textrgb[0],$textrgb[1],$textrgb[2]), + $config['fontpath'], $string); + //imagestring($im, $fontsize, $padding_left, $padding_top, $string, ImageColorAllocate($im,$textrgb[0],$textrgb[1],$textrgb[2])); // Rotates the image $rotated = imagerotate($im, $degrees, 0) ; diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index a7e911e4aa..f58ddaa8f0 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -552,9 +552,9 @@ function groups_get_status ($id_group = 0) { */ function groups_get_name ($id_group, $returnAllGroup = false) { if($id_group > 0) - return (string) db_get_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group); + return (string) db_get_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group); elseif($returnAllGroup) - return "All"; + return "All"; } /** diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 53b84f0728..4a55d76348 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1429,7 +1429,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return = $data[__('Alerts fired')] = $fired_percentage; $data[__('Alerts not fired')] = $not_fired_percentage; - $output .= pie3d_graph($config['flash_charts'], $data, 280, 150, + $output .= pie3d_graph(false, $data, 280, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); @@ -1503,7 +1503,7 @@ function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return = $data[__('Monitors OK')] = $down_percentage; $data[__('Monitors BAD')] = $not_down_percentage; - $output .= pie3d_graph($config['flash_charts'], $data, 280, 150, + $output .= pie3d_graph(false, $data, 280, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); @@ -2122,7 +2122,43 @@ function sla_value_asc_cmp($a, $b) if (preg_match('/^(.)*Unknown(.)*$/', $b[5])) $b[6] = -1; - return ($a[6] > $b[6])? 1 : 0; + return ($a[6] > $b[6])? 1 : 0; +} + +/** + * Make the header for each content. + */ +function header_content($mini, $content, $report, &$table, $title = false, $name = false, $period = false) { + if ($mini) { + $sizh = ''; + $sizhfin = ''; + } + else { + $sizh = '

'; + $sizhfin = '

'; + } + + $data = array(); + + if ($title !== false) + $data[] = $sizh . $title . $sizhfin; + + if ($name !== false) + $data[] = $sizh . $name . $sizhfin; + + if ($period !== false) + $data[] = $sizh . $period . $sizhfin; + else { + $data[] = "
" . $sizh . + "(" . human_time_description_raw ($content['period']) . ") " . + __("From:") . " " . date("Y-m-d H:i", $report["datetime"]) . "
" . + __("To:") . " " . date("Y-m-d H:i", $report["datetime"] - $content['period']) . "
" . + $sizhfin . "
"; + } + + //$table->style[$count] + + array_push ($table->data, $data); } /** @@ -2142,15 +2178,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f global $graphic_type; if ($mini) { - $sizh = ''; - $sizhfin = ''; $sizem = '1.5'; $sizgraph_w = '350'; $sizgraph_h = '100'; } else { - $sizh = '

'; - $sizhfin = '

'; $sizem = '3'; $sizgraph_w = '750'; $sizgraph_h = '230'; @@ -2163,7 +2195,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f //ui_print_error_message ("Error connecting to ".$server_name); } } - + $module_name = db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']); if ($content['id_agent_module'] != 0) { $agent_name = modules_get_agentmodule_agent_name ($content['id_agent_module']); @@ -2172,20 +2204,19 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $agent_name = agents_get_name($content['id_agent']); } + switch ($content["type"]) { case 1: case 'simple_graph': + header_content($mini, $content, $report, $table, __('Simple graph'), + ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false)); + //RUNNING $table->colspan[1][0] = 4; - $data = array (); - $data[0] = $sizh.__('Simple graph').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[2][0] = 4; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2201,13 +2232,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'projection_graph': + header_content($mini, $content, $report, $table, __('Projection graph'), + ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false)); + //RUNNING $table->colspan[1][0] = 4; - $data = array (); - $data[0] = $sizh.__('Projection graph').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); set_time_limit(500); @@ -2252,13 +2281,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'prediction_date': + header_content($mini, $content, $report, $table, __('Prediction date'), + ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false)); + //RUNNING $table->colspan[1][0] = 4; - $data = array (); - $data[0] = $sizh.__('Prediction date').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); set_time_limit(500); @@ -2286,13 +2313,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'simple_baseline_graph': + header_content($mini, $content, $report, $table, __('Simple baseline graph'), + ui_print_truncate_text($agent_name, 65, false).'
' . ui_print_truncate_text($module_name, 65, false)); + //RUNNING $table->colspan[1][0] = 4; - $data = array (); - $data[0] = $sizh.__('Simple baseline graph').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 65, false).'
' . ui_print_truncate_text($module_name, 65, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[2][0] = 4; @@ -2326,16 +2351,14 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 2: case 'custom_graph': - //RUNNING $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); - $data = array (); - $data[0] = $sizh.__('Custom graph').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($graph['name'], 25, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Custom graph'), + ui_print_truncate_text($graph['name'], 25, false)); + + //RUNNING // Put description at the end of the module (if exists) - + $table->colspan[2][0] = 3; if ($content["description"] != ""){ $data_desc = array(); @@ -2382,16 +2405,14 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 3: case 'SLA': + header_content($mini, $content, $report, $table, __('S.L.A.')); + $show_graph = $content['show_graph']; //RUNNING $table->style[1] = 'text-align: right'; - $data = array (); - $data[0] = $sizh . __('S.L.A.').$sizhfin; - $data[1] = $sizh . human_time_description_raw($content['period']) . $sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) - + $table->colspan[1][0] = 3; if ($content["description"] != ""){ $data_desc = array(); @@ -2479,8 +2500,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f if ($show_graph == 0 || $show_graph == 1) { $data = array (); - $data[0] = printSmallFont(modules_get_agentmodule_agent_name ($sla['id_agent_module'])); - $data[1] = printSmallFont(modules_get_agentmodule_name ($sla['id_agent_module'])); + $data[0] = modules_get_agentmodule_agent_name ($sla['id_agent_module']); + $data[1] = modules_get_agentmodule_name ($sla['id_agent_module']); $data[2] = $sla['sla_max'].'/'; $data[2] .= $sla['sla_min']; $data[3] = $sla['sla_limit']; @@ -2537,7 +2558,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array(); $data_pie_graph = json_encode ($data_graph); if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) { - $data[0] = pie3d_graph($config['flash_charts'], $data_graph, + $data[0] = pie3d_graph(false, $data_graph, 500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); array_push ($table->data, $data); @@ -2553,9 +2574,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table2->data = array (); foreach ($slas as $sla) { $data = array(); - $data[0] = printSmallFont(modules_get_agentmodule_agent_name ($sla['id_agent_module'])); + $data[0] = modules_get_agentmodule_agent_name ($sla['id_agent_module']); $data[0] .= "
"; - $data[0] .= printSmallFont(modules_get_agentmodule_name ($sla['id_agent_module'])); + $data[0] .= modules_get_agentmodule_name ($sla['id_agent_module']); $data[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'], @@ -2571,12 +2592,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 6: case 'monitor_report': + header_content($mini, $content, $report, $table, __('Monitor report'), + ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + //RUNNING - $data = array (); - $data[0] = $sizh.__('Monitor report').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) if ($content["description"] != ""){ @@ -2606,12 +2625,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 7: case 'avg_value': + header_content($mini, $content, $report, $table, __('Avg. Value'), + ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false)); + //RUNNING - $data = array (); - $data[0] = $sizh.__('Avg. Value').$sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2636,12 +2653,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 8: case 'max_value': + header_content($mini, $content, $report, $table, __('Max. Value'), + ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false)); + //RUNNING - $data = array (); - $data[0] = $sizh.__('Max. Value').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2660,12 +2675,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 9: case 'min_value': + header_content($mini, $content, $report, $table, __('Min. Value'), + ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false)); + //RUNNING - $data = array (); - $data[0] = $sizh.__('Min. Value').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[0][0] = 2; @@ -2689,12 +2702,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 10: case 'sumatory': + header_content($mini, $content, $report, $table, __('Summatory'), + ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false)); + //RUNNING - $data = array (); - $data[0] = $sizh.__('Summatory').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false).$sizhfin; - $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[0][0] = 2; @@ -2719,11 +2730,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'agent_detailed_event': case 'event_report_agent': + header_content($mini, $content, $report, $table, __('Agent detailed event'), + ui_print_truncate_text(agents_get_name($content['id_agent']), 75, false)); + //RUNNING - $data = array (); - $data[0] = $sizh.__('Agent detailed event').$sizhfin; - $data[1] = $sizh . ui_print_truncate_text(agents_get_name($content['id_agent']), 75, false).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2739,13 +2749,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'text': - $data = array(); - $data[0] = $sizh. __('Text') . $sizhfin; - array_push ($table->data, $data); - $table->colspan[0][0] = 2; + header_content($mini, $content, $report, $table, __('Text'), + "", ""); - // Put description at the end of the module (if exists) - $table->colspan[0][0] = 2; if ($content["description"] != ""){ $data_desc = array(); $data_desc[0] = $content["description"]; @@ -2756,10 +2762,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table->colspan[2][0] = 2; break; case 'sql': - $data = array(); - $data[0] = $sizh. __('SQL') . $sizhfin; - array_push ($table->data, $data); - $table->colspan[0][0] = 2; + header_content($mini, $content, $report, $table, __('SQL'), + "", ""); // Put description at the end of the module (if exists) $table->colspan[0][0] = 2; @@ -2825,14 +2829,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $cellContent = html_print_table($table2, true); array_push($table->data, array($cellContent)); break; - case 'sql_graph_pie': case 'sql_graph_vbar': case 'sql_graph_hbar': - $data = array(); - $data[0] = $sizh. __('User defined graph') . " (".__($content["type"]) .")". $sizhfin; - array_push ($table->data, $data); - $table->colspan[0][0] = 2; + header_content($mini, $content, $report, $table, __('User defined graph') . " (".__($content["type"]) .")", + "", ""); // Put description at the end of the module (if exists) $table->colspan[0][0] = 2; @@ -2859,14 +2860,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'event_report_group': - $data = array (); - $data[0] = $sizh . __('Group detailed event') . $sizhfin; - $data[1] = $sizh . ui_print_truncate_text(groups_get_name($content['id_group']), 60, false) . $sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Group detailed event'), + ui_print_truncate_text(groups_get_name($content['id_group'], true), 60, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2879,10 +2878,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'event_report_module': - $data = array (); - $data[0] = $sizh. __('Module detailed event') . $sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 70, false).'
' . ui_print_truncate_text($module_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Module detailed event'), + ui_print_truncate_text($agent_name, 70, false).'
' . ui_print_truncate_text($module_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2898,10 +2895,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'alert_report_module': - $data = array (); - $data[0] = $sizh. __('Alert report module') . $sizhfin; - $data[1] = $sizh . ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Alert report module'), + ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2917,10 +2912,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'alert_report_agent': - $data = array (); - $data[0] = $sizh. __('Alert report agent') . $sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Alert report agent'), + ui_print_truncate_text($agent_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2936,10 +2929,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'url': - $table->colspan[1][0] = 2; - $data = array (); - $data[0] = $sizh. __('Import text from URL') . $sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Import text from URL'), + ui_print_truncate_text($content["external_source"], 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2960,10 +2951,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'database_serialized': - $data = array (); - $data[0] = $sizh. __('Serialize data') . $sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('Serialize data'), + ui_print_truncate_text($module_name, 75, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3020,10 +3009,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table->colspan[1][0] = 2; break; case 'TTRT': - $data = array (); - $data[0] = $sizh. __('TTRT') . $sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('TTRT'), + ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3048,10 +3035,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'TTO': - $data = array (); - $data[0] = $sizh. __('TTO') . $sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('TTO'), + ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3076,10 +3061,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'MTBF': - $data = array (); - $data[0] = $sizh. __('MTBF') . $sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('MTBF'), + ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3104,10 +3087,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_push ($table->data, $data); break; case 'MTTR': - $data = array (); - $data[0] = $sizh. __('MTTR') . $sizhfin; - $data[1] = $sizh.ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, __('MTTR'), + ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3137,6 +3118,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f // Get events of the last 8 hours $events = events_get_group_events ($content['id_group'], 28800, $report['datetime']); + header_content($mini, $content, $report, $table, __('Group report').': "'.$group_name.'"'); + $data = array (); $table->colspan[0][0] = 7; $table->colspan[1][1] = 3; @@ -3149,10 +3132,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table->colspan[6][4] = 3; $table->colspan[7][1] = 6; $table->colspan[8][1] = 6; - $data[0] = $sizh. __('Group report').': "'.$group_name.'"' . $sizhfin; - - array_push ($table->data, $data); - + $data = array(); $data[0] = ''; $data[1] = "
".__('Total')."
"; @@ -3209,14 +3189,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'general': + header_content($mini, $content, $report, $table, __('General')); + $group_by_agent = $content['group_by_agent']; $order_uptodown = $content['order_uptodown']; $table->style[1] = 'text-align: right'; - $data = array (); - $data[0] = $sizh.__('General').$sizhfin; - $data[1] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3291,8 +3269,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $i=0; foreach ($data_avg as $d) { $data = array(); - $data[0] = printSmallFont($agent_name[$i]); - $data[1] = printSmallFont($module_name[$i]); + $data[0] = $agent_name[$i]; + $data[1] = $module_name[$i]; $d === false ? $data[2] = '--':$data[2] = $d; array_push ($table1->data, $data); $i++; @@ -3304,8 +3282,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $i=0; foreach ($agent_name as $a) { $data = array(); - $data[0] = printSmallFont($agent_name[$i]); - $data[1] = printSmallFont($module_name[$i]); + $data[0] = $agent_name[$i]; + $data[1] = $module_name[$i]; $data_avg[$i] === false ? $data[2] = '--':$data[2] = $data_avg[$i]; array_push ($table1->data, $data); $i++; @@ -3375,7 +3353,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f foreach ($agent_list as $a) { $data = array(); - $data[0] = printSmallFont($a); + $data[0] = $a; $i = 1; foreach ($modules_list as $m) { foreach ($generals as $g) { @@ -3491,16 +3469,29 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $avg = $avg / $length; } - $data_resume = array(); - $data_resume[0] = "Max Value: ".$max; - array_push ($table->data, $data_resume); - $data_resume[0] = "Min Value: ".$min; - array_push ($table->data, $data_resume); - $data_resume[0] = "Average Value: ".$avg; - array_push ($table->data, $data_resume); + + unset($table_summary); + + $table_summary->width = '99%'; + $table_summary->data = array (); + $table_summary->head = array (); + $table_summary->head[0] = __('Min Value'); + $table_summary->head[1] = __('Average Value'); + $table_summary->head[2] = __('Max Value'); + + $table_summary->data[0][0] = round($min,2); + $table_summary->data[0][1] = round($avg,2); + $table_summary->data[0][2] = round($max,2); + + $table->colspan[5][0] = 2; + array_push ($table->data, array(''.__('Summary').'')); + $table->colspan[6][0] = 2; + array_push ($table->data, array(html_print_table($table_summary, true))); } break; case 'top_n': + header_content($mini, $content, $report, $table, __('Top').' '.$content['top_n_value']); + $order_uptodown = $content['order_uptodown']; $top_n = $content['top_n']; $top_n_value = $content['top_n_value']; @@ -3768,28 +3759,26 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $show_graph = $content['show_graph']; $table->style[1] = 'text-align: right'; - $data = array (); - $data[0] = $sizh.__('Exception'); + + $title_exeption = __('Exception'); switch ($exception_condition) { case 0: - $data[0] .= ' - '.__('Everything'); + $title_exeption .= ' - '.__('Everything'); break; case 1: - $data[0] .= ' - '.__('Modules over or equal to').' '.$exception_condition_value; + $title_exeption .= ' - '.__('Modules over or equal to').' '.$exception_condition_value; break; case 2: - $data[0] .= ' - '.__('Modules under').' '.$exception_condition_value; + $title_exeption .= ' - '.__('Modules under').' '.$exception_condition_value; break; case 3: - $data[0] .= ' - '.__('Modules at normal status'); + $title_exeption .= ' - '.__('Modules at normal status'); break; case 4: - $data[0] .= ' - '.__('Modules at critical or warning status'); + $title_exeption .= ' - '.__('Modules at critical or warning status'); break; } - $data[0].=$sizhfin; - $data[1] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); + header_content($mini, $content, $report, $table, $title_exeption); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3965,8 +3954,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data_pie_graph[$agent_name[$j]] = $dex; if ($show_graph == 0 || $show_graph == 1) { $data = array(); - $data[0] = printSmallFont($agent_name[$j]); - $data[1] = printSmallFont($module_name[$j]); + $data[0] = $agent_name[$j]; + $data[1] = $module_name[$j]; $data[2] = $dex; array_push ($table1->data, $data); } @@ -3982,8 +3971,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data_pie_graph[$an] = $data_exceptions[$j]; if ($show_graph == 0 || $show_graph == 1) { $data = array(); - $data[0] = printSmallFont($an); - $data[1] = printSmallFont($module_name[$j]); + $data[0] = $an; + $data[1] = $module_name[$j]; $data[2] = $data_exceptions[$j]; array_push ($table1->data, $data); } @@ -4003,7 +3992,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table->style[0] .= 'text-align: center'; $data = array(); if ($show_graph == 1 || $show_graph == 2) { - $data[0] = pie3d_graph($config['flash_charts'], $data_pie_graph, + $data[0] = pie3d_graph(false, $data_pie_graph, 600, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); array_push ($table->data, $data); @@ -4012,32 +4001,40 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $height = count($data_pie_graph)*20+35; $data = array(); - $data[0] = hbar_graph($config['flash_charts'], $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true); + $data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true); array_push ($table->data, $data); } if ($content['show_resume'] && $i>0) { - $data_resume = array(); - $data_resume[0] = __('Max Value').': '.$max; - array_push ($table->data, $data_resume); - $data_resume[0] = __('Min Value').': '.$min; - array_push ($table->data, $data_resume); - $data_resume[0] = __('Average Value').': '.$avg; - array_push ($table->data, $data_resume); + unset($table_summary); + + $table_summary->width = '99%'; + $table_summary->data = array (); + $table_summary->head = array (); + $table_summary->head[0] = __('Min Value'); + $table_summary->head[1] = __('Average Value'); + $table_summary->head[2] = __('Max Value'); + + $table_summary->data[0][0] = round($min,2); + $table_summary->data[0][1] = round($avg,2); + $table_summary->data[0][2] = round($max,2); + + $table->colspan[5][0] = 2; + array_push ($table->data, array(''.__('Summary').'')); + $table->colspan[6][0] = 2; + array_push ($table->data, array(html_print_table($table_summary, true))); } break; case 'agent_module': + header_content($mini, $content, $report, $table, __('Agents/Modules')); + $id_group = $content['id_group']; $id_module_group = $content['id_module_group']; $offset = get_parameter('offset', 0); $block = 20; //Maximun number of modules displayed on the table $modulegroup = get_parameter('modulegroup', 0); $table->style[1] = 'text-align: right'; - $data = array (); - $data[0] = $sizh.__('Agents/Modules').$sizhfin; - $data[1] = $sizh.human_time_description_raw ($content['period']).$sizhfin; - array_push ($table->data, $data); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -4099,7 +4096,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f } $table_data = ''; - $table_data .= ""; + $table_data .= ""; $nmodules = 0; foreach($modules_by_name as $module) { @@ -4109,7 +4106,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f continue; } - $file_name = string2image(ui_print_truncate_text($module['name'],15, false, true, false, '...'), 115, 13, 3, 270, '#9EAC8B', 'FFF', 4, 0); + $file_name = string2image(ui_print_truncate_text($module['name'], 30, false, true, false, '...'), false, false, 6, 270, '#9EAC8B', 'FFF', 4, 0); $table_data .= '"; } @@ -4156,7 +4153,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table_data .= ""; - $file_name = string2image(ui_print_truncate_text($agent['nombre'],19, false, true, false, '...'), 140, 15, 3, 0, $rowcolor, $textcolor, 4, 0); + $file_name = string2image(ui_print_truncate_text($agent['nombre'], 35, false, true, false, '...'), false, false, 6, 0, $rowcolor, $textcolor, 4, 0); $table_data .= ""; $agent_modules = agents_get_modules($agent['id_agente']);
".__("Agents")." / ".__("Modules")."".__("Agents")." / ".__("Modules")."'.html_print_image($file_name, true, array('title' => $module['name']))."
".html_print_image($file_name, true, array('title' => $agent['nombre']))."