2010-01-18 Miguel de Dios <miguel.dedios@artica.es>
* operation/visual_console/render_view.php: fix style, add a white space. * include/styles/menu.css, include/styles/pandora.css: add styles for GIS maps. * operation/gis_maps/*, operation/menu.php, images/gis_map, godmode/setup/gis.php, godmode/menu.php: add first version of GIS maps. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2280 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c26772d2c1
commit
8641d8fc48
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* Pandora FMS- http://pandorafms.com
|
||||
* ==================================================
|
||||
* Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
|
||||
// Login check
|
||||
check_login ();
|
||||
|
||||
require_once ('include/functions_gis.php');
|
||||
|
||||
echo "<h2>".__('GIS Maps')." » ".__('Summary')."</h2>";
|
||||
|
||||
$maps = getMaps();
|
||||
|
||||
$table->width = "70%";
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->align = array ();
|
||||
$table->align[1] = 'center';
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
if ($maps !== false) {
|
||||
foreach ($maps as $map) {
|
||||
if ($rowPair)
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
else
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
|
||||
if (!give_acl ($config["id_user"], $map["group_id"], "AR")) {
|
||||
continue;
|
||||
}
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&id='.
|
||||
$map['id_tgis_map'] . '">' . $map['map_name'].'</a> ';
|
||||
$data[1] = print_group_icon ($map["group_id"], true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
print_table ($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.__('No maps found').'</div>';
|
||||
}
|
||||
unset ($table);
|
||||
?>
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
require_once ('include/functions_gis.php');
|
||||
|
||||
$idMap = (int) get_parameter ('id');
|
||||
|
||||
$map = get_db_row ('tgis_map', 'id_tgis_map', $idMap);
|
||||
$confMap = getMapConf($idMap);
|
||||
$baseLayers = $confMap['baselayer'];
|
||||
$controls = $confMap['controls'][0];
|
||||
$numZoomLevels = $confMap['numLevelsZoom'][0];
|
||||
|
||||
$layers = getLayers($idMap);
|
||||
|
||||
// Render map
|
||||
echo "<h2>".__('Visual console')." » ".__('Map');
|
||||
echo " " . $map['map_name'] . " ";
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/gis_maps/render_view&id='.$idMap.'&refr='.$config["refr"].'&pure=1">';
|
||||
print_image ("images/fullscreen.png", false, array ("title" => __('Full screen mode')));
|
||||
echo "</a>";
|
||||
} else {
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/gis_maps/render_view&id='.$idMap.'&refr='.$config["refr"].'">';
|
||||
print_image ("images/normalscreen.png", false, array ("title" => __('Back to normal mode')));
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
echo " ";
|
||||
|
||||
if (give_acl ($config["id_user"], $map['group_id'], "AW"))
|
||||
echo '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&id_map='.$idMap.'">'.print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
|
||||
echo "</h2>";
|
||||
|
||||
printMap('map', $map['zoom_level'], $numZoomLevels, $map['initial_latitude'],
|
||||
$map['initial_longitude'], array($baseLayers[0]['typeBaseLayer'] => $baseLayers[0]['url']), $controls);
|
||||
|
||||
if ($layers != false) {
|
||||
foreach ($layers as $layer) {
|
||||
makeLayer($layer['layer_name'], $layer['view_layer']);
|
||||
|
||||
$agentNames = get_group_agents($layer['tgrupo_id_grupo']);
|
||||
foreach ($agentNames as $agentName) {
|
||||
$idAgent = get_agent_id($agentName);
|
||||
$coords = get_agent_last_coords($idAgent);
|
||||
|
||||
switch (get_agent_status($idAgent)) {
|
||||
case 1:
|
||||
case 4:
|
||||
//Critical (BAD or ALERT)
|
||||
$status = "bad";
|
||||
break;
|
||||
case 0:
|
||||
//Normal (OK)
|
||||
$status = "ok";
|
||||
break;
|
||||
case 2:
|
||||
//Warning
|
||||
$status = "warning";
|
||||
break;
|
||||
default:
|
||||
// Default is Grey (Other)
|
||||
$status = false;
|
||||
}
|
||||
$icon = get_agent_icon_map($idAgent, $status);
|
||||
|
||||
addPath($layer['layer_name'], $idAgent);
|
||||
addPoint($layer['layer_name'], $agentName, $coords['last_latitude'], $coords['last_longitude'], $icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<br /><br />
|
||||
<div id='map' style='width: 99%; height: 400px; border: 1px solid black;' ></div>
|
Loading…
Reference in New Issue