Fixed agents display on GIS maps
This commit is contained in:
parent
8ef8f31f67
commit
6a53e924bb
|
@ -446,37 +446,27 @@ function gis_add_agent_point($layerName, $pointName, $lat, $lon, $icon = null, $
|
||||||
* Get the agents in layer but not by group in layer.
|
* Get the agents in layer but not by group in layer.
|
||||||
*
|
*
|
||||||
* @param integer $idLayer Layer ID.
|
* @param integer $idLayer Layer ID.
|
||||||
* @param array $fields Fields of row tagente to return.
|
|
||||||
*
|
*
|
||||||
* @return array The array rows of tagente of agents in the layer.
|
* @return array The array rows of tagente of agents in the layer.
|
||||||
*/
|
*/
|
||||||
function gis_get_agents_layer($idLayer, $fields = null) {
|
function gis_get_agents_layer($idLayer) {
|
||||||
|
|
||||||
if ($fields === null) {
|
$sql = "SELECT id_agente, nombre
|
||||||
$select = '*';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$select = implode(',',$fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT $select
|
|
||||||
FROM tagente
|
FROM tagente
|
||||||
WHERE id_agente IN (
|
WHERE id_agente IN (
|
||||||
SELECT tagente_id_agente
|
SELECT tagente_id_agente
|
||||||
FROM tgis_map_layer_has_tagente
|
FROM tgis_map_layer_has_tagente
|
||||||
WHERE tgis_map_layer_id_tmap_layer = $idLayer)";
|
WHERE tgis_map_layer_id_tmap_layer = $idLayer)";
|
||||||
$agents = db_get_all_rows_sql($sql);
|
$agents = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
$returned_agents = array();
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $index => $agent) {
|
foreach ($agents as $index => $agent) {
|
||||||
$agents[$index] = $agent['nombre'];
|
$returned_agents[$agent['id_agente']] = $agent['nombre'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return array();
|
return $returned_agents;
|
||||||
}
|
|
||||||
|
|
||||||
return $agents;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gis_add_point_path($layerName, $lat, $lon, $color, $manual = 1, $id) {
|
function gis_add_point_path($layerName, $lat, $lon, $color, $manual = 1, $id) {
|
||||||
|
|
|
@ -146,13 +146,10 @@ if ($layers != false) {
|
||||||
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
|
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
|
||||||
false, 'none', true, true, false);
|
false, 'none', true, true, false);
|
||||||
}
|
}
|
||||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
|
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']);
|
||||||
array('nombre'));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||||
|
|
||||||
foreach ($agentNames as $agentName) {
|
foreach ($agentNames as $agentName) {
|
||||||
$idAgent = agents_get_agent_id($agentName);
|
$idAgent = agents_get_agent_id($agentName);
|
||||||
$coords = gis_get_data_last_position_agent($idAgent);
|
$coords = gis_get_data_last_position_agent($idAgent);
|
||||||
|
@ -167,8 +164,7 @@ if ($layers != false) {
|
||||||
gis_add_path($layer['layer_name'], $idAgent, $lastPosition);
|
gis_add_path($layer['layer_name'], $idAgent, $lastPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$icon = gis_get_agent_icon_map($idAgent, true);
|
$icon = gis_get_agent_icon_map($idAgent, true);
|
||||||
$icon_size = getimagesize($icon);
|
$icon_size = getimagesize($icon);
|
||||||
$icon_width = $icon_size[0];
|
$icon_width = $icon_size[0];
|
||||||
|
|
|
@ -182,13 +182,10 @@ if ($layers != false) {
|
||||||
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
|
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
|
||||||
false, 'none', true, true, false);
|
false, 'none', true, true, false);
|
||||||
}
|
}
|
||||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
|
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']);
|
||||||
array('nombre'));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||||
|
|
||||||
foreach ($agentNames as $key => $agentName) {
|
foreach ($agentNames as $key => $agentName) {
|
||||||
$idAgent = $key;
|
$idAgent = $key;
|
||||||
$coords = gis_get_data_last_position_agent($idAgent);
|
$coords = gis_get_data_last_position_agent($idAgent);
|
||||||
|
|
Loading…
Reference in New Issue