";
/* Map with the current position */
echo "
";
if (!getAgentMap($agentId, "500px", "98%", true, true, $period)) {
echo "
" . __("There is no default map.") . "
";
}
$timestampLastOperation = get_db_value_sql("SELECT UNIX_TIMESTAMP()");
activateAjaxRefresh(null, $timestampLastOperation);
activateSelectControl();
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 "
";
$dataLastPosition = getDataLastPositionAgent($agentId);
if ($dataLastPosition !== false) {
echo "" . __("Last position in ") . $dataLastPosition['start_timestamp'] . ": " .
$dataLastPosition['stored_longitude'] . ", " . $dataLastPosition['stored_latitude'] . ", " . $dataLastPosition['stored_altitude'];
}
echo "
";
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);
$countData = get_db_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
FROM tgis_data_history
WHERE tagente_id_agente = %d AND end_timestamp > %d
ORDER BY end_timestamp DESC
LIMIT %d OFFSET %d", $agentId, get_system_time () - $period, $config['block_size'], get_parameter ('offset'));
$result = get_db_all_rows_sql ($sql, true);
if ($result === false) {
echo "".__('This agent doesn\'t have any GIS data')."
";
}
else {
pagination ($countData, false) ;
$table->data = array();
foreach ($result as $row) {
$rowdata = array($row['longitude'], $row['latitude'], $row['altitude'], $row['start_timestamp'], $row['end_timestamp'], $row['description'], $row['number_of_packages'], $row['manual_placement']);
array_push($table->data, $rowdata);
}
$table->head = array(__("Longitude"), __("Latitude"), __("Altitude"), __("From"), __("To"), __("Description"), '# '.__("of Packages"), __("Manual placement"));
$table->class = 'position_data_table';
$table->id = $agent_name.'_position_data_table';
$table->title = $agent_name." ". __("positional data");
print_table($table); unset($table);
pagination ($countData, false) ;
echo "" . __('Total') . ' ' . $countData . ' ' . __('Data') . "
";
}
?>