Fixed gis map agents name when refresh map. Ticket #395

This commit is contained in:
Arturo Gonzalez 2017-03-01 09:20:28 +01:00
parent 62bdfbf4f8
commit 8bae65b4a2
3 changed files with 14 additions and 15 deletions

View File

@ -464,7 +464,7 @@ function js_addAgentPoint(layerName, pointName, lon, lat, id, type_string, statu
type: type_string, type: type_string,
long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())
}); });
if (isHideFeatureByStatus(statusAgent)) { if (isHideFeatureByStatus(statusAgent)) {
feature.style.display = 'none'; feature.style.display = 'none';
} }
@ -536,9 +536,9 @@ function js_addAgentPointExtent(layerName, pointName, lon, lat, icon, width, hei
feature = new OpenLayers.Feature.Vector(point, feature = new OpenLayers.Feature.Vector(point,
{ {
id_parent: idParent, id_parent: idParent.toString(),
status: statusA, status: statusA,
id: id, id: id.toString(),
type: type_string, type: type_string,
long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())
}, },

View File

@ -117,7 +117,7 @@ switch ($opt) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
if (empty($idAgentsWithGIS)) { if (empty($idAgentsWithGIS)) {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente,
IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1 FROM tagente t1
@ -125,7 +125,7 @@ switch ($opt) {
WHERE 1 = 0'); WHERE 1 = 0');
} }
else { else {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente,
IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1 FROM tagente t1
@ -135,7 +135,7 @@ switch ($opt) {
break; break;
case "postgresql": case "postgresql":
if (empty($idAgentsWithGIS)) { if (empty($idAgentsWithGIS)) {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1 FROM tagente t1
@ -143,7 +143,7 @@ switch ($opt) {
WHERE 1 = 0'); WHERE 1 = 0');
} }
else { else {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1 FROM tagente t1
@ -153,7 +153,7 @@ switch ($opt) {
break; break;
case "oracle": case "oracle":
if (empty($idAgentsWithGIS)) { if (empty($idAgentsWithGIS)) {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1 FROM tagente t1
@ -161,7 +161,7 @@ switch ($opt) {
WHERE 1 = 0'); WHERE 1 = 0');
} }
else { else {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1 FROM tagente t1
@ -180,7 +180,7 @@ switch ($opt) {
$status = agents_get_status($row['tagente_id_agente']); $status = agents_get_status($row['tagente_id_agente']);
if (!$config['gis_label']) if (!$config['gis_label'])
$row['nombre'] = ''; $row['alias'] = '';
$icon = gis_get_agent_icon_map($row['tagente_id_agente'], true, $status); $icon = gis_get_agent_icon_map($row['tagente_id_agente'], true, $status);
if ($icon[0] !== '/') { if ($icon[0] !== '/') {
@ -196,7 +196,7 @@ switch ($opt) {
'icon_path' => $config["homeurl"] . '/' . $icon, 'icon_path' => $config["homeurl"] . '/' . $icon,
'icon_width' => $icon_width, 'icon_width' => $icon_width,
'icon_height' => $icon_height, 'icon_height' => $icon_height,
'name' => $row['nombre'], 'name' => io_safe_output($row['alias']),
'status' => $status, 'status' => $status,
'stored_longitude' => $row['stored_longitude'], 'stored_longitude' => $row['stored_longitude'],
'stored_latitude' => $row['stored_latitude'], 'stored_latitude' => $row['stored_latitude'],

View File

@ -183,10 +183,10 @@ if ($layers != false) {
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer); $agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
foreach ($agentNames as $agentName) { foreach ($agentNames as $key => $agentName) {
$idAgent = agents_get_agent_id($agentName); $idAgent = $key;
$coords = gis_get_data_last_position_agent($idAgent); $coords = gis_get_data_last_position_agent($idAgent);
if ($coords === false) { if ($coords === false) {
$coords['stored_latitude'] = $map['default_latitude']; $coords['stored_latitude'] = $map['default_latitude'];
$coords['stored_longitude'] = $map['default_longitude']; $coords['stored_longitude'] = $map['default_longitude'];
@ -198,7 +198,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];