summaryrefslogtreecommitdiffstats
path: root/frontends/php/maps.php
blob: bd6289017044e8264f280aa3098df042970e0d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/* 
** ZABBIX
** Copyright (C) 2000-2005 SIA Zabbix
**
** 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; either version 2 of the License, or
** (at your option) any later version.
**
** 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.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
?>
<?php
	include "include/config.inc.php";
	$page["title"] = "S_NETWORK_MAPS";
	$page["file"] = "maps.php";

	$_REQUEST["fullscreen"] = get_request("fullscreen", 0);

	show_header($page["title"],1, $_REQUEST["fullscreen"] > 0 ? 1 : 0);

?>

<?php
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
	$fields=array(
		"sysmapid"=>		array(T_ZBX_INT, O_OPT,	P_SYS|P_NZERO,	DB_ID,		NULL),
		"fullscreen"=>		array(T_ZBX_INT, O_OPT,	P_SYS,		IN("0,1"),	NULL)
	);

	check_fields($fields);

?>

<?php
	$_REQUEST["sysmapid"] = get_request("sysmapid",get_profile("web.maps.sysmapid",0));

	if($_REQUEST["sysmapid"] <=0 )
	{
		$db_sysmaps = DBselect("select sysmapid,name from sysmaps order by name");
		if($sysmap = DBfetch($db_sysmaps))
		{
			$_REQUEST["sysmapid"] = $sysmap["sysmapid"];
		}
	}

	update_profile("web.maps.sysmapid",$_REQUEST["sysmapid"]);
	update_profile("web.menu.view.last",$page["file"]);

	if($_REQUEST["sysmapid"] > 0 && !check_right("Network map","R",$_REQUEST["sysmapid"]))
	{
		show_table_header("<font color=\"AA0000\">".S_NO_PERMISSIONS."</font>");
		show_page_footer();
		exit;
	}
?>


<?php
	$text = array(S_NETWORK_MAPS_BIG);
	if($_REQUEST["sysmapid"] > 0)
	{
		$sysmap = get_sysmap_by_sysmapid($_REQUEST["sysmapid"]);

		$url = "maps.php?sysmapid=".$_REQUEST["sysmapid"];
		if($_REQUEST["fullscreen"]==0)
			$url .= "&fullscreen=1";

		array_push($text, nbsp(" / "), new CLink($sysmap["name"],$url));
	}

	$form = new CForm();
	if($_REQUEST["fullscreen"]>=1)
		$form->AddVar("fullscreen",$_REQUEST["fullscreen"]);

	$cmbMaps = new CComboBox("sysmapid",$_REQUEST["sysmapid"],"submit()");
	$result=DBselect("select sysmapid,name from sysmaps order by name");
	while($row=DBfetch($result))
	{
		if(!check_right("Network map","R",$row["sysmapid"]))		continue;
		$cmbMaps->AddItem($row["sysmapid"],$row["name"]);
	}
	$form->AddItem($cmbMaps);

	show_header2($text,$form);
?>

<?php
	$table = new CTable(NULL,"map");
	if($_REQUEST["sysmapid"] > 0)
	{
		$action_map = get_action_map_by_sysmapid($_REQUEST["sysmapid"]);
		$table->AddRow($action_map);

		$imgMap = new CImg("map.php?noedit=1&sysmapid=".$_REQUEST["sysmapid"]);
		$imgMap->SetMap($action_map->GetName());
		$table->AddRow($imgMap);

	}
	$table->Show();
?>
<?php
	show_page_footer();
?>