diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8257de62ba..2453ff7aea 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2013-05-20 Miguel de Dios <miguel.dedios@artica.es> + + * include/functions_gis.php, operation/gis_maps/render_view.php, + operation/agentes/gis_view.php: changed the code to set the agent + icon with the original size. + 2013-05-20 Miguel de Dios <miguel.dedios@artica.es> * extensions/net_tools.php: added a entry to godmode for set the diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index f270a6493a..d2b60321ec 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -363,20 +363,20 @@ function gis_add_agent_point($layerName, $pointName, $lat, $lon, $icon = null, $ $pointName = ''; ?> <script type="text/javascript"> - $(document).ready ( - function () { - <?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);"; + $(document).ready ( + function () { + <?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);"; + } + else { + //echo "js_addPoint('$layerName', '$pointName', $lon, $lat, $point_id, '$type_string', $status);"; + echo "js_addAgentPoint('$layerName', '$pointName', $lon, $lat, $point_id, '$type_string', $status, $idParent);"; + } + ?> } - else { - //echo "js_addPoint('$layerName', '$pointName', $lon, $lat, $point_id, '$type_string', $status);"; - echo "js_addAgentPoint('$layerName', '$pointName', $lon, $lat, $point_id, '$type_string', $status, $idParent);"; - } - ?> - } - ); + ); </script> <?php } @@ -463,8 +463,10 @@ function gis_get_layers($idMap) { function gis_get_agent_icon_map($idAgent, $state = false, $status = null) { global $config; - $row = db_get_row_sql('SELECT id_grupo, icon_path - FROM tagente WHERE id_agente = ' . $idAgent); + $row = db_get_row_sql(' + SELECT id_grupo, icon_path + FROM tagente + WHERE id_agente = ' . $idAgent); if (($row['icon_path'] === null) || (strlen($row['icon_path']) == 0)) { if ($config['gis_default_icon'] != "") { @@ -874,11 +876,13 @@ function gis_get_conection_conf($idConnection) { */ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $centerInAgent = true, $history_time = 86400) { $defaultMap = db_get_all_rows_sql(" - SELECT t1.*, t3.conection_name, t3.connection_type, t3.conection_data, t3.num_zoom_levels + SELECT t1.*, t3.conection_name, t3.connection_type, + t3.conection_data, t3.num_zoom_levels FROM tgis_map AS t1, tgis_map_has_tgis_map_connection AS t2, tgis_map_connection AS t3 - WHERE t1.default_map = 1 AND t2.tgis_map_id_tgis_map = t1.id_tgis_map + WHERE t1.default_map = 1 + AND t2.tgis_map_id_tgis_map = t1.id_tgis_map AND t2.default_map_connection = 1 AND t3.id_tmap_connection = t2.tgis_map_connection_id_tmap_connection"); @@ -936,7 +940,7 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c 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> + <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script> <?php } @@ -944,18 +948,28 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c $defaultMap['initial_latitude'], $defaultMap['initial_longitude'], $baselayers, $controls); - gis_make_layer("layer_for_agent_".$agent_name); + gis_make_layer("layer_for_agent_" . $agent_name); $agent_icon = gis_get_agent_icon_map($agent_id, true); + $agent_icon_size = getimagesize($agent_icon); + $agent_icon_width = $agent_icon_size[0]; + $agent_icon_height = $agent_icon_size[1]; $status = agents_get_status($agent_id); /* If show_history is true, show the path of the agent */ if ($show_history) { - $lastPosition = array('longitude' => $agentPositionLongitude, 'latitude' => $agentPositionLatitude); - gis_add_path("layer_for_agent_".$agent_name,$agent_id, $lastPosition, $history_time); + $lastPosition = array( + 'longitude' => $agentPositionLongitude, + 'latitude' => $agentPositionLatitude); + gis_add_path("layer_for_agent_" . $agent_name, + $agent_id, $lastPosition, $history_time); } - gis_add_agent_point("layer_for_agent_".$agent_name, $agent_name, $agentPositionLatitude, $agentPositionLongitude, $agent_icon, 20, 20, $agent_id, $status, 'point_agent_info'); + + gis_add_agent_point("layer_for_agent_" . $agent_name, + $agent_name, $agentPositionLatitude, $agentPositionLongitude, + $agent_icon, $agent_icon_width, $agent_icon_height, $agent_id, + $status, 'point_agent_info'); if ($centerInAgent) { ?> diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index 131f65e98b..c9c69fc091 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -72,7 +72,9 @@ gis_activate_ajax_refresh(null, $timestampLastOperation); gis_activate_select_control(); if ($agentData === false) { - echo "<p>" . __("There is no GIS data for this agent, so it's positioned in default position of map.") . "</p>"; + echo "<p>" . + __("There is no GIS data for this agent, so it's positioned in default position of map.") . + "</p>"; } echo "<br />"; @@ -98,7 +100,9 @@ $countData = db_get_value_sql($sqlCount); /* Get the elements to present in this page */ -$sql = sprintf ("SELECT longitude, latitude, altitude, start_timestamp, end_timestamp, description, number_of_packages, manual_placement +$sql = sprintf (" + SELECT longitude, latitude, altitude, start_timestamp, + end_timestamp, description, number_of_packages, manual_placement FROM tgis_data_history WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d) ORDER BY end_timestamp DESC @@ -107,7 +111,8 @@ $result = db_get_all_rows_sql ($sql, true); if ($result === false) { - echo "<div class='nf'>".__('This agent doesn\'t have any GIS data')."</div>"; + echo "<div class='nf'>" . + __('This agent doesn\'t have any GIS data.') . "</div>"; } else { ui_pagination ($countData, false) ; diff --git a/pandora_console/operation/gis_maps/render_view.php b/pandora_console/operation/gis_maps/render_view.php index 50f9c15826..48da1d2529 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -123,9 +123,11 @@ $status = array( 'ok' => __('Ok'), 'default' => __('Other')); -$buttons[]['text'] = ' ' . __('Show agents by state: ') . html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false) . " "; +$buttons[]['text'] = ' ' . __('Show agents by state: ') . + html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false) . " "; -ui_print_page_header(__('Map') . " » " . __('Map') . " " . $map['map_name'], "images/op_gis.png", false, "", false, $buttons); +ui_print_page_header(__('Map') . " » " . __('Map') . " " . $map['map_name'], + "images/op_gis.png", false, "", false, $buttons); if ($config["pure"] == 0) { echo "<div id='map' style='width: 99%; height: 500px; border: 1px solid black;' ></div>"; @@ -172,11 +174,17 @@ if ($layers != false) { $icon = gis_get_agent_icon_map($idAgent, true); + $icon_size = getimagesize($icon); + $icon_width = $icon_size[0]; + $icon_height = $icon_size[1]; $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, 20, 20, $idAgent, $status, 'point_agent_info', $parent); + 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();