2013-05-20 Miguel de Dios <miguel.dedios@artica.es>

* include/ajax/skins.ajax.php, include/functions_gis.php,
	include/javascript/openlayers.pandora.js,
	operation/gis_maps/public_console.php, operation/gis_maps/ajax.php,
	operation/gis_maps/render_view.php,
	operation/visual_console/public_console.php,
	operation/visual_console/render_view.php: added the public console
	for GIS.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-05-20 16:35:49 +00:00
parent 5179c67f7a
commit 1f624fe58e
9 changed files with 399 additions and 113 deletions

View File

@ -1,3 +1,13 @@
2013-05-20 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/skins.ajax.php, include/functions_gis.php,
include/javascript/openlayers.pandora.js,
operation/gis_maps/public_console.php, operation/gis_maps/ajax.php,
operation/gis_maps/render_view.php,
operation/visual_console/public_console.php,
operation/visual_console/render_view.php: added the public console
for GIS.
2013-05-20 Miguel de Dios <miguel.dedios@artica.es>
* operation/gis_maps/ajax.php,

View File

@ -15,15 +15,13 @@
// Login check
global $config;
check_login ();
$get_image_path = get_parameter('get_image_path', 0);
/* skins image checks */
if ($get_image_path){
if ($get_image_path) {
$img_src = get_parameter("img_src");
$only_src = get_parameter("only_src", 0);
return html_print_image($img_src, false, '', $only_src);
}

View File

@ -128,12 +128,20 @@ function gis_print_map($idDiv, $iniZoom, $latCenter, $lonCenter, $baselayers, $c
echo "</script>";
}
function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null) {
function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null, $public_console = 0, $id_map = 0) {
global $config;
if ($dot == null) {
$dot['url'] = 'images/dot_green.png';
$dot['width'] = 20; //11;
$dot['height'] = 20; //11;
}
$hash = '';
if ($public_console) {
$hash = md5($config["dbpass"] . $id_map. $config["id_user"]);
}
$visible = (bool)$visible;
?>
<script type="text/javascript">
@ -153,13 +161,13 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null) {
var layer = new OpenLayers.Layer.Vector(
'<?php echo $name; ?>', {styleMap: style}
);
layer.data = {};
layer.data.id = '<?php echo $idLayer; ?>';
layer.setVisibility(<?php echo $visible; ?>);
map.addLayer(layer);
layer.events.on({
"featureselected": function(e) {
if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
@ -173,18 +181,18 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null) {
parameter.push ({name: "page", value: "include/ajax/skins.ajax"});
parameter.push ({name: "get_image_path", value: "1"});
parameter.push ({name: "img_src", value: "images/spinner.gif"});
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
data: parameter,
async: false,
timeout: 10000,
success: function (data) {
img_src = data;
}
});
});
popup = new OpenLayers.Popup.FramedCloud('cloud00',
long_lat,
null,
@ -196,10 +204,15 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null) {
map.addPopup(popup);
jQuery.ajax ({
data: "page=operation/gis_maps/ajax&opt="+featureData.type+"&id=" + featureData.id,
data: "page=operation/gis_maps/ajax"
+ "&opt=" + featureData.type
+ "&id=" + featureData.id
+ "&hash=<?php echo $hash; ?>"
+ "&id_user=<?php echo $config["id_user"]; ?>"
+ "&map_id=<?php echo $id_map; ?>",
type: "GET",
dataType: 'json',
url: "ajax.php",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false, false); ?>",
timeout: 10000,
success: function (data) {
if (data.correct) {
@ -241,8 +254,16 @@ function gis_activate_select_control($layers=null) {
*
* @return None
*/
function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) {
if ($lastTimeOfData === null) $lastTimeOfData = time();
function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $public_console = 0, $id_map = 0) {
global $config;
if ($lastTimeOfData === null)
$lastTimeOfData = time();
$hash = '';
if ($public_console) {
$hash = md5($config["dbpass"] . $id_map. $config["id_user"]);
}
ui_require_jquery_file ('json');
?>
@ -276,8 +297,15 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) {
if (featureIdArray.length > 0) {
jQuery.ajax ({
data: "page=operation/gis_maps/ajax&opt=get_new_positions&id_features=" + featureIdArray.toString()
+ "&last_time_of_data=" + last_time_of_data + "&layer_id=" + layer.data.id + "&agent_view=" + agentView,
data: "page=operation/gis_maps/ajax"
+ "&opt=get_new_positions"
+ "&id_features=" + featureIdArray.toString()
+ "&last_time_of_data=" + last_time_of_data
+ "&layer_id=" + layer.data.id
+ "&agent_view=" + agentView
+ "&hash=<?php echo $hash; ?>"
+ "&id_user=<?php echo $config["id_user"]; ?>"
+ "&map_id=<?php echo $id_map; ?>",
type: "GET",
dataType: 'json',
url: "ajax.php",
@ -375,7 +403,9 @@ function gis_add_agent_point($layerName, $pointName, $lat, $lon, $icon = null, $
<?php
if ($icon != null) {
//echo "js_addPointExtent('$layerName', '$pointName', $lon, $lat, '$icon', $width, $height, $point_id, '$type_string', $status);";
echo "js_addAgentPointExtent('$layerName', '$pointName', $lon, $lat, '$icon', $width, $height, $point_id, '$type_string', $status, $idParent);";
echo "js_addAgentPointExtent('$layerName',
'$pointName', $lon, $lat, '$icon', $width,
$height, $point_id, '$type_string', $status, $idParent);";
}
else {
//echo "js_addPoint('$layerName', '$pointName', $lon, $lat, $point_id, '$type_string', $status);";

View File

@ -37,7 +37,12 @@ function js_refreshParentLines(layerName) {
id = feature.data.id;
status = feature.data.status;
listFeaturesWithParents[id] = {'id': id, 'id_parent': id_parent, 'long_lat': long_lat, 'status': status, 'visible': visible};
listFeaturesWithParents[id] = {
'id': id,
'id_parent': id_parent,
'long_lat': long_lat,
'status': status,
'visible': visible};
}
});
});
@ -351,7 +356,7 @@ function js_makeLayer(name, visible, dot) {
dot['width'] = 20; //11;
dot['height'] = 20; //11;
}
//Set the style in layer
var style = new OpenLayers.StyleMap(
{fontColor: "#ff0000",
@ -362,64 +367,13 @@ function js_makeLayer(name, visible, dot) {
label:"${nombre}"
}
);
//Make the layer as type vector
var layer = new OpenLayers.Layer.Vector(name, {styleMap: style});
layer.setVisibility(visible);
layer.setVisibility(visible);
map.addLayer(layer);
//Disable for WIP
/////
// layer.events.on({
// "beforefeaturemodified": test,
// "featuremodified": test,
// "afterfeaturemodified": test,
// "vertexmodified": test,
// "sketchmodified": test,
// "sketchstarted": test,
// "sketchcomplete": test
// });
/////
// layer.events.on({
// "featureselected": function(e) {
// if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
// var feature = e.feature;
// var featureData = feature.data;
// var long_lat = featureData.long_lat;
//
// var popup;
//
// popup = new OpenLayers.Popup.FramedCloud('cloud00',
// long_lat,
// null,
// '<div class="cloudContent' + featureData.id + '" style="text-align: center;"><img src="images/spinner.gif" /></div>',
// null,
// true,
// function () { popup.destroy(); });
// feature.popup = popup;
// map.addPopup(popup);
//
// jQuery.ajax ({
// data: "page=operation/gis_maps/ajax&opt="+featureData.type+"&id=" + featureData.id,
// type: "GET",
// dataType: 'json',
// url: "ajax.php",
// timeout: 10000,
// success: function (data) {
// if (data.correct) {
// $('.cloudContent' + featureData.id).css('text-align', 'left');
// $('.cloudContent' + featureData.id).html(data.content);
// popup.updateSize();
// }
// }
// });
// }
// }
// });
return layer;
}
@ -501,7 +455,15 @@ function js_addAgentPoint(layerName, pointName, lon, lat, id, type_string, statu
var layer = map.getLayersByName(layerName);
layer = layer[0];
feature = new OpenLayers.Feature.Vector(point,{id_parent: idParent, status: statusAgent, nombre: pointName, id: id, type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) });
feature = new OpenLayers.Feature.Vector(point,
{
id_parent: idParent,
status: statusAgent,
nombre: pointName,
id: id,
type: type_string,
long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())
});
if (isHideFeatureByStatus(statusAgent)) {
feature.style.display = 'none';
@ -572,7 +534,23 @@ function js_addAgentPointExtent(layerName, pointName, lon, lat, icon, width, hei
else
statusA = statusAgent;
feature = new OpenLayers.Feature.Vector(point,{id_parent: idParent, status: statusA, id: id, type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) }, {fontWeight: "bolder", fontColor: "#00014F", labelYOffset: -height, graphicHeight: width, graphicWidth: height, externalGraphic: icon, label: pointName});
feature = new OpenLayers.Feature.Vector(point,
{
id_parent: idParent,
status: statusA,
id: id,
type: type_string,
long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())
},
{
fontWeight: "bolder",
fontColor: "#00014F",
labelYOffset: -height,
graphicHeight: width,
graphicWidth: height,
externalGraphic: icon,
label: pointName
});
if (isHideFeatureByStatus(statusAgent)) {
feature.style.display = 'none';
@ -709,4 +687,4 @@ function searchPointAgentById(id) {
}
return null;
}
}

View File

@ -14,16 +14,37 @@
// GNU General Public License for more details.
// Load global vars
require_once ("include/config.php");
if (file_exists(getcwd() . '/include/config.php')) {
require_once ("include/config.php");
}
else {
require_once ("../../include/config.php");
}
check_login ();
$hash = (string)get_parameter('hash', '');
if (!empty($hash)) {
//It is a ajax call from PUBLIC_CONSOLE
$idMap = (int) get_parameter ('map_id');
$id_user = get_parameter ('id_user', '');
$myhash = md5($config["dbpass"] . $idMap . $id_user);
// Check input hash
if ($myhash == $hash) {
$config['id_user'] = $id_user;
}
}
else {
check_login ();
}
global $config;
require_once ('include/functions_gis.php');
require_once ('include/functions_ui.php');
require_once ('include/functions_agents.php');
require_once ('include/functions_groups.php');
require_once ($config['homedir'] . '/include/functions_gis.php');
require_once ($config['homedir'] . '/include/functions_ui.php');
require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_groups.php');
$opt = get_parameter('opt');
@ -48,6 +69,8 @@ switch ($opt) {
$returnJSON = array();
$returnJSON['correct'] = 1;
$idAgentsWithGIS = array();
if ($agentView == 0) {
$flagGroupAll = db_get_all_rows_sql('SELECT tgrupo_id_grupo
FROM tgis_map_layer
@ -61,17 +84,26 @@ switch ($opt) {
$idAgentsWithGISTemp = db_get_all_rows_sql('SELECT id_agente
FROM tagente
WHERE id_grupo IN
(SELECT tgrupo_id_grupo FROM tgis_map_layer WHERE id_tmap_layer = ' . $layerId . ')
(SELECT tgrupo_id_grupo
FROM tgis_map_layer
WHERE id_tmap_layer = ' . $layerId . ')
OR id_agente IN
(SELECT tagente_id_agente FROM tgis_map_layer_has_tagente WHERE tgis_map_layer_id_tmap_layer = ' . $layerId . ');');
(SELECT tagente_id_agente
FROM tgis_map_layer_has_tagente
WHERE tgis_map_layer_id_tmap_layer = ' . $layerId . ');');
}
else {
//All groups, all agents
$idAgentsWithGISTemp = db_get_all_rows_sql('SELECT tagente_id_agente AS id_agente
$idAgentsWithGISTemp = db_get_all_rows_sql('SELECT
tagente_id_agente AS id_agente
FROM tgis_data_status
WHERE tagente_id_agente');
}
if (empty($idAgentsWithGISTemp)) {
$idAgentsWithGISTemp = array();
}
foreach ($idAgentsWithGISTemp as $idAgent) {
$idAgentsWithGIS[] = $idAgent['id_agente'];
}
@ -83,28 +115,58 @@ switch ($opt) {
switch ($config["dbtype"]) {
case "mysql":
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente AS t1
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
if (empty($idAgentsWithGIS)) {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente AS t1
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
WHERE 1 = 0');
}
else {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente AS t1
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
}
break;
case "postgresql":
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente AS t1
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
if (empty($idAgentsWithGIS)) {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente AS t1
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
WHERE 1 = 0');
}
else {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente AS t1
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
}
break;
case "oracle":
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1
LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
if (empty($idAgentsWithGIS)) {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1
LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente
WHERE 1 = 0');
}
else {
$agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente,
COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
FROM tagente t1
LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
}
break;
}
@ -173,11 +235,13 @@ switch ($opt) {
{
$returnJSON['content'] .= __('Position (Lat, Long, Alt)') . ': (' . $agentDataGIS['stored_latitude'] . ', ' . $agentDataGIS['stored_longitude'] . ', ' . $agentDataGIS['stored_altitude'] . ') <br />';
}
$agent_ip_address = agents_get_address ($id_agente);
$agent_ip_address = agents_get_address ($id);
if ($agent_ip_address || $agent_ip_address != '') {
$returnJSON['content'] .= __('IP Address').': '.agents_get_address ($id_agente).'<br />';
$returnJSON['content'] .= __('IP Address') . ': '.
agents_get_address ($id).'<br />';
}
$returnJSON['content'] .= __('OS').': ' . ui_print_os_icon($row['id_os'], true, true);
$returnJSON['content'] .= __('OS').': ' .
ui_print_os_icon($row['id_os'], true, true);
$osversion_offset = strlen($row["os_version"]);
if ($osversion_offset > 15) {
@ -186,12 +250,15 @@ switch ($opt) {
else {
$osversion_offset = 0;
}
$returnJSON['content'] .= '&nbsp;( <i><span title="'.$row["os_version"].'">'.substr($row["os_version"],$osversion_offset,15).'</span></i>)<br />';
$returnJSON['content'] .= '&nbsp;( <i><span title="' . $row["os_version"] . '">' .
substr($row["os_version"],$osversion_offset,15).'</span></i>)<br />';
$agent_description = $row['comentarios'];
if ($agent_description || $agent_description != '') {
$returnJSON['content'] .= __('Description').': '.$agent_description.'<br />';
}
$returnJSON['content'] .= __('Group').': ' . ui_print_group_icon ($row["id_grupo"], true).'&nbsp;(<strong>'.groups_get_name ($row["id_grupo"]).'</strong>)<br />';
$returnJSON['content'] .= __('Group').': ' .
ui_print_group_icon ($row["id_grupo"], true) .
'&nbsp;(<strong>'.groups_get_name ($row["id_grupo"]).'</strong>)<br />';
$returnJSON['content'] .= __('Agent Version').': '.$row["agent_version"].'<br />';
$returnJSON['content'] .= __('Last contact') . ": ";
if ($row["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {

View File

@ -0,0 +1,195 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 20012 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
require_once ("../../include/config.php");
// Set root on homedir, as defined in setup
chdir ($config["homedir"]);
session_start ();
ob_start ();
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
echo '<head>';
global $vc_public_view;
$vc_public_view = true;
// This starts the page head. In the call back function,
// things from $page['head'] array will be processed into the head
ob_start ('ui_process_page_head');
require_once('include/functions_gis.php');
require_once($config['homedir'] . "/include/functions_agents.php");
ui_require_javascript_file('openlayers.pandora');
$config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
$hash = get_parameter ('hash');
$idMap = (int) get_parameter ('map_id');
$config["id_user"] = get_parameter ('id_user');
$myhash = md5($config["dbpass"] . $idMap . $config["id_user"]);
// Check input hash
if ( $myhash != $hash) {
exit;
}
$show_history = get_parameter ('show_history', 'n');
$map = db_get_row ('tgis_map', 'id_tgis_map', $idMap);
$confMap = gis_get_map_conf($idMap);
$num_baselayer=0;
// Initialy there is no Gmap base layer.
$gmap_layer = false;
if ($confMap !== false) {
foreach ($confMap as $mapC) {
$baselayers[$num_baselayer]['typeBaseLayer'] = $mapC['connection_type'];
$baselayers[$num_baselayer]['name'] = $mapC['conection_name'];
$baselayers[$num_baselayer]['num_zoom_levels'] = $mapC['num_zoom_levels'];
$decodeJSON = json_decode($mapC['conection_data'], true);
switch ($mapC['connection_type']) {
case 'OSM':
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
break;
case 'Gmap':
$baselayers[$num_baselayer]['gmap_type'] = $decodeJSON['gmap_type'];
$baselayers[$num_baselayer]['gmap_key'] = $decodeJSON['gmap_key'];
$gmap_key = $decodeJSON['gmap_key'];
// Onece a Gmap base layer is found we mark it to import the API
$gmap_layer = true;
break;
case 'Static_Image':
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
$baselayers[$num_baselayer]['bb_left'] = $decodeJSON['bb_left'];
$baselayers[$num_baselayer]['bb_right'] = $decodeJSON['bb_right'];
$baselayers[$num_baselayer]['bb_bottom'] = $decodeJSON['bb_bottom'];
$baselayers[$num_baselayer]['bb_top'] = $decodeJSON['bb_top'];
$baselayers[$num_baselayer]['image_width'] = $decodeJSON['image_width'];
$baselayers[$num_baselayer]['image_height'] = $decodeJSON['image_height'];
break;
}
$num_baselayer++;
if ($mapC['default_map_connection'] == 1) {
$numZoomLevels = $mapC['num_zoom_levels'];
}
}
}
if ($gmap_layer === true) {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
<?php
}
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition', 'layerSwitcher');
$layers = gis_get_layers($idMap);
echo '<div style="width: 95%; background: white; margin: 20px auto 20px auto; box-shadow: 10px 10px 5px #000;">';
echo "<h1>" . $map['map_name'] . "</h1>";
echo "<br />";
echo "<div id='map' style='z-index:100; width: 99%; height: 500px; min-height:500px; border: 1px solid black;' ></div>";
echo "</div>";
gis_print_map('map', $map['zoom_level'], $map['initial_latitude'],
$map['initial_longitude'], $baselayers, $controls);
if ($layers != false) {
foreach ($layers as $layer) {
gis_make_layer($layer['layer_name'],
$layer['view_layer'], null, $layer['id_tmap_layer'], 1, $idMap);
// calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB.
$agentNamesByGroup = array();
if ($layer['tgrupo_id_grupo'] >= 0) {
$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'));
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
foreach ($agentNames as $agentName) {
$idAgent = agents_get_agent_id($agentName);
$coords = gis_get_data_last_position_agent($idAgent);
if ($coords === false) {
$coords['stored_latitude'] = $map['default_latitude'];
$coords['stored_longitude'] = $map['default_longitude'];
}
else {
if ($show_history == 'y') {
$lastPosition = array('longitude' => $coords['stored_longitude'], 'latitude' => $coords['stored_latitude']);
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];
$icon_height = $icon_size[1];
$icon = ui_get_full_url($icon);
$status = agents_get_status($idAgent);
$parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent);
gis_add_agent_point($layer['layer_name'],
io_safe_output($agentName), $coords['stored_latitude'],
$coords['stored_longitude'], $icon, $icon_width,
$icon_height, $idAgent, $status, 'point_agent_info',
$parent);
}
}
gis_add_parent_lines();
switch ($config["dbtype"]) {
case "mysql":
$timestampLastOperation = db_get_value_sql("SELECT UNIX_TIMESTAMP()");
break;
case "postgresql":
$timestampLastOperation = db_get_value_sql(
"SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))");
break;
case "oracle":
$timestampLastOperation = db_get_value_sql(
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) FROM dual");
break;
}
gis_activate_select_control();
gis_activate_ajax_refresh($layers, $timestampLastOperation, 1, $idMap);
}
// Resize GIS map on fullscreen
?>
<script type="text/javascript">
$().ready(function(){
var new_height = $(document).height();
$("#map").css("height", new_height - 60);
});
</script>

View File

@ -98,6 +98,14 @@ else {
if (check_acl ($config["id_user"], $map['group_id'], "IW")) {
$buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
$buttons['setup']['godmode'] = 1;
$hash = md5($config["dbpass"] . $idMap . $config["id_user"]);
$buttons['public_link']['text'] = '<a href="' .
ui_get_full_url('operation/gis_maps/public_console.php?hash=' .$hash .
'&map_id=' . $idMap . '&id_user=' . $config["id_user"]) . '" target="_blank">'.
html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
}
$buttonsString = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' .

View File

@ -73,7 +73,7 @@ if (!isset($config['pure']))
// Render map
$options = array();
echo '<div style="width: 95%; background: white; margin: 20px auto 20px auto; box-shadow: 10px 10px 5px #000;">';
echo "<h1>". $layout_name. "</h1>";
echo "<h1>" . $layout_name . "</h1>";
visual_map_print_visual_map ($id_layout, true, true, null, null, '../../');
@ -101,7 +101,7 @@ $table->data[0][1] = html_print_select ($values, 'refr', $config["vc_refr"], '',
$table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
$table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true);
if ($vc_refr){
if ($vc_refr) {
$config["vc_refr"] = 0;
}

View File

@ -86,7 +86,7 @@ $options['consoles_list']['text'] = '<a href="index.php?sec=reporting&sec2=godmo
if (check_acl ($config["id_user"], $id_group, "RW")) {
$url_base = 'index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&action=';
$hash = md5($config["dbpass"]. $id_layout. $config["id_user"]);
$hash = md5($config["dbpass"] . $id_layout. $config["id_user"]);
$options['public_link']['text'] = '<a href="' . ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]) . '" target="_blank">'.
html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';