diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index f5ecd254f1..b164a17589 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -476,7 +476,7 @@ function addPath($layerName, $idAgent, $history_time = null) { $where = '1 = 1'; } else { - $where = 'start_timestamp = FROM_UNIXTIME(UNIX_TIMESTAMP() - ' . $history_time . ')'; + $where = 'start_timestamp >= FROM_UNIXTIME(UNIX_TIMESTAMP() - ' . $history_time . ')'; } $listPoints = get_db_all_rows_sql('SELECT * diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index c2956612da..a1c524cf52 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -40,7 +40,7 @@ echo "

" . __("Map with the last position/s") . " " . human_time_description /* Map with the current position */ echo "
"; -echo getAgentMap($agentId, "500px", "98%", true); +echo getAgentMap($agentId, "500px", "98%", true, true, $period); $timestampLastOperation = get_db_value_sql("SELECT UNIX_TIMESTAMP()"); @@ -51,6 +51,28 @@ if ($agentData === false) { echo "

" . __("There is no GIS data for this agent, so it's positioned in default position of map.") . "

"; } +$intervals = array (); +$intervals[30] = human_time_description_raw (30); +$intervals[60] = human_time_description_raw (60); +$intervals[300] = human_time_description_raw (300); +$intervals[600] = human_time_description_raw (600); +$intervals[1200] = human_time_description_raw (1200); +$intervals[1800] = human_time_description_raw (1800); +$intervals[3600] = human_time_description_raw (3600); +$intervals[7200] = human_time_description_raw (7200); +$intervals[86400] = human_time_description_raw (86400); +$intervals[172800] = human_time_description_raw (172800); +$intervals[604800] = human_time_description_raw (604800); + +echo "
"; +//debugPrint($_SERVER); +echo "
"; +echo __("Period to show data as path") . ": "; +print_extended_select_for_time ($intervals, 'period', $period, '', '', '0', 10); +echo __(" seconds."); +print_submit_button(__('Refresh'), 'refresh', false, 'class = "sub upd"'); +echo "
"; + echo "

" . __("Positional data from the last") . " " . human_time_description ($period) ."

"; /* Get the total number of Elements for the pagination */ $sqlCount = sprintf ("SELECT COUNT(*) FROM tgis_data_history WHERE tagente_id_agente = %d AND end_timestamp > %d ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period);