Minor visual improvements for the GIS views

This commit is contained in:
Alejandro Gallardo Escobar 2018-09-13 16:38:17 +02:00
parent a90f568287
commit 8601e38eed
2 changed files with 42 additions and 47 deletions

View File

@ -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 "<b>" . __("Last position in ") .
$dataLastPosition['start_timestamp'] . ":</b> " .
$dataLastPosition['stored_longitude'] . ", " . $dataLastPosition['stored_latitude'] . ", " . $dataLastPosition['stored_altitude'];
}
echo "<br />";
echo "<form class='' action='index.php?" . $url . "' method='POST'>";
echo "<table width=100% class='databox filters'>";
echo "<tr><td>" . __("Period to show data as path") . ": ";
echo "<tr><td>" . __("Period to show data as path");
echo "<td>";
html_print_extended_select_for_time ('period', $period, '', '', '0', 10);
echo "<td>";
html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"');
echo "</table></form>";
echo "<h4>" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."</h4>";
/* 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 "<h4>" . __("Positional data from the last") . " " . human_time_description_raw($period) ."</h4>";
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 "<h3>" . __('Total') . ' ' . $countData . ' ' . __('Data') . "</h3>";
if ($countData > 0) ui_pagination($countData, false);
}
?>

View File

@ -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'))) . "</a>";
}
if (check_acl ($config["id_user"], $map['group_id'], "MW") || check_acl ($config["id_user"], $map['group_id'], "MM")) {
$buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
$buttons['setup']['godmode'] = 1;
if ($has_management_acl) {
$hash = md5($config["dbpass"] . $idMap . $config["id_user"]);
$buttons['public_link']['text'] = '<a href="' .
ui_get_full_url('operation/gis_maps/public_console.php?hash=' .$hash .
'&map_id=' . $idMap . '&id_user=' . $config["id_user"]) . '" target="_blank">'.
html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
}
$buttonsString = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' .
html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . '&nbsp; Agent&nbsp;-&nbsp;test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=estado&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=3">' . html_print_image("images/setup.png", true, array("class" => "top", "title" => "Manage", "border" => "0", "width" => "16", "title" => "Manage")) . '&nbsp;</a></li><li class="nomn_high"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' . html_print_image("images/monitor.png", true, array("class" => "top", "title" => "Main", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=data">' . html_print_image("images/lightbulb.png", true, array("class" => "top", "title" => "Data", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=alert">' . html_print_image("images/bell.png", true, array("class" => "top", "title" => "Alerts", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=sla&amp;id_agente=3">' . html_print_image("images/images.png", true, array("class" => "top", "title" => "S.L.A.", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;group_id=2">' . html_print_image("images/agents_group.png", true, array("class" => "top", "title" => "Group", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=inventory&amp;id_agente=3">' . html_print_image("images/page_white_text.png", true, array("class" => "top", "title" => "Inventory", "border" => "0", "width" => "16")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente=3">' . html_print_image("images/world.png", array("class" => "top", "title" => "GIS data", "border" => "0")) . '&nbsp;</a>';
$times = array(
5 => __('5 seconds'),
10 => __('10 seconds'),
@ -144,19 +139,31 @@ $times = array(
SECONDS_5MINUTES => __('5 minutes'),
SECONDS_10MINUTES => __('10 minutes'),
SECONDS_1HOUR => __('1 hour'),
SECONDS_2HOUR => __('2 hours'));
SECONDS_2HOUR => __('2 hours')
);
$buttons[]['text'] = '&nbsp;' . __('Refresh: ') . html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false) . "&nbsp;";
$buttons[]['text'] = "<div style='margin-top: 6px;'>"
.__('Refresh') . ": "
. html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false)
. "</div>";
$status = array(
'all' => __('All'),
'all' => __('None'),
'bad' => __('Critical'),
'warning' => __('Warning'),
'ok' => __('Ok'),
'default' => __('Other'));
'default' => __('Other')
);
$buttons[]['text'] = '&nbsp;' . __('Show agents by state: ') .
html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false) . "&nbsp;";
$buttons[]['text'] = "<div style='margin-top: 6px;'>"
. __('Filter by status') . ": "
. html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false)
. "</div>";
if ($has_management_acl) {
$buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
$buttons['setup']['godmode'] = 1;
}
ui_print_page_header(__('Map') . " &raquo; " . __('Map') . "&nbsp;" . $map['map_name'],
"images/op_gis.png", false, "", false, $buttons);