<?php
include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
$user_admin=$_COOKIE["user_admin"];

$db = dbconnect();


$result0 = $db->query("SELECT DISTINCT 1
                         FROM pros_admin_rechte_zuord, pros_admin, pros_admin_rechte
                        WHERE pros_admin_rechte_zuord.faid = pros_admin.faid
                          AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                          AND pros_admin.user='$user_admin'
                          AND bereich='j'
                     ");
                        

$row0 = $result0->fetch_array();

$result1 = $db->query("SELECT DISTINCT 1
                         FROM pros_admin_rechte_zuord, pros_admin, pros_admin_rechte
                        WHERE pros_admin_rechte_zuord.faid = pros_admin.faid
                          AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                          AND pros_admin.user='$user_admin'
                          AND bereich='a'
                     ");
                        

$row1 = $result1->fetch_array();


$result2 = $db->query("SELECT DISTINCT 1
                         FROM pros_admin_rechte_zuord, pros_admin, pros_admin_rechte
                        WHERE pros_admin_rechte_zuord.faid = pros_admin.faid
                          AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                          AND pros_admin.user='$user_admin'
                          AND bereich='s'
                     ");
                        

$row2 = $result2->fetch_array();

echo"
<html>

<head>
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<title>Menu</title>
<base target=\"Hauptframe\">
<style type=\"text/css\">

body { font-family:Verdana;font-size:11px;color:#000000; }

a:link { font-family:verdana, arial;font-weight:normal;color:#000066; text-decoration:none;}
a:active { font-family:verdana, arial;font-weight:normal;color:#000066; text-decoration:none;}
a:visited { font-family:verdana, arial;font-weight:normal;color:#000066; text-decoration:none;}
a:hover { font-family:verdana, arial;font-weight:normal;color:#000066;text-decoration:underline; }

a:link.sub { font-family:Verdana;font-size:10px;color:#000000;text-decoration:none; }
a:active.sub { font-family:Verdana;font-size:10px;color:#000000;text-decoration:none; }
a:visited.sub { font-family:Verdana;font-size:10px;color:#000000;text-decoration:none; }
a:hover.sub { font-family:Verdana;font-size:10px;color:#000000;text-decoration:underline; }

</style>

<script type=\"text/javascript\">
<!--

function show(divid) {";
                    if ($row0[0] == '1')
                       {
                         echo "document.getElementById(\"cat1\").style.display=\"none\";";
                       }
                       
                    if ($row1[0] == 1)
                       {
                         echo "document.getElementById(\"cat2\").style.display=\"none\";";
                       }

                    if ($row2[0] == 1)                       {
                         echo "document.getElementById(\"cat3\").style.display=\"none\";";
                       }
echo"

document.getElementById(divid).style.display=\"inline\";

}
//-->
</script>
</head>

<body class=\"farbe\" leftmargin=\"2\">

<table border=\"0\" style=\"border-collapse: collapse\" align=\"center\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr height=\"15\">
        <td>
        <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"15\" border=\"0\" id=\"table2\">
            <tr>
                <td valign=\"top\" align=\"left\" width=\"26\" height=\"30\">
                <img src=\"../images/sidebox-title-left.gif\"></td>
                <td valign=\"center\" align=\"left\" width=\"143\" background=\"../images/sidebox-title-bg.gif\" height=\"30\">
                <font class=\"option\" color=\"#ffffff\">&nbsp; <b>Menu</b></font></td>
                <td valign=\"top\" align=\"left\" width=\"6\" height=\"30\">
                <img src=\"../images/sidebox-title-right.gif\"></td>
            </tr>
        </table>
        </td>
    </tr>
    <tr>
        <td>
        <table cellspacing=\"0\" cellpadding=\"0\" width=\"175\" height=\"100%\" border=\"0\" id=\"table3\">
            <tr valign=\"top\">
                <td valign=\"bottom\" align=\"left\" width=\"4\" background=\"../images/sidebox-bar-left.gif\">&nbsp;
                <p><font face=\"Verdana\" style=\"font-size: 8pt\">
                <img src=\"../images/sidebox-bar-px.gif\"></font></p>
                </td>
                <td valign=\"top\" align=\"left\" width=\"166\" bgcolor=\"#d6dff7\">
                <table cellspacing=\"0\" cellpadding=\"0\" width=\"164\" border=\"0\" height=\"100%\" id=\"table4\">
                    <tr>
                        <td valign=\"top\"><font face=\"Verdana\"><span style=\"font-size: 8pt\">
                        <a target=\"kurshaupt\" href=\"jahrgang.php\">Jahrgang</a></font><br>";
                                               
                        $query = "SELECT Beschreibung, dateiname, target
                                    FROM pros_admin_rechte, pros_admin_rechte_zuord, pros_admin
                                   WHERE pros_admin.faid = pros_admin_rechte_zuord.faid
                                     AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                                     AND bereich = 'o'
                                     AND pros_admin.user = '$user_admin'
                                   ORDER BY sort_order ASC
                                 ";
                                     
			$result = $db->query($query)
				   or die ("Cannot execute query");
			while ($row = $result->fetch_array()){
			  echo"
			  <strong>·</strong>
			  <a target='$row[target]' href=\"$row[dateiname]\">$row[Beschreibung]</a><br>";
                        }




                        $query = "SELECT Beschreibung, dateiname, target
                                    FROM pros_admin_rechte, pros_admin_rechte_zuord, pros_admin
                                   WHERE pros_admin.faid = pros_admin_rechte_zuord.faid
                                     AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                                     AND bereich = 'j'
                                     AND pros_admin.user = '$user_admin'
                                   ORDER BY sort_order ASC
                                 ";
                                     
			$result = $db->query($query)
				   or die ("Cannot execute query");
			while ($row = $result->fetch_array()){
                          if ($ln_zaehler1 < 1){
                            echo"<b><a href=\"#\" onclick=\"show('cat1')\" target=\"Inhalt\"><b>Jahrgangsabh&auml;ngig &#187;</b></a><br></b>
                            <div id=\"cat1\" style=\"display:none\">";
                            $ln_zaehler1 = 1;
                          }
                          
			  echo"
			  <strong>·</strong>
			  <a target='$row[target]' href=\"$row[dateiname]\" class=\"sub\">$row[Beschreibung]</a><br>";
                        }
                        
                        echo"</div>";



                        $query = "SELECT Beschreibung, dateiname, target
                                    FROM pros_admin_rechte, pros_admin_rechte_zuord, pros_admin
                                   WHERE pros_admin.faid = pros_admin_rechte_zuord.faid
                                     AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                                     AND bereich = 'a'
                                     AND pros_admin.user = '$user_admin'
                                   ORDER BY sort_order ASC
                                 ";
                                     
			$result = $db->query($query)
				   or die ("Cannot execute query");
			while ($row = $result->fetch_array()){
                          if ($ln_zaehler2 < 1){
                            echo"<a href=\"#\" onclick=\"show('cat2')\" target=\"Inhalt\"><b>Administration &#187;</b></a><br>
                            <div id=\"cat2\" style=\"display:none\">";
                            $ln_zaehler2 = 1;
                          }
                          
			  echo"
			  <strong>·</strong>
			  <a target='$row[target]' href=\"$row[dateiname]\" class=\"sub\">$row[Beschreibung]</a><br>";
                        }
                        
                        echo"</div>";


                        $query = "SELECT Beschreibung, dateiname, target
                                    FROM pros_admin_rechte, pros_admin_rechte_zuord, pros_admin
                                   WHERE pros_admin.faid = pros_admin_rechte_zuord.faid
                                     AND pros_admin_rechte.pros_admin_rolle = pros_admin_rechte_zuord.pros_admin_rolle
                                     AND bereich = 's'
                                     AND pros_admin.user = '$user_admin'
                                   ORDER BY sort_order ASC
                                 ";
                                     
			$result = $db->query($query)
				   or die ("Cannot execute query");
			while ($row = $result->fetch_array()){
                          if ($ln_zaehler3 < 1){
                            echo"<a href=\"#\" onclick=\"show('cat3')\" target=\"Inhalt\"><b>Statistik &#187;</b></a><br>
                            <div id=\"cat3\" style=\"display:none\">";                            $ln_zaehler2 = 1;
                            $ln_zaehler3 = 1;
                          }
                          
			  echo"
			  <strong>·</strong>
			  <a target='$row[target]' href=\"$row[dateiname]\" class=\"sub\">$row[Beschreibung]</a><br>";
                        }
                        
                        echo"</div>";
 
                        echo"
                        <a target=\"_top\" href=\"logout_admin.php\">Logout</a><br>


                        </td>
                    </tr>
                </table>
                </td>
                </td>
                <td valign=\"top\" align=\"left\" width=\"4\" background=\"../images/sidebox-bar-right.gif\">
                <img src=\"../images/sidebox-bar-px.gif\">
            </tr>
        </table>
        </td>
    </tr>
    <tr>
        <td height=\"15\">
        <table cellspacing=\"0\" cellpadding=\"0\" width=\"175\" height=\"15\" border=\"0\" id=\"table5\">
            <tr>
                <td valign=\"top\" align=\"left\" width=\"175\" height=\"29\">
                <img src=\"../images/sidebox-bottom.gif\"> </td>
            </tr>
        </table>
        </td>
    </tr>

</table>

</body>

</html>";
?>