Fixed add particular agents to GIS layers
This commit is contained in:
parent
0a61a5f5d3
commit
e19f116637
|
@ -446,20 +446,12 @@ 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) {
|
||||
function gis_get_agents_layer($idLayer) {
|
||||
|
||||
if ($fields === null) {
|
||||
$select = '*';
|
||||
}
|
||||
else {
|
||||
$select = implode(',',$fields);
|
||||
}
|
||||
|
||||
$sql = "SELECT $select
|
||||
$sql = "SELECT id_agente, nombre
|
||||
FROM tagente
|
||||
WHERE id_agente IN (
|
||||
SELECT tagente_id_agente
|
||||
|
@ -467,16 +459,14 @@ function gis_get_agents_layer($idLayer, $fields = null) {
|
|||
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,10 +146,7 @@ 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);
|
||||
|
||||
|
@ -168,7 +165,6 @@ if ($layers != false) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$icon = gis_get_agent_icon_map($idAgent, true);
|
||||
$icon_size = getimagesize($icon);
|
||||
$icon_width = $icon_size[0];
|
||||
|
|
|
@ -182,10 +182,7 @@ 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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue