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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
function gis_get_agents_layer($idLayer, $fields = null) {
|
||||
|
||||
if ($fields === null) {
|
||||
$select = '*';
|
||||
}
|
||||
else {
|
||||
$select = implode(',',$fields);
|
||||
}
|
||||
|
||||
$sql = "SELECT $select
|
||||
function gis_get_agents_layer($idLayer) {
|
||||
|
||||
$sql = "SELECT id_agente, nombre
|
||||
FROM tagente
|
||||
WHERE id_agente IN (
|
||||
SELECT tagente_id_agente
|
||||
FROM tgis_map_layer_has_tagente
|
||||
WHERE tgis_map_layer_id_tmap_layer = $idLayer)";
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$returned_agents = array();
|
||||
if ($agents !== false) {
|
||||
foreach ($agents as $index => $agent) {
|
||||
$agents[$index] = $agent['nombre'];
|
||||
$returned_agents[$agent['id_agente']] = $agent['nombre'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $agents;
|
||||
|
||||
return $returned_agents;
|
||||
}
|
||||
|
||||
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'],
|
||||
false, 'none', true, true, false);
|
||||
}
|
||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
|
||||
array('nombre'));
|
||||
|
||||
|
||||
|
||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']);
|
||||
|
||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||
|
||||
|
||||
foreach ($agentNames as $agentName) {
|
||||
$idAgent = agents_get_agent_id($agentName);
|
||||
$coords = gis_get_data_last_position_agent($idAgent);
|
||||
|
@ -167,8 +164,7 @@ if ($layers != false) {
|
|||
gis_add_path($layer['layer_name'], $idAgent, $lastPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$icon = gis_get_agent_icon_map($idAgent, true);
|
||||
$icon_size = getimagesize($icon);
|
||||
$icon_width = $icon_size[0];
|
||||
|
|
|
@ -182,13 +182,10 @@ if ($layers != false) {
|
|||
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
|
||||
false, 'none', true, true, false);
|
||||
}
|
||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
|
||||
array('nombre'));
|
||||
|
||||
|
||||
|
||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']);
|
||||
|
||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||
|
||||
|
||||
foreach ($agentNames as $key => $agentName) {
|
||||
$idAgent = $key;
|
||||
$coords = gis_get_data_last_position_agent($idAgent);
|
||||
|
|
Loading…
Reference in New Issue