From c49df7c60dc73a65a3713f28d3188dcc0fddbc55 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 20 Feb 2017 15:32:10 +0100 Subject: [PATCH] Added a function to get the agent alias --- pandora_console/include/functions_agents.php | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 54cc4122b2..ccb02da5f7 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1325,6 +1325,28 @@ function agents_get_name ($id_agent, $case = "none") { } } +/** + * Get alias of an agent. + * + * @param int $id_agent Agent id. + * @param string $case Case (upper, lower, none) + * + * @return string Alias of the given agent. + */ +function agents_get_alias ($id_agent, $case = 'none') { + $alias = (string) db_get_value ('alias', 'tagente', 'id_agente', (int) $id_agent); + + 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. *