From 6c519ff08a4bb6c78d12e010da447529796bf90c Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 13 Nov 2017 11:13:42 +0100 Subject: [PATCH] Removed last value on visual console boolean static graphs --- pandora_console/include/functions_modules.php | 22 +++++++++++++++++++ .../include/functions_visual_map.php | 8 +++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index bcdeb6819c..941d0bd5b2 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -987,6 +987,28 @@ function modules_is_string($id_agentmodule) { return modules_is_string_type($id_type); } + +/** + * Know if a module type is a boolean or not + * + * @param int $id_type Type id + * + * @return bool true if boolean. false if not + */ +function modules_is_boolean_type ($id_type) { + $type_name = modules_get_type_name($id_type); + + return (bool)preg_match('/_proc$/', $type_name); +} + +function modules_is_boolean($id_agentmodule) { + $id_type = db_get_value('id_tipo_modulo', + 'tagente_modulo', 'id_agente_modulo', + (int) $id_agentmodule); + + return modules_is_boolean_type($id_type); +} + /** * Get the icon of a module type * diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index b9b92a65da..7a1cb27b97 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1583,8 +1583,12 @@ function visual_map_print_item($mode = "read", $layoutData, if (!empty($unit_text)) $value .= " " . $unit_text; - $img_style_title .= "
" . __("Last value: ") . - $value; + // Hide value on boolean modules + if (!modules_is_boolean($layoutData['id_agente_modulo'])) { + $img_style_title .= + "
" . __("Last value: ") + . $value; + } } if(get_parameter('action') == 'edit'){