2010-02-18 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php: check in the function "addPath" if the agent
	haven't history data. And clean source code.
	
	* operation/agentes/gis_view.php: change to use new tables, and show
	messages when the agent haven't data GIS.
	
	* godmode/agentes/agent_conf_gis.php: change the message for agent without
	data GIS.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2376 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-02-18 16:54:24 +00:00
parent 1dfce3bc2b
commit a0c493b80c
4 changed files with 29 additions and 6 deletions

View File

@ -1,3 +1,14 @@
2010-02-18 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: check in the function "addPath" if the agent
haven't history data. And clean source code.
* operation/agentes/gis_view.php: change to use new tables, and show
messages when the agent haven't data GIS.
* godmode/agentes/agent_conf_gis.php: change the message for agent without
data GIS.
2010-02-18 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: hightlight that the parameter $script in

View File

@ -36,7 +36,7 @@ echo getAgentMap($id_agente, "500px", "98%", false);
if ($agentData === false) {
echo "<p>" . __("There aren't any GIS data of agent, then 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 "<h4>" . __("Warning: When you change the position the agent automatily enabled ignore GIS Data") . "</h4>";

View File

@ -448,7 +448,12 @@ function get_agent_icon_map($idAgent, $state = false) {
function addPath($layerName, $idAgent) {
$listPoints = get_db_all_rows_sql('SELECT * FROM tgis_data WHERE tagente_id_agente = ' . $idAgent . ' ORDER BY end_timestamp ASC');
$listPoints = get_db_all_rows_sql('SELECT * FROM tgis_data_history WHERE tagente_id_agente = ' . $idAgent . ' ORDER BY end_timestamp ASC');
//If the agent is empty the history
if ($listPoints === false) {
return;
}
$avaliableColors = array("#ff0000", "#00ff00", "#0000ff", "#000000");
@ -769,11 +774,13 @@ function getAgentMap($agent_id, $heigth, $width, $show_history = false, $centerI
makeLayer("layer_for_agent_".$agent_name);
$agent_icon = get_agent_icon_map($agent_id);
/* If show_history is true, show the path of the agent */
/* If show_history is true, show the path of the agent */
if ($show_history) {
/* TODO: only show the last history_time part of the path */
addPath("layer_for_agent_".$agent_name,$agent_id);
}
addPoint("layer_for_agent_".$agent_name, $agent_name, $agentPositionLatitude, $agentPositionLongitude, $agent_icon, 20, 20, $agent_id, 'point_agent_info');
if ($centerInAgent) {

View File

@ -33,6 +33,7 @@ require_javascript_file('openlayers.pandora');
$period = get_parameter ("period", 86400);
$agentId = get_parameter('id_agente');
$agent_name = get_agent_name($agentId);
$agentData = getDataLastPositionAgent($id_agente);
echo "<h2>".__('Received data from')." ". $agent_name . " </h2>";
echo "<h3>" . __("Map with the last position/s") . " " . human_time_description ($period) ."</h3>";
@ -41,13 +42,17 @@ echo "<h3>" . __("Map with the last position/s") . " " . human_time_description
echo "<div id=\"".$agent_name."_agent_map\" style=\"border:1px solid black; width:98%; height: 30em;\"></div>";
echo getAgentMap($agentId, "500px", "98%", true);
if ($agentData === false) {
echo "<p>" . __("There is no GIS data for this agent, so it's positioned in default position of map.") . "</p>";
}
echo "<h3>" . __("Positional data from the last") . " " . human_time_description ($period) ."</h3>";
/* Get the total number of Elements for the pagination */
$sqlCount = sprintf ("SELECT COUNT(*) FROM tgis_data WHERE tagente_id_agente = %d AND end_timestamp > %d ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period);
$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
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'));
@ -55,7 +60,7 @@ $result = get_db_all_rows_sql ($sql, true);
if ($result === false) {
echo '<h3 class="error">'.__('There was a problem locating the positional data').'</h3>';
echo '<h3 class="error">'.__('There was a problem locating the positional data or empty history.').'</h3>';
}
else {
pagination ($countData, false) ;