summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/computers/hostoverview.php
blob: b59dbea60b0ae98c01b8e3d9580d025124ad8a9d (plain) (blame)
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
<?php

include('../standard_header.inc.php');

# Dateiname und evtl. Pfad des Templates für die Webseite
$webseite = "hostoverview.dwt";

include('computers_header.inc.php');

$mnr = 1; 
$sbmnr = -1;
$mcnr = -1;

###################################################################################

# Menuleisten erstellen
createMainMenu($rollen, $mainnr);
createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr);

###################################################################################

$template->assign(array("DN" => "",
								"HOSTNAME" => "Noch keine Rechner angelegt",
           			      "DOMAINNAME" => "",
           			      "HWADDRESS" => "",
           			      "IPADDRESS" => "",            			      
           		       	"DHCPCONT" => "",
           		       	"FIXADD" => "",
           		       	"RBSCONT" => "",
           		       	"NXTSRV" => ""));

$attributes = array("dn","hostname","domainname","hwaddress","ipaddress","dhcphlpcont","dhcpoptfixed-address","hlprbservice","dhcpoptnext-server");
$host_array = get_hosts($auDN,$attributes);

$template->define_dynamic("Rechner", "Webseite");

$i = 0;
foreach ($host_array as $host){
	
	$hostname = "<a href='host.php?dn=".$host['dn']."&sbmnr=".$i."' class='headerlink'>".$host['hostname']."</a>";
	$hostip = explode('_',$host['ipaddress']);
	
	$dhcpcont = "";
	$dhcpfixadd = "";
	if ( count($host['dhcphlpcont']) != 0 ){
	   $dhcpexpdn = ldap_explode_dn($host['dhcphlpcont'],1);
	   $dhcpcn = $dhcpexpdn[0];
	   #$ocarray = get_node_data($host['dhcphlpcont'],array("objectclass","dhcphlpcont"));
	   #$sub = array_search('dhcpSubnet', $ocarray['objectclass']);
	   #if ($sub !== false ){
	   #   $dhcpcont = "Subnet ".$dhcpexpdn[0]." <br>[".$dhcpexpdn[2]."]";
	   #}else{
	   $dhcpcont = $dhcpexpdn[0]." <br>[".$dhcpexpdn[2]."]";
	   #}
	   $dhcpfixadd = "dyn";
	   if ( $host['dhcpoptfixed-address'] == "ip" ){
			$dhcpfixadd = "fix";
		}
	   if ( $host['dhcpoptfixed-address'] == "hostname" ){
			$dhcpfixadd = "fix (DNS)";
		}  
	}
	
	
	
	$rbscont = "";
	$dhcpnxtsrv = "";
	if ( count($host['hlprbservice']) != 0 ){
	   $rbsexpdn = ldap_explode_dn($host['hlprbservice'],1);
	   $rbscont = $rbsexpdn[0]." <br>[".$rbsexpdn[2]."]";
	   
	   $dhcpnxtsrv = $host['dhcpoptnext-server'];
	}
	
	$template->assign(array("DN" => $host['dn'],
								"HOSTNAME" => $hostname,
           			      "DOMAINNAME" => $host['domainname'],
           			      "HWADDRESS" => $host['hwaddress'],
           			      "IPADDRESS" => $hostip[0],            			      
           		       	"DHCPCONT" => $dhcpcont,
           		       	"FIXADD" => $dhcpfixadd,
           		       	"RBSCONT" => $rbscont,
           		       	"NXTSRV" => $dhcpnxtsrv,
           		       	"AUDN" => $auDN ));
	$template->parse("RECHNER_LIST", ".Rechner");
	
	$i++;
}

###################################################################################

include("computers_footer.inc.php");

?>