2011-04-12 Javier Lanz <javier.lanz@artica.es>
* 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
This commit is contained in:
parent
6a3debd2cb
commit
474e518eab
|
@ -1,3 +1,14 @@
|
|||
2011-04-12 Javier Lanz <javier.lanz@artica.es>
|
||||
|
||||
* 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 <juanmanuel.ramon@artica.es>
|
||||
|
||||
* extensions/users_connected.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);
|
|||
</tr>
|
||||
<tr id="row_module" style="" class="datos">
|
||||
<td style="vertical-align: top;"><?php echo __('Module'); ?></td>
|
||||
<td style="">
|
||||
<td style="max-width: 180px">
|
||||
<?php
|
||||
if($idAgent) {
|
||||
$sql = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = " . $idAgent;
|
||||
|
@ -369,7 +369,7 @@ print_input_hidden('id_item', $idItem);
|
|||
}
|
||||
else {
|
||||
?>
|
||||
<select id="id_agent_module" name="id_agent_module" disabled="disabled">
|
||||
<select style="max-width: 180px" id="id_agent_module" name="id_agent_module" disabled="disabled">
|
||||
<option value="0"><?php echo __('Select an Agent first'); ?></option>
|
||||
</select>
|
||||
<?php
|
||||
|
@ -552,8 +552,8 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||
$nameModule = get_db_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
|
||||
|
||||
echo '<tr id="sla_' . $item['id'] . '" style="" class="datos">
|
||||
<td>' . printTruncateText($nameAgent, 20) . '</td>
|
||||
<td>' . printTruncateText($nameModule, 20) . '</td>
|
||||
<td>' . printSmallFont($nameAgent) . '</td>
|
||||
<td>' . printSmallFont($nameModule) . '</td>
|
||||
<td>' . $item['sla_min'] . '</td>
|
||||
<td>' . $item['sla_max'] . '</td>
|
||||
<td>' . $item['sla_limit'] . '</td>
|
||||
|
@ -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 '<tr id="general_' . $item['id'] . '" style="" class="datos">
|
||||
<td>' . printTruncateText($nameAgent, 35) . '</td>
|
||||
<td>' . printTruncateText($nameModule, 35) . '</td>
|
||||
<td>' . printSmallFont($nameAgent) . '</td>
|
||||
<td>' . printSmallFont($nameModule) . '</td>
|
||||
<td style="text-align: center;">
|
||||
<a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . print_image("images/cross.png", true) . '</a>
|
||||
</td>
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -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).' <br> '.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).' <br> '.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] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">';
|
||||
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">'.__('Fail').'</span>';
|
||||
}
|
||||
$data[4] .= format_numeric ($sla_value). " %";
|
||||
$data[4] .= format_numeric ($sla_value). "%";
|
||||
}
|
||||
$data[4] .= "</span>";
|
||||
|
||||
|
@ -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] .= "<br>";
|
||||
$data[0] .= printSmallFont(get_agentmodule_name ($sla['id_agent_module']));
|
||||
$data[1] = "<img src='include/fgraph.php?tipo=sla_horizontal_graph&id=".$sla['id_agent_module'].
|
||||
"&period=".$content['period']."&value1=".$sla['sla_min']."&value2=".$sla['sla_max'].
|
||||
"&value3=".$content['time_from']."&value4=".$content['time_to']."&percent=".$sla['sla_limit'].
|
||||
"&daysWeek=".$daysWeek."&height=15&width=550'>";
|
||||
"&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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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).' <br> '.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);
|
||||
}
|
||||
|
|
|
@ -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 = '<span style="font-size: '.$size.'em;">';
|
||||
$s .= $string;
|
||||
$s .= '</span>';
|
||||
if ($return) {
|
||||
return $s;
|
||||
} else {
|
||||
echo $s;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a generic message between tags.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue