<?php
include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php

$db = dbconnect();
$ansp = $db->query("SELECT wert1, wert2 FROM parameter WHERE pid='2'");
$uhd = $ansp->fetch_array();
$ansprechpart = "$uhd[wert1]"; // Ansprechpartner bei Probleme
$helpmail = "$uhd[wert2]";     // Kontaktmailadresse bei Problemen

if ($_COOKIE["uid1"] == ""){ include("kurs/anmeldefehler_subdir.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen
$uid1=$_COOKIE["uid1"];
if ($uid1 == ""){ include("kurs/anmeldefehler_subdir.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen
/*
&Uuml;bersicht2 Studenten: Alle Fachprojekte werden mit aktueller Belegung entsprechend ihres Studienzweiges werden angezeigt
*/

$db = dbconnect();
include("kurs/fach/fach_useronline_write.php");     // F&uuml;r Statistik, wieviele User online sind

$stg_leer = $db->query("SELECT stg, stgtext FROM stud where uid=\"$uid1\"");
$row_stg = $stg_leer->fetch_array(); // Feststellen, wenn Feld leer muss ein Studiengang gew&auml;hlt werden

if ($row_stg[stg] == "") {
echo "

<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Fehlende Informationen</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Fehlende Informationen</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
					<p align=\"center\"><b>In Ihrem Profil ist kein Studienzweig eingetragen.<br>Bitte wenden Sie sich an <a href=\"mailto:$helpmail?subject=Kein Studienzweig bei $uid1\">
      				$ansprechpart</a></b></b>
                    </p>
                    <p align=\"center\"><a href=\"../hauptframe.php\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
exit;
}

$res = $db->query("SELECT Jahrgang FROM stud where uid=\"$uid1\"");
$stud_jahr = $res->fetch_array();

echo "

<html>

<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>&Uuml;bersicht &uuml;ber die Fachprojekte des Studienjahrgangs $stud_jahr[Jahrgang]</title>
</head>

<body>

<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <font class=\"hd\">&Uuml;bersicht &uuml;ber die Fachprojekte des Studienjahrgangs $stud_jahr[Jahrgang]</font><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td>

                    <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\" id=\"AutoNumber1\">
                    <tr>
                    <td width=\"5%\">
                    <p align=\"center\"><b>Nr.</b></p>
                    </td>
                    <td width=\"70%\">
                    <b>Bezeichnung</b>
                    </td>
                    <td width=\"13%\">
                    <p align=\"center\"><b>Tats&auml;chliche<br>Teilnehmerzahl</b>
                    </td>
                    <td width=\"12%\">
                    <p align=\"center\"><b>Max. Teil-<br />
                    nehmer</b></p>
                    </td>
                    </tr>";
                    $db = dbconnect();
                    $query = "SELECT id, FPRNr, Bezeichnung, TN_max, Ansprechpart, bemerkung FROM fachprojekt where Jahr=\"$stud_jahr[Jahrgang]\" and zweig LIKE \"%$row_stg[stg]%\" order by FPRNr asc";
                    $result = $db->query($query)
                           or die ("Cannot execute query");
                   while ($row = $result->fetch_array()){

                    if ( $res=$db->query("SELECT COUNT(*) FROM fach_wunsch where id=$row[id] and Prioritaet =\"0\"") ){
                    if ( $row1=$res->fetch_array() ) {
                    $result1=$row1[0];
                    } else $result1=0;
                    } else $result1=0;

                    echo "
                        <tr>
                      <td width=\"5%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
                      <p align=\"center\">
                      $row[FPRNr]</p>
                      </td>
                      <td width=\"70%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
                      $row[Bezeichnung]<br>";
                      if($row[Ansprechpart] != "")
                      {
                        echo "Ansprechpartner: $row[Ansprechpart]<br>";
                      }
                      echo"
                      <span class=\"bemerkung\">$row[bemerkung]</span>
                      </td>
                      <td valign=\"middle\" width=\"13%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
                      <p align=\"center\">$result1
                      </td>
                      <td width=\"12%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
                      <p align=\"center\" style=\"margin-top: 4; margin-bottom: 4\">
                      $row[TN_max]</p>
                      </td>
                    </tr>";
                    }
                  echo "
                     </table>
                     </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>

</body>

</html>";
?>