function createDNSMenu($rollen, $mnr) { global $template; global $START_PATH; # Struktur der Registerkartenleiste $hauptmenu = array(array("link" => "dns.php", "text" => "Übersicht", "zugriff" => "alle"), array("link" => "dns_au_zones.php", "text" => "AUs - DNS Zonen", "zugriff" => array("ZoneAdmin")), array("link" => "dns_error_hosts.php", "text" => "Clients - DNS Zonen", "zugriff" => array("MainAdmin", "ZoneAdmin"))); #$rollen = array_keys($roles); # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); $i = 0; foreach ($hauptmenu as $item) { if ($item['zugriff'] === "alle" || vergleicheArrays($rollen, $item['zugriff'])) { if ($i == 0) { if ($mnr == 0) { $zwisch = ""; $lastaktive = true; $farb = "#505050"; } else { $zwisch = ""; $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($mnr == $i) { $zwisch = ""; $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if ($lastaktive) { $zwisch = ""; } else { $zwisch = ""; } $lastaktive = false; } } $template->assign(array("ZWISCHEN" => $zwisch, "FARBE" => $farb, "LINK_M" => $item["link"], "TEXT_M" => $item["text"])); $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); } $i = $i + 1; } if ($lastaktive) { $template->assign(array("ENDE" => "")); } else { $template->assign(array("ENDE" => "")); } }
function createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr) { global $template, $ds, $suffix, $START_PATH; $mipb_array = get_maxipblocks_au($auDN); #print_r($mipb_array); if ($mipb_array[0] == "") { $iprechnerlink = "no_ip.php?mnr=2"; } else { $iprechnerlink = "ip_rechner.php?sort=ipaddress"; } # Struktur der Registerkartenleiste # Hauptmenu $hauptmenu = array(array("link" => "hostoverview.php?sort=hostname", "text" => "Übersicht Clients", "zugriff" => array("MainAdmin", "HostAdmin", "DhcpAdmin")), array("link" => $iprechnerlink, "text" => "IP Adressen / Dienste", "zugriff" => array("MainAdmin", "DhcpAdmin", "HostAdmin"))); # Submenus /*$computers_array = get_hosts($auDN,array("dn","hostname","ou")); for($n=0;$n<count($computers_array);$n++){ $comps[] = array("link" => "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, "text" => $computers_array[$n]['hostname'], "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); # print_r($comps); echo "<br>"; }*/ $comps[] = array("link" => "new_host.php?sbmnr=0", "text" => "Neuen Client anlegen", "zugriff" => array("MainAdmin", "DhcpAdmin", "HostAdmin")); /* $groups_array = get_groups($auDN,array("dn","cn")); for($n=0;$n<count($groups_array);$n++){ $groups = array(); $groups[] = array("link" => "group.php?dn=".$groups_array[$n]['dn']."&sbmnr=".$n, "text" => $groups_array[$n]['cn'], "zugriff" => array("MainAdmin","DhcpAdmin","HostAdmin")); } $groups[] = array("link" => "new_group.php?sbmnr=".$n, "text" => "Neue Gruppe anlegen", "zugriff" => array("MainAdmin","DhcpAdmin","HostAdmin")); */ # default machine-configs #$mcdef_array = get_machineconfigs("cn=computers,".$auDN,array("dn","cn","timerange")); #for($n=0;$n<count($mcdef_array);$n++){ # $defmc [] = array("link" => "mcdef.php?dn=".$mcdef_array[$n]['dn']."&mnr=3&sbmnr=".$n, # "text" => $mcdef_array[$n]['cn'], # "zugriff" => array("MainAdmin","DhcpAdmin","HostAdmin")); #} $newpxe[] = array("link" => "new_pxe.php", "text" => "Neue PXE Config", "zugriff" => array("MainAdmin", "DhcpAdmin")); $submenu = array($comps, array(), $newpxe); #echo "submenu: ";print_r($submenu);echo "<br><br>"; # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); $template->define_dynamic("Submenu", "Menu"); $i = 0; $maxmenu = count($hauptmenu); foreach ($hauptmenu as $item) { $template->clear_parse("SUBMENU_LIST"); if ($item['zugriff'] === "alle" || vergleicheArrays($rollen, $item['zugriff'])) { ######################################################################### # SUBMENU $subempty = 0; $j = 0; $maxsub = count($submenu[$mnr]); #echo "_"; print_r($maxsub); echo "_"; if ($maxsub > 0) { foreach ($submenu[$mnr] as $item2) { if ($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { if ($i != $mnr) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } else { if ($j == 0) { if ($sbmnr == 0) { if ($maxsub == 1) { $zwisch2 = "branchbottom2"; } else { $zwisch2 = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { if ($maxsub == 1) { $zwisch2 = "branchbottom2"; } else { $zwisch2 = "branch2"; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($sbmnr == $j) { if ($maxsub == $j + 1) { $zwisch2 = "branchbottom2"; } else { $zwisch2 = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { if ($maxsub == $j + 1) { $zwisch2 = "branchbottom2"; } else { $zwisch2 = "branch2"; } $farb = "#A0A0A0"; $lastaktive = false; } } $htmlcode = "\n\t\t \t\t<tr height='2'>\n\t\t\t\t\t\t<td></td><td align='right'><img src='../pics/line2.gif' height='2'></td><td></td><td></td>\n\t\t \t\t</tr>\n\t\t \t\t<tr>\n\t\t\t\t\t\t<td width='8%'> </td>\n\t\t\t\t\t\t<td width='5%' align='right'><img src='../pics/" . $zwisch2 . ".gif'></td>\n \t\t\t\t\t\t<td width='5%' align='left' style='border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:4;background-color:{FARBE_S}'> </td>\n\t\t \t\t\t<td width='74%' align='left' style='border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:4;padding-left:12px;background-color:{FARBE_S}'> \n\t\t \t\t\t<a href='" . $item2['link'] . "' style='text-decoration:none'><code class='submenue_schrift'>" . $item2['text'] . "</code></a></td>\n\t\t\t\t\t\t<td width='8%'> </td> \t\t\t\t\t\t\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; $template->assign(array("SUB" => $htmlcode)); $template->assign(array("FARBE_S" => $farb)); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } } else { $subempty++; } $j = $j + 1; } } if ($subempty == count($submenu[$mnr])) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } # SUBMENU ##################################################################### if ($i == 0) { if ($mnr == 0) { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($mnr == $i) { if (count($submenu[$mnr][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if (count($submenu[$i][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } $template->assign(array("ICON" => $zwisch, "FARBE" => $farb, "LINK_M" => $item["link"], "TEXT_M" => $item["text"])); $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); $template->clear_dynamic("Hauptmenu"); } $i = $i + 1; } if ($lastaktive) { $template->assign(array("ENDE" => "")); } else { $template->assign(array("ENDE" => "")); } }
function createAUMenu($rollen, $mnr, $auDN, $sbmnr) { global $template, $ds, $suffix, $START_PATH, $au_ou; # Mainmenu $hauptmenu = array(array("link" => "au.php", "text" => "Übersicht", "zugriff" => "alle"), array("link" => "au_show.php", "text" => "AU {$au_ou}", "zugriff" => array("MainAdmin", "DhcpAdmin", "HostAdmin")), array("link" => "au_childs.php", "text" => "Untergeordnete AUs", "zugriff" => array("MainAdmin")), array("link" => "roles.php", "text" => "AU Administratoren", "zugriff" => array("MainAdmin"))); #echo "hauptmenu: ";print_r($hauptmenu);echo "<br><br>"; # Submenu $childaus = array(); $n = 0; #$childau_array = get_childau($auDN,array("dn","cn","ou")); #echo "childau_array: ";print_r($childau_array);echo "<br><br>"; #if (count($childau_array)!= 0){ # for ($n=0;$n<count($childau_array);$n++) { # $childaus[] = array("link" => "child_au.php?dn=".$childau_array[$n]['dn']."&sbmnr=".$n, # "text" => $childau_array[$n]['ou'], # "zugriff" => array("MainAdmin")); # } # #$c=0+$n; #} #$c = $n; $childaus[] = array("link" => "new_child.php?sbmnr=" . $n, "text" => "Neue AU anlegen", "zugriff" => array("MainAdmin")); $adminroles = array(array("link" => "role_show.php?role=MainAdmin&sbmnr=0", "text" => "Main Admins", "zugriff" => array("MainAdmin")), array("link" => "role_show.php?role=HostAdmin&sbmnr=1", "text" => "Client Admins", "zugriff" => array("MainAdmin")), array("link" => "role_show.php?role=DhcpAdmin&sbmnr=2", "text" => "DHCP Admins", "zugriff" => array("MainAdmin")), array("link" => "role_show.php?role=RbsAdmin&sbmnr=3", "text" => "RemoteBoot Admins", "zugriff" => array("MainAdmin")), array("link" => "role_show.php?role=ZoneAdmin&mnr=4", "text" => "DNS Zonen Admins", "zugriff" => array("ZoneAdmin"))); $submenu = array(array(), array(), $childaus, $adminroles); #echo "submenu: ";print_r($submenu);echo "<br><br>"; # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); $template->define_dynamic("Submenu", "Menu"); $i = 0; $maxmenu = count($hauptmenu); foreach ($hauptmenu as $item) { $template->clear_parse("SUBMENU_LIST"); #echo "item: "; print_r($item); echo "<br>"; if ($item['zugriff'] === "alle" || vergleicheArrays($rollen, $item['zugriff'])) { ######################################################################### # SUBMENU $subempty = 0; $j = 0; $maxsub = count($submenu[$mnr]); #echo "maxsub: "; print_r($maxsub); echo "<br>"; if ($maxsub > 0) { foreach ($submenu[$mnr] as $item2) { #echo "item2: "; print_r($item2); echo "<br>"; if ($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { if ($i != $mnr) { $template->assign(array("SUB" => "")); #"LINK_S" => "", #"TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } else { if ($j == 0) { if ($sbmnr == 0) { if ($maxsub == 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { if ($maxsub == 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($sbmnr == $j) { if ($maxsub == $j + 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if ($maxsub == $j + 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } # if ($lastaktive) {$zwisch="branch";} # else {$zwisch="branch";} $lastaktive = false; } } $htmlcode = "\n\t\t\t\t\t\t\t\t<tr height='2'>\n\t\t\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t\t\t<td align='right'><img src='../pics/line2.gif' height='2'></td>\n\t\t\t\t\t\t\t\t\t<td colspan='2'></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td width='8%'></td>\n\t\t\t\t\t\t\t\t\t<td width='8%' align='right'><img src='../pics/" . $zwisch . ".gif'></td>\n\t\t\t\t\t\t\t\t\t<td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:4;padding-left:25px;background-color:{FARBE_S}'>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $item2['link'] . "' style='text-decoration:none'><code class='submenue_schrift'>" . $item2['text'] . "</code></a></td>\n\t\t\t\t\t\t\t\t\t<td width='10%'></td>\n\t\t\t\t\t\t\t\t</tr>"; $template->assign(array("SUB" => $htmlcode)); $template->assign(array("FARBE_S" => $farb)); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } } else { $subempty++; } $j = $j + 1; } } if ($subempty == count($submenu[$mnr])) { $template->assign(array("SUB" => "")); #"LINK_S" => "", #"TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } # SUBMENU ##################################################################### if ($i == 0) { if ($mnr == 0) { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n\t\t\t\t\t\t\t\t\t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n\t\t\t\t\t\t\t\t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($mnr == $i) { if (count($submenu[$mnr][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if (count($submenu[$i][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n\t\t\t\t\t\t\t\t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n\t\t\t\t\t\t\t\t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } } else { $zwisch = ""; } #if ($lastaktive) {$zwisch="";} #else {$zwisch="";} $lastaktive = false; } } $template->assign(array("ICON" => $zwisch, "FARBE" => $farb, "LINK_M" => $item["link"], "TEXT_M" => $item["text"])); $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); $template->clear_dynamic("Hauptmenu"); } $i = $i + 1; } if ($lastaktive) { $template->assign(array("ENDE" => "")); } else { $template->assign(array("ENDE" => "")); } }
function createComputersMenu($roles, $mnr, $auDN, $sbmnr) { global $template, $ds, $suffix, $START_PATH; # Struktur der Registerkartenleiste # Hauptmenu $hauptmenu = array(array("link" => "computers.php", "text" => "Übersicht", "zugriff" => "alle"), array("link" => "hostoverview.php", "text" => "Rechner", "zugriff" => array("MainAdmin")), array("link" => "computers.php", "text" => "Neuen Rechner anlegen", "zugriff" => array("MainAdmin")), array("link" => "groupoverview.php", "text" => "Rechnergruppen", "zugriff" => array("MainAdmin")), array("link" => "computers.php", "text" => "Neue Gruppe anlegen", "zugriff" => array("MainAdmin"))); # Submenu $computers_array = get_hosts($auDN, array("dn", "hostname", "ou")); for ($n = 0; $n < count($computers_array); $n++) { $comps[] = array("link" => "host.php?dn=" . $computers_array[$n]['dn'] . "&sbmnr=" . $n, "text" => $computers_array[$n]['hostname'], "zugriff" => array("MainAdmin")); } $groups_array = get_groups($auDN, array("dn", "cn")); for ($n = 0; $n < count($groups_array); $n++) { $groups[] = array("link" => "group.php?dn=" . $groups_array[$n]['dn'] . "&sbmnr=" . $n, "text" => $groups_array[$n]['cn'], "zugriff" => array("MainAdmin")); } $submenu = array(array(array()), $comps, array(array()), $groups, array(array())); $rollen = array_keys($roles); # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); $template->define_dynamic("Submenu", "Menu"); $i = 0; $maxmenu = count($hauptmenu); foreach ($hauptmenu as $item) { $template->clear_parse("SUBMENU_LIST"); if ($item['zugriff'] === "alle" || vergleicheArrays($rollen, $item['zugriff'])) { $subempty = 0; $j = 0; $maxsub = count($submenu[$mnr]); foreach ($submenu[$mnr] as $item2) { if ($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { if ($i != $mnr) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } else { if ($j == 0) { if ($sbmnr == 0) { if ($maxsub == 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { if ($maxsub == 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($sbmnr == $j) { if ($maxsub == $j + 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if ($maxsub == $j + 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } # if ($lastaktive) {$zwisch="branch";} # else {$zwisch="branch";} $lastaktive = false; } } $htmlcode = "\n\t\t \t\t<tr height='4'>\n\t\t\t\t\t\t<td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td>\n\t\t \t\t</tr>\n\t\t \t\t<tr>\n\t\t\t\t\t\t<td width='10%'> </td>\n\t\t\t\t\t\t<td width='15%' align='right'><img src='../pics/" . $zwisch . ".gif'></td>\r\n\t\t \t\t\t<td width='65%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:5;padding-left:30px;background-color:{FARBE_S}'> \n\t\t \t\t\t<a href='" . $item2['link'] . "' style='text-decoration:none'><b class='standard_schrift'>" . $item2['text'] . "</b></a></td>\n\t\t\t\t\t\t<td width='10%'> </td> \t\t\t\t\t\t\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; $template->assign(array("SUB" => $htmlcode)); $template->assign(array("FARBE_S" => $farb)); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } } else { $subempty++; } $j = $j + 1; } if ($subempty == count($submenu[$mnr])) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } if ($i == 0) { if ($mnr == 0) { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($mnr == $i) { if (count($submenu[$mnr][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if (count($submenu[$i][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } } else { $zwisch = ""; } #if ($lastaktive) {$zwisch="";} #else {$zwisch="";} $lastaktive = false; } } $template->assign(array("ICON" => $zwisch, "FARBE" => $farb, "LINK_M" => $item["link"], "TEXT_M" => $item["text"])); $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); $template->clear_dynamic("Hauptmenu"); } $i = $i + 1; } if ($lastaktive) { $template->assign(array("ENDE" => "")); } else { $template->assign(array("ENDE" => "")); } }
function createDhcpMenu($rollen, $mnr, $auDN, $sbmnr) { global $template, $START_PATH, $rootAU; $i = 0; $mipbs = get_maxipblocks_au($auDN); #echo "MIPB: "; print_r ($mipbs); echo "<br>"; if ($mipbs[0] != "") { $hauptmenu = array(); } else { $hauptmenu = array(array("link" => "no_dhcp.php?mnr=" . $i, "text" => "Übersicht", "zugriff" => "alle")); $i++; } $pools = get_dhcppools($auDN, array("dn")); if (count($pools) == 0) { $poollink = "dhcpnopool.php"; } else { $poollink = "dhcppools.php"; } if ($auDN == $rootAU) { $dhcpservice_array = get_dhcpservices($auDN, array("dn", "cn")); if (count($dhcpservice_array) == 0) { $dhcpsvlink = "new_dhcpservice.php?mnr=1"; } else { $dhcpsvlink = "dhcpservice.php?mnr=1"; } $hauptmenu[] = array("link" => $dhcpsvlink, "text" => "DHCP Service", "zugriff" => array("MainAdmin", "DhcpAdmin")); $i++; } #if ($mipbs[0] != ""){ #if ( check_if_max_networks() ){ $hauptmenu[] = array("link" => "dhcpsubnets.php?mnr=" . $i, "text" => "DHCP Subnets", "zugriff" => array("MainAdmin", "DhcpAdmin")); if ($mipbs[0] != "") { $subnets = array(); # falls komplette Netze verfügbar, link zum Neuanlegen if (check_if_free_networks()) { #$dhcpsubnet_array = get_dhcpsubnets($auDN,array("dn","cn")); /*for ($j=0;$j<count($dhcpsubnet_array);$j++){ $subnets[] = array("link" => "dhcpsubnet.php?dn=".$dhcpsubnet_array[$j]['dn']."&mnr=".$i."&sbmnr=".$j, "text" => $dhcpsubnet_array[$j]['cn'], "zugriff" => array("MainAdmin","DhcpAdmin")); }*/ $subnets[] = array("link" => "new_dhcpsubnet.php?mnr=" . $i . "&sbmnr=0", "text" => "Neues DHCP Subnet", "zugriff" => array("MainAdmin", "DhcpAdmin")); } $i++; $hauptmenu[] = array("link" => $poollink . "?mnr=" . $i, "text" => "Dynamische DHCP Pools", "zugriff" => array("MainAdmin", "DhcpAdmin")); $submenu = array($subnets, array()); #}else{ # $hauptmenu [] = array("link" => $poollink."?mnr=".$i, # "text" => "Dynamische DHCP Pools", # "zugriff" => array("MainAdmin","DhcpAdmin")); #} } # DHCP Classes if ($auDN == $rootAU) { $hauptmenu[] = array("link" => "dhcp_classes.php?mnr=" . ++$i, "text" => "DHCP Classes", "zugriff" => array("MainAdmin", "DhcpAdmin")); $hauptmenu[] = array("link" => "dhcp_condstmts.php?mnr=" . ++$i, "text" => "DHCP Conditional Statements", "zugriff" => array("MainAdmin", "DhcpAdmin")); } # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); $template->define_dynamic("Submenu", "Menu"); $i = 0; $maxmenu = count($hauptmenu); foreach ($hauptmenu as $item) { $template->clear_parse("SUBMENU_LIST"); if ($item['zugriff'] === "alle" || vergleicheArrays($rollen, $item['zugriff'])) { $subempty = 0; $j = 0; $maxsub = count($submenu[$mnr]); if ($maxsub > 0) { foreach ($submenu[$mnr] as $item2) { if ($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { if ($i != $mnr) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } else { if ($j == 0) { if ($sbmnr == 0) { if ($maxsub == 1) { $zwisch = ""; } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if ($maxsub == 1) { $zwisch = ""; } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($sbmnr == $j) { if ($maxsub == $j + 1) { $zwisch = ""; } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if ($maxsub == $j + 1) { $zwisch = ""; } else { $zwisch = ""; } # if ($lastaktive) {$zwisch="branch";} # else {$zwisch="branch";} $lastaktive = false; } } $htmlcode = "\n \t\t \t\t<tr height='2'>\n \t\t\t\t\t\t<td></td><td></td><td></td><td></td>\n \t\t \t\t</tr>\n \t\t \t\t<tr>\n \t\t\t\t\t\t<td width='8%'> </td>\n \t\t\t\t\t\t<td width='8%' align='right'>" . $zwisch . "</td>\n \t\t \t\t\t<td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:15px;background-color:{FARBE_S}'> \n \t\t \t\t\t<a href='" . $item2['link'] . "' style='text-decoration:none'><code class='submenue_schrift'>" . $item2['text'] . "</code></a></td>\n \t\t\t\t\t\t<td width='10%'> </td> \t\t\t\t\t\t\n \t\t\t\t\t</tr>\n \t\t\t\t\t"; $template->assign(array("SUB" => $htmlcode)); $template->assign(array("FARBE_S" => $farb)); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } } else { $subempty++; } $j = $j + 1; } } if ($subempty == count($submenu[$mnr])) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } # weiter im Hauptmenü if ($i == 0) { if ($mnr == 0) { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($mnr == $i) { if (count($submenu[$mnr][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if (count($submenu[$i][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus3.gif'></a>"; } } else { $zwisch = ""; } #if ($lastaktive) {$zwisch="";} #else {$zwisch="";} $lastaktive = false; } } $template->assign(array("ICON" => $zwisch, "FARBE" => $farb, "LINK_M" => $item["link"], "TEXT_M" => $item["text"])); $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); $template->clear_dynamic("Hauptmenu"); } $i = $i + 1; } if ($lastaktive) { $template->assign(array("ENDE" => "")); } else { $template->assign(array("ENDE" => "")); } }
/** * personOptionen($rechte) * * Enth�lt die m�glichen Optionen, die auf einen User angewandt werden k�nnen als * zweidimensionales Array mit folgenden Attributen: * [ziel]: Aufzurufendes PHP-Skript * [text]: Beschriftung der Schaltfl�che * [desc]: Beschreibung der Funktion * [rechte][]: Array mit den erforderlichen Rechten f�r die jeweilige Option. array("alle") steht f�r "ohne Einschr�nkung". * * Dieses in dieser Funktion gespeicherte Array wird abh�ngig von den �bergebenen * Rechten um nicht erlaubte Optionen reduziert und dann ausgegeben. * * @param array $rechte Eindimensionales Array $_SESSION['rechte'] * * @return array Zweidimensionales Array mit den erlaubten Optionen. * * @author Timothy Burk */ function personOptionen($rechte) { global $utc_uid, $utc_cn, $START_PATH; $optionen = array(); $optionen[] = array("ziel" => $START_PATH . "person/datensatz.php?aktion=edit", "text" => "Userdaten bearbeiten", "desc" => "Anzeigen und �ndern der pers�nlichen Daten des Users.", "rechte" => array("writeMitarbeiter"), "hidden" => array("aktion" => "edit")); $optionen[] = array("ziel" => $START_PATH . "person/datensatz.php", "text" => "Datensatz l�schen", "desc" => "Der User wird vollst�ndig mit allen Daten aus der Datenbank gel�scht.", "rechte" => array("writeMitarbeiter"), "hidden" => array("aktion" => "delete")); $optionen[] = array("ziel" => $START_PATH . "person/datensatz.php", "text" => "User (de)aktivieren", "desc" => "Diese Funktion legt einen User durch die Deaktivierung im Archiv ab. Von dort kann der Datensatz weiterhin eingesehen und ggf. reaktiviert werden.", "rechte" => array("writeMitarbeiter"), "hidden" => array("aktion" => "archiv")); $optionen[] = array("ziel" => $START_PATH . "person/vertrag_show.php", "text" => "Vertr�ge bearbeiten", "desc" => "Bearbeiten oder Anlegen eines Vertrages. Sie k�nnen dabei zwischen verschiedenen Vertragsarten w�hlen.", "rechte" => array("writeVertrag", "readVertrag")); $optionen[] = array("ziel" => $START_PATH . "urlaub/krank_angabe.php", "text" => "Krankheitstage", "desc" => "Krankheitsdaten bearbeiten.", "rechte" => array("writeKrankheitUrlaub"), "hidden" => array("uidToChange" => $utc_uid, "GName" => $utc_cn)); $optionen[] = array("ziel" => $START_PATH . "urlaub/liste.php", "text" => "Urlaubstage anzeigen", "desc" => "Urlaubstage des Users in grafischer �bersicht anzeigen.", "rechte" => array("readKrankheitUrlaub"), "hidden" => array("wer" => $utc_uid, "wann" => "g", "sub" => $utc_cn)); $optionen[] = array("ziel" => $START_PATH . "person/rechte_show.php", "text" => "Rechte vergeben", "desc" => "Diese Option dient dazu, dem User bestimmte Rechte zuzuweisen, beispielsweise das Recht Urlaub zu beantragen, Vertragsdaten andere User zu bearbeiten oder einzusehen usw..", "rechte" => array("writeRechte")); $optionen[] = array("ziel" => $START_PATH . "person/suchen.php", "text" => "Abbrechen", "desc" => " ", "rechte" => array("alle")); $opt_reduced = array(); foreach ($optionen as $option) { if (in_array("alle", $option['rechte']) || vergleicheArrays($option['rechte'], $rechte)) { array_push($opt_reduced, $option); } } return $opt_reduced; }
function createRBSMenu($rollen, $mnr, $auDN, $sbmnr) { global $template; global $START_PATH; # rbservices (momentan nur für einen RBS konzipiert) $rbs_array = get_rbservices($auDN, array("dn", "cn")); # Struktur der Registerkartenleiste $hauptmenu = array(array("link" => "rbs.php?mnr=0", "text" => "Übersicht", "zugriff" => "alle")); $submenu = array(array()); $n = 1; if (count($rbs_array) != 0) { for ($i = 0; $i < count($rbs_array); $i++) { $hauptmenu[] = array("link" => "rbservice.php?rbsdn=" . $rbs_array[$i]['dn'] . "&mnr=" . $n, "text" => $rbs_array[$i]['cn'], "zugriff" => array("MainAdmin", "RbsAdmin")); $submenu[] = array(array("link" => "gbm_overview.php?rbsdn=" . $rbs_array[$i]['dn'] . "&mnr=" . $n . "&sbmnr=0", "text" => "Generische Bootmenüs", "zugriff" => array("MainAdmin", "RbsAdmin")), array("link" => "pxeconfig_default.php?rbsdn=" . $rbs_array[$i]['dn'] . "&mnr=" . $n . "&sbmnr=1", "text" => "Default PXE Configs", "zugriff" => array("MainAdmin", "RbsAdmin")), array("link" => "new_gbm.php?rbsdn=" . $rbs_array[$i]['dn'] . "&mnr=" . $n . "&sbmnr=2", "text" => "Neues GBM anlegen", "zugriff" => array("MainAdmin", "RbsAdmin")), array("link" => "new_pxe.php?rbsdn=" . $rbs_array[$i]['dn'] . "&mnr=" . $n . "&sbmnr=3", "text" => "Neue PXE Config anlegen", "zugriff" => array("MainAdmin", "RbsAdmin"))); $n++; } } $hauptmenu[] = array("link" => "new_rbservice.php?&mnr=" . $n, "text" => "Neuen RBS anlegen", "zugriff" => array("MainAdmin", "RbsAdmin")); $submenu[] = array(); #print_r($hauptmenu); echo "<br><br>"; #print_r($submenu); # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); $template->define_dynamic("Submenu", "Menu"); $i = 0; $maxmenu = count($hauptmenu); foreach ($hauptmenu as $item) { $template->clear_parse("SUBMENU_LIST"); if ($item['zugriff'] === "alle" || vergleicheArrays($rollen, $item['zugriff'])) { $subempty = 0; $j = 0; $maxsub = count($submenu[$mnr]); if ($maxsub > 0) { foreach ($submenu[$mnr] as $item2) { if ($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { if ($i != $mnr) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } else { if ($j == 0) { if ($sbmnr == 0) { if ($maxsub == 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { if ($maxsub == 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($sbmnr == $j) { if ($maxsub == $j + 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if ($maxsub == $j + 1) { $zwisch = "branchbottom2"; } else { $zwisch = "branch2"; } # if ($lastaktive) {$zwisch="branch";} # else {$zwisch="branch";} $lastaktive = false; } } $htmlcode = "\n\t\t \t\t<tr height='4'>\n\t\t\t\t\t\t<td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td>\n\t\t \t\t</tr>\n\t\t \t\t<tr>\n\t\t\t\t\t\t<td width='8%'> </td>\n\t\t\t\t\t\t<td width='8%' align='right'><img src='../pics/" . $zwisch . ".gif'></td>\r\n\t\t \t\t\t<td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:30px;background-color:{FARBE_S}'> \n\t\t \t\t\t<a href='" . $item2['link'] . "' style='text-decoration:none'><code class='submenue_schrift'>" . $item2['text'] . "</code></a></td>\n\t\t\t\t\t\t<td width='10%'> </td> \t\t\t\t\t\t\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; $template->assign(array("SUB" => $htmlcode)); $template->assign(array("FARBE_S" => $farb)); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } } else { $subempty++; } $j = $j + 1; } } if ($subempty == count($submenu[$mnr])) { $template->assign(array("SUB" => "")); # "LINK_S" => "", # "TEXT_S" => "")); $template->parse("SUBMENU_LIST", ".Submenu"); $template->clear_dynamic("Submenu"); } if ($i == 0) { if ($mnr == 0) { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { if (count($submenu[$i][0]) != 0) { if ($maxmenu == 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } } else { $zwisch = ""; } $farb = "#A0A0A0"; $lastaktive = false; } } else { if ($mnr == $i) { if (count($submenu[$mnr][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = ""; } else { $zwisch = ""; } } else { $zwisch = ""; } $lastaktive = true; $farb = "#505050"; } else { $farb = "#A0A0A0"; if (count($submenu[$i][0]) != 0) { if ($maxmenu == $i + 1) { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } else { $zwisch = "<a href='{LINK_M}' style='border-style=none;text-decoration:none'>\n \t<img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; } } else { $zwisch = ""; } #if ($lastaktive) {$zwisch="";} #else {$zwisch="";} $lastaktive = false; } } $template->assign(array("ICON" => $zwisch, "FARBE" => $farb, "LINK_M" => $item["link"], "TEXT_M" => $item["text"])); $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); $template->clear_dynamic("Hauptmenu"); } $i = $i + 1; } if ($lastaktive) { $template->assign(array("ENDE" => "")); } else { $template->assign(array("ENDE" => "")); } }