diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index c67a97037a..1b7d341917 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -36,7 +36,6 @@ $agentId = (int)get_parameter('id_agente'); $id_agente = $agentId; $agent_name = agents_get_name($id_agente); $agent_alias = agents_get_alias($id_agente); -$agentData = gis_get_data_last_position_agent($id_agente); //Avoid the agents with characters that fails the div. $agent_name_original = $agent_name; @@ -83,35 +82,22 @@ switch ($config["dbtype"]) { gis_activate_ajax_refresh(null, $timestampLastOperation); gis_activate_select_control(); -if ($agentData === false) { - ui_print_info_message ( - __("There is no GIS data for this agent, so it's positioned in default position of map.") ); -} - -$dataLastPosition = gis_get_data_last_position_agent($agentId); -if ($dataLastPosition !== false) { - echo "" . __("Last position in ") . - $dataLastPosition['start_timestamp'] . ": " . - $dataLastPosition['stored_longitude'] . ", " . $dataLastPosition['stored_latitude'] . ", " . $dataLastPosition['stored_altitude']; -} - +echo "
"; echo "
"; echo ""; -echo "
" . __("Period to show data as path") . ": "; +echo "
" . __("Period to show data as path"); echo ""; html_print_extended_select_for_time ('period', $period, '', '', '0', 10); echo ""; html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"'); echo "
"; -echo "

" . __("Positional data from the last") . " " . human_time_description_raw ($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 > FROM_UNIXTIME(%d) ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period); -$countData = db_get_value_sql($sqlCount); - +$countData = (int) db_get_value_sql($sqlCount); /* Get the elements to present in this page */ switch ($config["dbtype"]) { @@ -141,9 +127,7 @@ switch ($config["dbtype"]) { $result = db_get_all_rows_sql ($sql, true); - if ($result === false) { - $sql2 = sprintf (" SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude, start_timestamp, description, number_of_packages, manual_placement @@ -163,10 +147,11 @@ if ($result === false) { } if ($result !== false) { - if(!$countData){ - $countData = 1; - } - ui_pagination ($countData, false) ; + echo "

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

"; + + if ($countData > 0) ui_pagination($countData, false); + + $table = new StdClass(); $table->data = array(); foreach ($result as $key => $row) { $distance = 0; @@ -187,9 +172,13 @@ if ($result !== false) { $rowdata = array( $row['longitude'], $row['latitude'], - $row['altitude'], - $row['start_timestamp'], - $row['end_timestamp'], + (int) $row['altitude'] . " m", + is_numeric($row['start_timestamp']) + ? date($config["date_format"], $row['start_timestamp']) + : date_w_fixed_tz($row['start_timestamp']), + is_numeric($row['end_timestamp']) + ? date($config["date_format"], $row['end_timestamp']) + : date_w_fixed_tz($row['end_timestamp']), $row['description'], sprintf(__('%s Km'), $distance), $row['number_of_packages'], @@ -206,13 +195,12 @@ if ($result !== false) { __('Distance'), __("# of Packages"), __("Manual placement")); - $table->class = 'position_data_table'; + $table->class = 'databox data'; $table->id = $agent_name.'_position_data_table'; - $table->title = $agent_alias . " " . __("positional data"); - $table->titlestyle = "background-color:#799E48;"; - html_print_table($table); unset($table); + $table->width = '100%'; + html_print_table($table); + unset($table); - ui_pagination ($countData, false) ; - echo "

" . __('Total') . ' ' . $countData . ' ' . __('Data') . "

"; + if ($countData > 0) 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 eabefebbfe..de453a5a81 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -108,6 +108,9 @@ $layers = gis_get_layers($idMap); // Render map +$has_management_acl = check_acl($config["id_user"], $map['group_id'], "MW") + || check_acl ($config["id_user"], $map['group_id'], "MM"); + $buttons = array(); if ($config["pure"] == 0) { @@ -119,22 +122,14 @@ else { html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . ""; } -if (check_acl ($config["id_user"], $map['group_id'], "MW") || check_acl ($config["id_user"], $map['group_id'], "MM")) { - $buttons['setup']['text'] = ''.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).''; - $buttons['setup']['godmode'] = 1; - - +if ($has_management_acl) { $hash = md5($config["dbpass"] . $idMap . $config["id_user"]); - $buttons['public_link']['text'] = ''. html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).''; } -$buttonsString = '' . - html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . '  Agent - test_gis1