<?php
	echo "<h1>Verwaltung - <span style=\"color: red;\">".str_replace ( '" OR O_TYP = "', ' / ' , $O_TYP )." ".$V_TYP."</span></h1>\n";
?>
<!-- Das Formular, um die neue Immobilie anzulegen -->
<form action="index.php?section=objekte&t=<?php echo $_GET['t']; ?>" method="post">
    <fieldset>
        <legend>neues Objekt anlegen</legend>
        <input type="submit" name="formaction" value="Anlegen" />
    </fieldset>
</form>
<br />

<!-- Das Formular, um die bestehende Immobilie zu bearbeiten -->
<form action="index.php?section=objekte&t=<?php echo $_GET['t']; ?>" method="post">
	<fieldset>
		<legend>bestehendes Objekt ...</legend>
		<br />


<?php

	$sql="SELECT * FROM objekte ".$immo_abfrage." ORDER BY Aktiv DESC, ID DESC";
	$result = $db->query($sql);
    echo "        <select size=\"1\" name=\"ID\">\n";
        while($nt = $result->fetch_assoc()){
			if ( $nt['Aktiv'] )
				{
					$style = "style=\"color:green;\"";
				}
			else
				{
					$style = "style=\"color:red;\"";
				}
			echo "            <option " . $style . " value=\"$nt[ID]\">$nt[ID] $nt[Kurz]</option>\n";
        }
        echo "        </select>\n";
		echo "			&nbsp;<br /><br />\n";  
        echo "        <input type=\"submit\" name=\"formaction\" value=\"Anzeigen\" /><br />\n";
        echo "        <input type=\"submit\" name=\"formaction\" value=\"Bearbeiten\" /><br />\n";
		if ( $_SESSION['IsAdmin'] )
			{
				echo "        <input type=\"submit\" name=\"formaction\" value=\"Löschen\" /><br />\n";
				echo "        <input type=\"submit\" name=\"formaction\" value=\"De- / Aktivieren\" /><br />\n";
			}
?>
	</fieldset>
</form>
