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.
|
* 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
|
||||||
|
@ -467,16 +459,14 @@ function gis_get_agents_layer($idLayer, $fields = null) {
|
||||||
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 $agents;
|
return $returned_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,10 +146,7 @@ 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);
|
||||||
|
|
||||||
|
@ -168,7 +165,6 @@ if ($layers != false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$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,10 +182,7 @@ 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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue