From 27d4a6c3163621bf6ddf0ef00ec44c8828807332 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Fri, 17 Mar 2017 11:55:34 +0100 Subject: [PATCH] Show agent alias in gis maps with entities - #98 --- pandora_console/include/functions_agents.php | 14 ++++++++++++++ pandora_console/include/functions_gis.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 80e8c6c778..5455dab2bf 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1347,6 +1347,20 @@ function agents_get_alias ($id_agent, $case = 'none') { } } +function agents_get_alias_by_name ($name, $case = 'none') { + $alias = (string) db_get_value ('alias', 'tagente', 'nombre', $name); + + switch ($case) { + case 'upper': + return mb_strtoupper($alias, 'UTF-8'); + case 'lower': + return mb_strtolower($alias, 'UTF-8'); + case 'none': + default: + return ($alias); + } +} + /** * Get the number of pandora data packets in the database. * diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index 075e46ceb4..cbd4b28b69 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -1074,7 +1074,7 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c gis_add_agent_point("layer_for_agent_" . $agent_name, - $clean_agent_name, $agentPositionLatitude, $agentPositionLongitude, + io_safe_output(agents_get_alias_by_name($clean_agent_name)), $agentPositionLatitude, $agentPositionLongitude, $agent_icon, $agent_icon_width, $agent_icon_height, $agent_id, $status, 'point_agent_info');