Fragebogen/suche.php
2024-01-22 10:09:24 +01:00

395 lines
17 KiB
PHP
Executable File

<?PHP
include("aespa/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
if ($_COOKIE["uid1"] == ""){ include("kurs/anmeldefehler.php"); exit;} //Wenn man nicht angemeldet ist soll man nichts ausw&auml;hlen k&ouml;nnen
$uid1=$_COOKIE["uid1"];
if (isset($_GET['action']))
$action = $_GET['action'];
else
$action = "";
switch($action){
default:
echo "
<html>
<head>
<title>Suche zum Auslandspraktikum</title>
<style>
<!--
h2
{margin-bottom:.0001pt;
text-align:center;
page-break-after:avoid;
font-size:20.0pt;
font-family:Arial;
margin-left:0cm; margin-right:0cm; margin-top:0cm}
h1
{margin-bottom:.0001pt;
page-break-after:avoid;
font-size:12.0pt;
font-family:Arial;
margin-left:0cm; margin-right:0cm; margin-top:0cm}
select{
width:250px;
}
-->
</style>
<script type='text/javascript' src='ajax.js'></script>
<script type='text/javascript'>
/************************************************************************************************************
Ajax chained select
Copyright (C) 2006 DTHMLGoodies.com, Alf Magne Kalleland
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.
Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com
************************************************************************************************************/
var ajax = new sack();
function getCityList(sel)
{
var countryCode = sel.options[sel.selectedIndex].value;
document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box
if(countryCode.length>0){
ajax.requestFile = 'getSubCat_search.php?countryCode='+countryCode; // Specifying which file to get
ajax.onCompletion = createCities; // Specify function that will be executed after file has been found
ajax.runAJAX(); // Execute AJAX function
}
}
function createCities()
{
var obj = document.getElementById('dhtmlgoodies_city');
eval(ajax.response); // Executing the response from Ajax as Javascript code
}
</script>
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
</head>
<body onload=\"if(document.auswert)document.auswert.dhtmlgoodies_country.focus();if(document.auswert)document.auswert.uberschrift.focus();return false;\">
<h2>Suche zum Auslandspraktikum</h2>
<p align='center'>
<img border='0' src='images/aespa_logo.jpg' width='493' height='132' align='center'></p>
<p align='center'>&nbsp;</p>
<form action=";echo $_SERVER['PHP_SELF'] . "?action=auswertung";echo" method=\"POST\" name=\"auswert\">
<div align='center'>
<table border='0' width='40%' id='table2' style='border-collapse: collapse' bgcolor='#EAEAEA'>
<tr>
<td colspan='2' style='border-left-style: solid; border-left-width: 2px; border-right-style: solid; border-right-width: 2px; border-top-style: solid; border-top-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
&nbsp;
</td>
</tr>
<tr>
<td width='30%' style='border-left-style: solid; border-left-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
Kontinent </td>
<td width='70%' style='border-right-style: solid; border-right-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>";
$db = dbconnect();
$query2 = "SELECT distinct a.kid, a.kontinent
FROM aesp_kontinent a, aesp_bewerbung b
WHERE a.kid = b.kontinent
ORDER BY kontinent ASC";
$result2 = $db->query ($query2)
or die ("Cannot execute query");
echo "<select id='dhtmlgoodies_country' name='dhtmlgoodies_country' onchange='getCityList(this)' onfocus='getCityList(this)'>
<option value=''>Select</option>";
echo "<option value='%'";if($row3['kontinent'] == '%'){echo " selected";} echo">Alle&nbsp;&nbsp;&nbsp;</option>\n";
while ($row2 = $result2->fetch_array()){
echo "<option value='$row2[kid]'";if($row2['kid'] == $row3['kontinent']){echo " selected";} echo">".$row2['kontinent']."&nbsp;&nbsp;&nbsp;</option>\n";
}
echo"
</td>
</tr>
<tr>
<td width='30%' style='border-left-style: solid; border-left-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
Land </td>
<td width='70%' style='border-right-style: solid; border-right-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
<select id='dhtmlgoodies_city' name='dhtmlgoodies_city'>
</p>
</td>
</tr>
<tr>
<td width='30%' style='border-left-style: solid; border-left-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
ab Jahrgang
</td>
<td width='70%' style='border-right-style: solid; border-right-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>";
$query2 = "SELECT distinct DATE_Format(zeitraum_von, '%Y') jahrgang
FROM aesp_allgemein
WHERE DATE_Format(zeitraum_von, '%Y') != '0000'
ORDER BY jahrgang DESC
";
$result2 = $db->query ($query2)
or die ("Cannot execute query");
echo "<select size=\"1\" name=\"jahrgang\">";
# echo "<option value='%'";if($row3[kontinent] == '%'){echo " selected";} echo">Alle&nbsp;&nbsp;&nbsp;</option>\n";
while ($row2 = $result2->fetch_array()){
echo "<option value='$row2[jahrgang]'"; if($row3['jahrgang'] == $row2['jahrgang']){echo " selected"; } echo">$row2[jahrgang]</option>\n";
}
echo "</select>
</p>
</td>
</tr>
<tr>
<td colspan='2' style='border-left-style: solid; border-left-width: 2px; border-right-style: solid; border-right-width: 2px;>
<p style='margin-left: 3px; margin-right: 3px'>
&nbsp;
</td>
</tr>
<tr>
<td colspan=2 align='center' style='border-left-style: solid; border-left-width: 2px; border-right-style: solid; border-right-width: 2px''>
<input type=\"submit\" value=\"Suche\" name=\"B1\" size=\"20\"></form>
</td
</tr>
<tr>
<td width='30%' style='border-left-style: solid; border-left-width: 2px; border-bottom-style: solid; border-bottom-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>&nbsp;</td>
<td width='70%' style='border-bottom-style: solid; border-bottom-width: 2px; border-right-style:solid; border-right-width:2px'>
<p style='margin-left: 3px; margin-right: 3px'>
&nbsp;</td>
</tr>
</table>
<br>
<br>
<br>
<div align='center'> Es werden nur verfügbare Kontinente / Länder / Jahrgänge angezeigt!</div>
</body>
</html>";
break;
case "auswertung":
if(!isset($_POST['dhtmlgoodies_country'])){
$kontinent=$_GET['kontinent'];
}else{
$kontinent=$_POST['dhtmlgoodies_country'];
}
if(!isset($_POST['dhtmlgoodies_city'])){
$land=$_GET['land'];
}else{
$land=$_POST['dhtmlgoodies_city'];
}
if(!isset($_POST['jahrgang'])){
$jahrgang=$_GET['jahrgang'];
}else{
$jahrgang=$_POST['jahrgang'];
}
$sort = $_GET["sort"];
$option = $_GET["option"];
if($option == 'ASC'){
$option = 'DESC';
}else{
$option = 'ASC';
}
if(!isset($sort)){
$sort = "kontinent";
}
## Anzahl der Treffer ermitteln
$db = dbconnect();
$result_anz = $db->query("SELECT count(*) anz_treffer
FROM aesp_bewerbung a, aesp_allgemein b
WHERE a.uid = b.uid
AND a.kontinent LIKE '$kontinent'
AND a.land LIKE '$land'
AND DATE_Format(zeitraum_von, '%Y') >= '$jahrgang'");
$row_anz = $result_anz->fetch_array();
echo "
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Statistik</title>
<style><!--
.sl,.r{font-weight:normal;margin:0;display:inline}
.r{font-size:1em}
.g{margin-top:1em;margin-bottom:1em}
.a,.a:link{color:green}
body,td,div,.p,a{font-family:arial,sans-serif}
--></style>
</head>
<body>
<table align=\"center\" border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"95%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table valign=\"top\" 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\">Suchergebnisse</font><br>
<span class=\"sh\">Treffer: $row_anz[anz_treffer]</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>
<table valign=\"top\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width=\"100%\" id=\"AutoNumber1\">
<tr>
<td>";
if($sort == 'kontinent'){
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=kontinent&option=$option><b>Kontinent</b></a></font>";
}else{
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=kontinent&option=$option>Kontinent</a></font>";
}
echo "
</td>
<td>";
if($sort == 'land'){
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=land&option=$option><b>Land</b></a></font>";
}else{
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=land&option=$option>Land</a></font>";
}
echo "
</td>
<td>";
if($sort == 'stadt'){
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=stadt&option=$option><b>Stadt</b></a></font>";
}else{
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=stadt&option=$option>Stadt</a></font>";
}
echo "
</td>
<td>";
if($sort == 'zeitraum_von'){
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=zeitraum_von&option=$option><b>Zeitraum ab</b></a></font>";
}else{
echo "<font size=\"2\"><a href=$_SERVER[PHP_SELF]?action=auswertung&kontinent=$kontinent&land=$land&jahrgang=$jahrgang&sort=zeitraum_von&option=$option>Zeitraum ab</a></font>";
}
echo "
</td>
<td>
Link
</td>
</tr>
";
$db = dbconnect();
$query = "SELECT a.uid, a.kontinent, a.land, a.stadt, date_format(zeitraum_von, '%d.%m.%Y') datum, zeitraum_von
FROM aesp_bewerbung a, aesp_allgemein b
WHERE a.uid = b.uid
AND a.kontinent LIKE '$kontinent'
AND a.land LIKE '$land'
AND DATE_Format(zeitraum_von, '%Y') >= '$jahrgang'
ORDER BY $sort $option
";
$result = $db->query($query)
or die ("Cannot execute query");
while ($row = $result->fetch_array()){
$result_kont = $db->query("SELECT kontinent
FROM aesp_kontinent
WHERE kid='$row[kontinent]'");
$row_kont = $result_kont->fetch_array();
$result_land = $db->query("SELECT land
FROM aesp_land
WHERE lid='$row[land]'");
$row_land = $result_land->fetch_array();
echo "
<tr>
<td>
$row_kont[kontinent]
</td>
<td>
$row_land[land]
</td>
<td>
$row[stadt]
</td>
<td>
$row[datum]
</td>
<td>
<a href='ansicht.php?uid_user=$row[uid]'>Ansehen</a>
</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>
<p align=\"center\"><a href=\"javascript:history.back()\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a>
</td>
</tr>
</table>
</body>
</html>
";
}
?>