From 474e518eab10b737cc59a2ab59e7f3f0c0ccd071 Mon Sep 17 00:00:00 2001 From: javilanz Date: Tue, 12 Apr 2011 17:20:16 +0000 Subject: [PATCH] 2011-04-12 Javier Lanz * include/functions_reporting.php: Fixed the functionality for the sla horitontal bar graph. Truncated some agent and module names. Cleaned the code style * include/ajax/reporting.ajax.php: Added functionality to add & delete elements from the global reports * include/functions_ui.php: Added function printSmallFont * godmode/reporting/reporting_builder.item_editor.php: Fixed a wee problem with the module combo size git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4195 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++ .../reporting_builder.item_editor.php | 16 +-- .../include/ajax/reporting.ajax.php | 33 +++++ .../include/functions_reporting.php | 125 +++++++++++------- pandora_console/include/functions_ui.php | 29 ++++ 5 files changed, 156 insertions(+), 58 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 945e63e309..c51b7fde4d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2011-04-12 Javier Lanz + + * include/functions_reporting.php: Fixed the functionality for the sla + horitontal bar graph. Truncated some agent and module names. Cleaned the + code style + * include/ajax/reporting.ajax.php: Added functionality to add & delete + elements from the global reports + * include/functions_ui.php: Added function printSmallFont + * godmode/reporting/reporting_builder.item_editor.php: Fixed a wee + problem with the module combo size + 2011-04-12 Juan Manuel Ramon * extensions/users_connected.php diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 2b765cbe7c..9225645395 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -44,7 +44,7 @@ switch ($action) { $line = null; $description = null; $sql = null; - $group = null; + $group = 0; $only_display_wrong = 0; $monday = true; $tuesday = true; @@ -226,7 +226,7 @@ switch ($action) { case 'event_report_group': $description = $item['description']; $period = $item['period']; - $group = $item['id_agent']; + $group = $item['id_group']; break; case 'event_report_module': $description = $item['description']; @@ -361,7 +361,7 @@ print_input_hidden('id_item', $idItem); - + - $item['id_agent_module'])); echo ' - ' . printTruncateText($nameAgent, 20) . ' - ' . printTruncateText($nameModule, 20) . ' + ' . printSmallFont($nameAgent) . ' + ' . printSmallFont($nameModule) . ' ' . $item['sla_min'] . ' ' . $item['sla_max'] . ' ' . $item['sla_limit'] . ' @@ -630,8 +630,8 @@ function print_General_list($width, $action, $idItem = null) { $nameModule = get_db_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); echo ' - ' . printTruncateText($nameAgent, 35) . ' - ' . printTruncateText($nameModule, 35) . ' + ' . printSmallFont($nameAgent) . ' + ' . printSmallFont($nameModule) . ' ' . print_image("images/cross.png", true) . ' diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index a3b36bef8a..186b8fff8a 100644 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -27,8 +27,10 @@ if (! check_acl ($config['id_user'], 0, "IW")) { } $delete_sla_item = get_parameter('delete_sla_item', 0); +$delete_general_item = get_parameter('delete_general_item', 0); $get_custom_sql = get_parameter('get_custom_sql', 0); $add_sla = get_parameter('add_sla', 0); +$add_general = get_parameter('add_general', 0); $id = get_parameter('id', 0); $truncate_text = get_parameter ('truncate_text', 0); @@ -44,6 +46,18 @@ if ($delete_sla_item) { return; } +if ($delete_general_item) { + $result = process_sql_delete('treport_content_item', array('id' => (int)$id)); + + $data['correct'] = 1; + if ($result === false) { + $data['correct'] = 0; + } + + echo json_encode($data); + return; +} + if ($add_sla) { $id_module = get_parameter('id_module', 0); $sla_limit = get_parameter('sla_limit', 0); @@ -69,6 +83,25 @@ if ($add_sla) { return; } +if ($add_general) { + $id_module = get_parameter('id_module', 0); + + $result = process_sql_insert('treport_content_item', array( + 'id_report_content' => $id, + 'id_agent_module' => $id_module)); + + if ($result === false) { + $data['correct'] = 0; + } + else { + $data['correct'] = 1; + $data['id'] = $result; + } + + echo json_encode($data); + return; +} + if ($get_custom_sql) { switch ($config["dbtype"]) { case "mysql": diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 6e4d5c081f..cfea2ae743 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -389,9 +389,15 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma global $config; // Initialize variables - if (empty ($date)) $date = get_system_time (); - if ((empty ($period)) OR ($period == 0)) $period = $config["sla_period"]; - if ($daysWeek === null) $daysWeek = array(); + if (empty ($date)) { + $date = get_system_time (); + } + if ((empty ($period)) OR ($period == 0)) { + $period = $config["sla_period"]; + } + if ($daysWeek === null) { + $daysWeek = array(); + } // Limit date to start searching data $datelimit = $date - $period; @@ -405,7 +411,7 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma $days = array(); //Translate to mysql week days - if ($daysWeek) + if ($daysWeek) { foreach ($daysWeek as $key => $value) { if (!$value) { if ($key == 'monday') { @@ -431,6 +437,7 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma } } } + } if (count($days) > 0) { $sql .= ' AND DAYOFWEEK(FROM_UNIXTIME(utimestamp)) NOT IN (' . implode(',', $days) . ')'; @@ -445,7 +452,9 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma } $sql .= ' ORDER BY utimestamp ASC'; $interval_data = get_db_all_rows_sql ($sql, true); - if ($interval_data === false) $interval_data = array (); + if ($interval_data === false) { + $interval_data = array (); + } // Get previous data $previous_data = get_previous_data ($id_agent_module, $datelimit); @@ -528,9 +537,23 @@ function get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = $time = (string) get_parameter ('time', date ('h:iA')); $datetime = strtotime ($date.' '.$time); - $k=20; + //Get the module_interval + $interval = get_module_interval ($id_agent_module); + + if ($period < 3600) { + $k = 6; + } elseif ($period < 86400) { + $k = 24; + } elseif ($period < 172800) { + $k = 48; + } else { + $k = 100; + } $slices = $config["graph_res"] * $k; $sub_period = $period / $slices; + if ($sub_period < $interval) { + $sub_period = $interval; + } $final_time = $datetime - $period + $sub_period; $data = array(); @@ -538,13 +561,13 @@ function get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = while ($final_time <= $datetime) { $sla_value = get_agentmodule_sla ($id_agent_module, $sub_period, $min_value, $max_value, $final_time, $days, $timeFrom, $timeTo); - if ($sla_value == false) {// 4 for the Unknown value + if ($sla_value === false || $sla_value < 0) {// 4 for the Unknown value $data[$i] = 4; } elseif (($sla_value >= ($sla_limit - 10)) && ($sla_value <= ($sla_limit + 10))) {//2 when value is within the edges $data[$i] = 2; } elseif ($sla_value > ($sla_limit + 10)) { //1 when value is OK $data[$i] = 1; - } elseif ($sla_value < ($sla_value - 10)) { //3 when value is Wrong + } elseif ($sla_value < ($sla_limit - 10)) { //3 when value is Wrong $data[$i] = 3; } $final_time += $sub_period; @@ -1861,7 +1884,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $table->colspan[1][0] = 4; $data = array (); $data[0] = $sizh.__('Simple graph').$sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 75, false).'
'.printTruncateText($module_name, 75, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -1884,7 +1907,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $table->colspan[1][0] = 4; $data = array (); $data[0] = $sizh.__('Simple baseline graph').$sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 65, false).'
'.printTruncateText($module_name, 65, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -1908,7 +1931,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $graph = get_db_row ("tgraph", "id_graph", $content['id_gs']); $data = array (); $data[0] = $sizh.__('Custom graph').$sizhfin; - $data[1] = $sizh.$graph['name'].$sizhfin; + $data[1] = $sizh.printTruncateText($graph['name'], 25, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -2013,6 +2036,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $sla_value = get_agentmodule_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'], $content['time_to']); + //Fill the array data_graph for the pie graph if ($sla_value === false) { $data_graph[__('Unknown')]++; @@ -2032,9 +2056,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) { if ($show_graph == 0 || $show_graph == 1) { $data = array (); - $data[0] = printTruncateText(get_agentmodule_agent_name ($sla['id_agent_module'])); - $data[1] = printTruncateText(get_agentmodule_name ($sla['id_agent_module'])); - $data[2] = $sla['sla_max'].' / '; + $data[0] = printSmallFont(get_agentmodule_agent_name ($sla['id_agent_module'])); + $data[1] = printSmallFont(get_agentmodule_name ($sla['id_agent_module'])); + $data[2] = $sla['sla_max'].'/'; $data[2] .= $sla['sla_min']; $data[3] = $sla['sla_limit']; @@ -2051,7 +2075,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data[4] = ''; $data[5] = ''.__('Fail').''; } - $data[4] .= format_numeric ($sla_value). " %"; + $data[4] .= format_numeric ($sla_value). "%"; } $data[4] .= ""; @@ -2086,16 +2110,17 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $daysWeek = json_encode ($days); $table2->width = '99%'; + $table2->style[0] = 'text-align: right'; $table2->data = array (); foreach ($slas as $sla) { $data = array(); - $data[0] = get_agentmodule_agent_name ($sla['id_agent_module']); - $data[0] .= '/'; - $data[0] .= get_agentmodule_name ($sla['id_agent_module']); + $data[0] = printSmallFont(get_agentmodule_agent_name ($sla['id_agent_module'])); + $data[0] .= "
"; + $data[0] .= printSmallFont(get_agentmodule_name ($sla['id_agent_module'])); $data[1] = ""; + "&daysWeek=".$daysWeek."&height=25&width=550'>"; array_push ($table2->data, $data); } $table->colspan[4][0] = 3; @@ -2109,13 +2134,13 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //RUNNING $data = array (); $data[0] = $sizh.__('Monitor report').$sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($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) - $table->colspan[1][0] = 3; if ($content["description"] != ""){ + $table->colspan[1][0] = 3; $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2143,7 +2168,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //RUNNING $data = array (); $data[0] = $sizh.__('Avg. Value').$sizhfin; - $data[1] = $sizh.printTruncateText($agent_name).' - '.printTruncateText($module_name).$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 75, false).'
'.printTruncateText($module_name, 75, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -2172,7 +2197,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //RUNNING $data = array (); $data[0] = $sizh.__('Max. Value').$sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 75, false).'
'.printTruncateText($module_name, 75, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -2196,7 +2221,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //RUNNING $data = array (); $data[0] = $sizh.__('Min. Value').$sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 75, false).'
'.printTruncateText($module_name, 75, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -2225,7 +2250,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //RUNNING $data = array (); $data[0] = $sizh.__('Summatory').$sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 75, false).'
'.printTruncateText($module_name, 75, false).$sizhfin; $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); @@ -2255,7 +2280,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //RUNNING $data = array (); $data[0] = $sizh.__('Agent detailed event').$sizhfin; - $data[1] = $sizh.get_agent_name($content['id_agent']).$sizhfin; + $data[1] = $sizh.printTruncateText(get_agent_name($content['id_agent']), 75, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2394,7 +2419,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'event_report_group': $data = array (); $data[0] = $sizh . __('Group detailed event') . $sizhfin; - $data[1] = $sizh . get_group_name($content['id_agent']) . $sizhfin; + $data[1] = $sizh . printTruncateText(get_group_name($content['id_group']), 60, false) . $sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2407,14 +2432,14 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $data[0] = get_group_detailed_event_reporting($content['id_agent'], $content['period'], $report["datetime"], true); + $data[0] = get_group_detailed_event_reporting($content['id_group'], $content['period'], $report["datetime"], true); array_push ($table->data, $data); break; case 'event_report_module': $data = array (); $data[0] = $sizh. __('Module detailed event') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($module_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2433,7 +2458,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'alert_report_module': $data = array (); $data[0] = $sizh. __('Alert report module') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($module_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2452,7 +2477,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'alert_report_agent': $data = array (); $data[0] = $sizh. __('Alert report agent') . $sizhfin; - $data[1] = $sizh.$agent_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2495,7 +2520,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'database_serialized': $data = array (); $data[0] = $sizh. __('Serialize data') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 75, false).'
'.printTruncateText($module_name, 75, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2546,7 +2571,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'TTRT': $data = array (); $data[0] = $sizh. __('TTRT') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($module_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2574,7 +2599,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'TTO': $data = array (); $data[0] = $sizh. __('TTO') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($module_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2602,7 +2627,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'MTBF': $data = array (); $data[0] = $sizh. __('MTBF') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($module_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2630,7 +2655,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { case 'MTTR': $data = array (); $data[0] = $sizh. __('MTTR') . $sizhfin; - $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; + $data[1] = $sizh.printTruncateText($agent_name, 70, false).'
'.printTruncateText($module_name, 70, false).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2722,8 +2747,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $i=0; foreach ($data_avg as $d) { $data = array(); - $data[0] = printTruncateText($agent_name[$i], 30); - $data[1] = printTruncateText($module_name[$i], 30); + $data[0] = printSmallFont($agent_name[$i]); + $data[1] = printSmallFont($module_name[$i]); $d === false ? $data[2] = '--':$data[2] = $d; array_push ($table1->data, $data); $i++; @@ -2734,8 +2759,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $i=0; foreach ($agent_name as $a) { $data = array(); - $data[0] = printTruncateText($agent_name[$i], 30); - $data[1] = printTruncateText($module_name[$i], 30); + $data[0] = printSmallFont($agent_name[$i]); + $data[1] = printSmallFont($module_name[$i]); $data_avg[$i] === false ? $data[2] = '--':$data[2] = $data_avg[$i]; array_push ($table1->data, $data); $i++; @@ -2785,14 +2810,14 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $table2->style[0] = 'text-align: center'; $i = 1; foreach ($modules_list as $m) { - $table2->head[$i] = printTruncateText($m['nombre'], 20); + $table2->head[$i] = printTruncateText($m['nombre'], 20, false); $table2->style[$i] = 'text-align: center'; $i++; } foreach ($agent_list as $a) { $data = array(); - $data[0] = printTruncateText($a['nombre'], 20); + $data[0] = printSmallFont($a['nombre']); $i = 1; foreach ($modules_list as $m) { foreach ($generals as $g) { @@ -2990,8 +3015,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data_pie_graph[$agent_name[$i]] = $dt; if ($show_graph == 0 || $show_graph == 1) { $data = array(); - $data[0] = printTruncateText($agent_name[$i], 30); - $data[1] = printTruncateText($module_name[$i], 30); + $data[0] = printSmallFont($agent_name[$i]); + $data[1] = printSmallFont($module_name[$i]); $data[2] = $dt; array_push ($table1->data, $data); } @@ -3006,8 +3031,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data_pie_graph[$an] = $data_top[$i]; if ($show_graph == 0 || $show_graph == 1) { $data = array(); - $data[0] = printTruncateText($an, 30); - $data[1] = printTruncateText($module_name[$i], 30); + $data[0] = printSmallFont($an); + $data[1] = printSmallFont($module_name[$i]); $data[2] = $data_top[$i]; array_push ($table1->data, $data); } @@ -3245,8 +3270,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data_pie_graph[$agent_name[$j]] = $dex; if ($show_graph == 0 || $show_graph == 1) { $data = array(); - $data[0] = printTruncateText($agent_name[$j], 30); - $data[1] = printTruncateText($module_name[$j], 30); + $data[0] = printSmallFont($agent_name[$j]); + $data[1] = printSmallFont($module_name[$j]); $data[2] = $dex; array_push ($table1->data, $data); } @@ -3260,8 +3285,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data_pie_graph[$an] = $data_exceptions[$j]; if ($show_graph == 0 || $show_graph == 1) { $data = array(); - $data[0] = printTruncateText($an, 30); - $data[1] = printTruncateText($module_name[$j], 30); + $data[0] = printSmallFont($an); + $data[1] = printSmallFont($module_name[$j]); $data[2] = $data_exceptions[$j]; array_push ($table1->data, $data); } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 44580b5e17..a597313193 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -68,6 +68,35 @@ function printTruncateText($text, $numChars = 25, $showTextInAToopTip = true, $r } } +/** + * Print a string with a smaller font depending on its size. + * + * @param string $string String to be display with a smaller font. + * @param boolean $return Flag to return as string or not. + */ +function printSmallFont ($string, $return = true) { + $str = str_replace (' ', ' ', $string); + $length = strlen($str); + if ($length >= 30) { + $size = 0.7; + } elseif ($length >= 20) { + $size = 0.8; + } elseif ($length >= 10) { + $size = 0.9; + } elseif ($length < 10) { + $size = 1; + } + + $s = ''; + $s .= $string; + $s .= ''; + if ($return) { + return $s; + } else { + echo $s; + } +} + /** * Prints a generic message between tags. *