Files
wachter/admin/inhalte/personen/in_edit.php

253 lines
9.0 KiB
PHP

<?php
if (!isset($_SESSION['ID'])) {
} else {
if ("Anlegen" == $_POST['action']) {
$sql = 'INSERT INTO inter (ID, TID, Datum) VALUES (NULL, "'.$_SESSION['TID'].'", now())';
$stmt = $db->prepare($sql);
if (!$stmt) {
die ('Datensatz konnte nicht angelegt werden: '.$db->error);
}
if (!$stmt->execute()) {
die ('Datensatz konnte nicht angelegt werden: '.$stmt->error);
}
$sql = 'SELECT last_insert_id() AS last';
$result = $db->query($sql);
$nt = $result->fetch_assoc();
$id = $nt['last'];
echo "<h1>neuen Interessenten anlegen</h1>\n";
} else {
echo "<h1>Interessenten bearbeiten</h1>\n";
$id = $_POST['ID'];
}
$sql1 = "SELECT * FROM inter WHERE ID = \"".$id."\" ";
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
$sql2 = "SELECT Anrede FROM Anreden ORDER BY Anrede ASC";
$result2 = $db->query($sql2);
$sql3 = "SELECT O_TYP FROM O_Typen ORDER BY O_TYP ASC";
$result3 = $db->query($sql3);
$sql4 = "SELECT V_TYP FROM V_Typen ORDER BY V_TYP ASC";
$result4 = $db->query($sql4);
$sql5 = "SELECT Lage FROM lagen ORDER BY Lage ASC";
$result5 = $db->query($sql5);
$sql6 = "SELECT ID, Vorname, Nachname FROM Team ORDER BY ID ASC";
$result6 = $db->query($sql6);
echo "<br />\n";
echo "<form action=\"index.php?section=Personen&t=in\" method=\"post\">\n";
if (in_array("Makler_Interessenten", $_SESSION['Rechte'])) {
echo " <label class=\"hinweis\">Teammitglied zuordnen</label>\n";
echo " <select name=\"TID\">\n";
while ($nt6 = $result6->fetch_assoc()) {
echo " <option value=\"".$nt6['ID']."\"";
if ($nt6['ID'] == $nt1['TID']) {
echo " selected=\"selected\"";
}
echo ">".$nt6['Nachname']." ".$nt6['Vorname']."</option>\n";
}
echo " </select>\n";
echo " <br />\n";
echo " &nbsp;<br />\n";
} else {
echo " <input type=\"hidden\" name=\"TID\" value=\"".$_SESSION['TID']."\" />\n";
}
echo "<fieldset>\n";
echo " <legend>Kontaktdaten:</legend>\n";
echo " <input type=\"hidden\" name=\"ID\" value=\"".$id."\" />\n";
echo " <label>Aktiv</label>\n";
echo " <input type=\"radio\" name=\"Aktiv\" value=\"1\" ";
if ("1" == $nt1['Aktiv']) {
echo "checked=\"checked\" ";
}
echo "/>ja\n";
echo " <input type=\"radio\" name=\"Aktiv\" value=\"0\" ";
if ("0" == $nt1['Aktiv']) {
echo "checked=\"checked\" ";
}
echo "/>nein\n";
echo " <br />\n";
echo " <label>Anrede</label>\n";
echo " <select name=\"Anrede\">\n";
while ($nt2 = $result2->fetch_assoc()) {
echo " <option value=\"".$nt2['Anrede']."\"";
if ($nt2['Anrede'] == $nt1['Anrede']) {
echo " selected=\"selected\"";
}
echo ">".$nt2['Anrede']."</option>\n";
}
echo " </select>\n";
echo " <br />\n";
echo " <label>Vorname</label>\n";
echo " <input type=\"text\" name=\"Vorname\" value=\"".$nt1['Vorname']."\" />\n";
echo " <br />\n";
echo " <label>Nachname</label>\n";
echo " <input type=\"text\" name=\"Nachname\" value=\"".$nt1['Nachname']."\" />\n";
echo " <br />\n";
echo " <label>Adresse</label>\n";
echo " <input type=\"text\" name=\"Adresse\" value=\"".$nt1['Adresse']."\" />\n";
echo " <br />\n";
echo " <label>PLZ</label>\n";
echo " <input type=\"text\" name=\"PLZ\" value=\"".$nt1['PLZ']."\" />\n";
echo " <br />\n";
echo " <label>Ort</label>\n";
echo " <input type=\"text\" name=\"Ort\" value=\"".$nt1['Ort']."\" />\n";
echo " <br />\n";
echo " <label>Telefon</label>\n";
echo " <input type=\"text\" name=\"Telefon\" value=\"".$nt1['Telefon']."\" />\n";
echo " <br />\n";
echo " <label>Fax</label>\n";
echo " <input type=\"text\" name=\"Fax\" value=\"".$nt1['Fax']."\" />\n";
echo " <br />\n";
echo " <label>Mobil</label>\n";
echo " <input type=\"text\" name=\"Mobil\" value=\"".$nt1['Mobil']."\" />\n";
echo " <br />\n";
echo " <label>Firma</label>\n";
echo " <input type=\"text\" name=\"Firma\" value=\"".$nt1['Firma']."\" />\n";
echo " <br />\n";
echo " <label>Email</label>\n";
echo " <input type=\"text\" name=\"Email\" value=\"".$nt1['Email']."\" />\n";
echo " <br />\n";
echo " <label>Email-Benachrichtigung</label>\n";
echo " <input type=\"radio\" name=\"EmailB\" value=\"1\" ";
if ("1" == $nt1['EmailB']) {
echo "checked=\"checked\" ";
}
echo "/>ja\n";
echo " <input type=\"radio\" name=\"EmailB\" value=\"0\" ";
if ("0" == $nt1['EmailB']) {
echo "checked=\"checked\" ";
}
echo "/>nein\n";
echo "</fieldset>\n";
echo " <br />\n";
echo " &nbsp;<br />\n";
echo "<fieldset>\n";
echo " <legend>Persönliche Daten:</legend>\n";
echo " <label>Alter</label>\n";
echo " <input type=\"text\" name=\"Age\" value=\"".$nt1['Age']."\" />\n";
echo " <br />\n";
echo " <label>Familienstand</label>\n";
echo " <input type=\"text\" name=\"Stand\" value=\"".$nt1['Stand']."\" />\n";
echo " <br />\n";
echo " <label>Kinder</label>\n";
echo " <input type=\"text\" name=\"Kinder\" value=\"".$nt1['Kinder']."\" />\n";
echo " <br />\n";
echo " <label>Alter der Kinder</label>\n";
echo " <input type=\"text\" name=\"AlterK\" value=\"".$nt1['AlterK']."\" />\n";
echo " <br />\n";
echo " <label>Beruf</label>\n";
echo " <input type=\"text\" name=\"Beruf\" value=\"".$nt1['Beruf']."\" />\n";
echo " <br />\n";
echo " <label>Arbeitgeber</label>\n";
echo " <input type=\"text\" name=\"Arbeitgeber\" value=\"".$nt1['Arbeitgeber']."\" />\n";
echo " <br />\n";
echo " <label>Staatsangehörigkeit</label>\n";
echo " <input type=\"text\" name=\"Staat\" value=\"".$nt1['Staat']."\" />\n";
echo " <br />\n";
echo " <label>Raucher</label>\n";
echo " <input type=\"radio\" name=\"Raucher\" value=\"1\" ";
if ("1" == $nt1['Raucher']) {
echo "checked=\"checked\" ";
}
echo "/>ja\n";
echo " <input type=\"radio\" name=\"Raucher\" value=\"0\" ";
if ("0" == $nt1['Raucher']) {
echo "checked=\"checked\" ";
}
echo "/>nein\n";
echo " <br />\n";
echo " <label>Haustiere</label>\n";
echo " <input type=\"radio\" name=\"Tiere\" value=\"1\" ";
if ("1" == $nt1['Tiere']) {
echo "checked=\"checked\" ";
}
echo "/>ja\n";
echo " <input type=\"radio\" name=\"Tiere\" value=\"0\" ";
if ("0" == $nt1['Tiere']) {
echo "checked=\"checked\" ";
}
echo "/>nein\n";
echo "</fieldset>\n";
echo " <br />\n";
echo " &nbsp;<br />\n";
echo "<fieldset>\n";
echo " <legend>Angaben zum gesuchten Objekt</legend>\n";
echo " <label>Objekttyp</label>\n";
echo " <select name=\"O_TYP\">\n";
while ($nt3 = $result3->fetch_assoc()) {
echo " <option value=\"".$nt3['O_TYP']."\"";
if ($nt1['O_TYP'] == $nt3['O_TYP']) {
echo " selected=\"selected\"";
}
echo ">".$nt3['O_TYP']."</option>\n";
}
echo " </select>\n";
echo " <br />\n";
echo " <label>Vermarktungsart</label>\n";
echo " <select name=\"V_TYP\">\n";
while ($nt4 = $result4->fetch_assoc()) {
echo " <option value=\"".$nt4['V_TYP']."\"";
if ($nt4['V_TYP'] == $nt1['V_TYP']) {
echo " selected=\"selected\"";
}
echo ">".$nt4['V_TYP']."</option>\n";
}
echo " </select>\n";
echo " <br />\n";
echo " <label>Ort</label>\n";
echo " <input type=\"text\" name=\"ORTneu\" />\n";
echo " <br />\n";
echo " <label>Lage</label>\n";
echo " <select name=\"Lage\">\n";
while ($nt5 = $result5->fetch_assoc()) {
echo " <option value=\"".$nt5['Lage']."\"";
if ($nt5['Lage'] == $nt1['Lage']) {
echo " selected=\"selected\"";
}
echo ">".$nt5['Lage']."</option>\n";
}
echo " </select>\n";
echo " <br />\n";
echo " <label>Bezug zum</label>\n";
echo " <input type=\"text\" name=\"Bezug\" value=\"".$nt1['Bezug']."\" />\n";
echo " <br />\n";
echo " <label>Zimmer</label>\n";
echo " <input type=\"text\" class=\"kurz\" name=\"ZIMMERvon\" value=\"".$nt1['ZIMMERvon']."\" />\n";
echo " - <input type=\"text\" class = \"kurz\" name=\"ZIMMERbis\" value=\"".$nt1['ZIMMERbis']."\" />\n";
echo " <br />\n";
echo " <label>Wohn-/ Nutzfläche</label>\n";
echo " <input type=\"text\" name=\"QM\" value=\"".$nt1['QM']."\" />\n";
echo " <br />\n";
echo " <label>Kaltmiete</label>\n";
echo " <input type=\"text\" name=\"Mkalt\" value=\"".$nt1['Mkalt']."\" />\n";
echo " <br />\n";
echo " <label>Warmmiete</label>\n";
echo " <input type=\"text\" name=\"Mwarm\" value=\"".$nt1['Mwarm']."\" />\n";
echo " <br />\n";
echo " <label>Kaufpreis</label>\n";
echo " <input type=\"text\" name=\"Kpreis\" value=\"".$nt1['Kpreis']."\" />\n";
echo "</fieldset>\n";
echo " <br />\n";
echo " &nbsp;<br />\n";
echo "<fieldset>\n";
echo " <legend>Sonstiges</legend>\n";
echo " <textarea name=\"Sonstiges\">".$nt1['Sonstiges']."</textarea>\n";
echo "</fieldset>\n";
echo " <br />\n";
echo " &nbsp;<br />\n";
echo "<fieldset>\n";
echo " <legend>Intern</legend>\n";
echo " <textarea name=\"Intern\">".$nt1['Intern']."</textarea>\n";
echo "</fieldset>\n";
echo " <br />\n";
echo " &nbsp;<br />\n";
echo " <input type=\"submit\" name=\"action\" value=\"Speichern\" />\n";
if ("Anlegen" == $_POST['action']) {
echo " <input type=\"submit\" name=\"action\" value=\"Abbrechen\" />\n";
} else {
echo " <input type=\"reset\" value=\"Rücksetzen\" />\n";
}
echo "</form>\n";
}
?>