fhiiqm/form/anlage_form.inc.php
changeset 18 d0aa14180761
child 19 33ee23fafd4d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/form/anlage_form.inc.php	Mon Nov 21 16:24:43 2011 +0100
@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 11/2011
+ * 
+ * Form Anlage
+ */
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+    $okn = true;
+    if (!$al["geb"]) $al["geb"]="A";
+
+?>
+<div align="center">
+<table>
+<tr><td class="bigger">Die Auswahl eines Anlagenverantwortlichen geschieht durch<br />Eingeben von mindesten 2 Zeichen in das Verantwortlicher-Feld.
+</td></tr>
+<tr><td class="bigger"><div class="red">Achtung! </div>Umlaute wie '&auml;', '&uuml;', '&ouml;', '&szlig;' werden nicht gefunden, bitte benachbarte Zeichen eingeben.</td></tr>
+<tr><td class="bigger">&nbsp;</td></tr>
+</table>
+</div>
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="fanl"> 
+<div align="center">
+    <table border="0" cellspacing="3" cellpadding="3">
+<!--        <div class="ui-widget"> -->
+        <tr><td>Anlagenbezeichnung *</td>
+            <td valign="top"><input type="text" name="al[bez]" id="albez" size="30" maxlength="50" value="<?php echo $al['bez']; ?>"/>
+            <?php 
+			     if (isset($al['bez']) && $al['bez']<'!')
+				{
+					echo "<br><span class=\"red\">Anlagenbezeichnung ist erforderlich!</span>\n";
+					$okn = false;
+				}
+				else
+					if ($okn) $okn = true; else $okn=false;
+             ?> 
+            </td>
+        </tr>
+        <tr><td>Anlagenbeschreibung</td>
+            <td><textarea name="al[beschr]" cols="50" rows="5"><?php echo $al['beschr']; ?></textarea></td>
+        </tr>
+        <tr><td>Kategorie</td>
+            <td valign="top">
+                 <select name="al[kat]">
+                <?php 
+                    if ($al['kat'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT al_kat_bez, al_kat_ID FROM `fhiiqm`.`A_Kategorie` ORDER BY 1";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->al_kat_ID == $al['kat'])
+        					   echo "<option selected value=\"$row->al_kat_ID\">$row->al_kat_ID: $row->al_kat_bez</option>\n";
+        				    else
+        					   echo "<option value=\"$row->al_kat_ID\">$row->al_kat_ID: $row->al_kat_bez</option>\n";
+                        }
+                }
+                ?>
+                </select>            
+            </td>
+        </tr>
+        <tr><td>Bef&auml;higungsgrad</td>
+            <td valign="top">
+                 <select name="al[befg]">
+                <?php 
+                    if ($al['befg'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT al_befgrad_bez, al_befgrad_ID FROM `fhiiqm`.`A_BefGrad` ORDER BY 1";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->al_befgrad_ID == $al['befg'])
+        					   echo "<option selected value=\"$row->al_befgrad_ID\">$row->al_befgrad_ID: $row->al_befgrad_bez</option>\n";
+        				    else
+        					   echo "<option value=\"$row->al_befgrad_ID\">$row->al_befgrad_ID: $row->al_befgrad_bez</option>\n";
+                        }
+                }
+                ?>
+                </select>            
+            </td>
+        </tr>
+        <tr><td>Pr&uuml;fart</td>
+            <td valign="top">
+                 <select name="al[part]">
+                <?php 
+                    if ($al['part'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT al_pruefart_bez, al_pruefart_ID FROM `fhiiqm`.`A_PruefArt` ORDER BY 1";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->al_pruefart_ID == $al['part'])
+        					   echo "<option selected value=\"$row->al_pruefart_ID\">$row->al_pruefart_ID: $row->al_pruefart_bez</option>\n";
+        				    else
+        					   echo "<option value=\"$row->al_pruefart_ID\">$row->al_pruefart_ID: $row->al_pruefart_bez</option>\n";
+                        }
+                }
+                ?>
+                </select>            
+            </td>
+        </tr>
+        <tr><td>Standort</td>
+            <td valign="top">Haus&nbsp;
+                 <select name="al[geb]" onchange="this.form.submit();">
+                <?php 
+                    $sql = "SELECT geb_ID, geb_name FROM `fhiiqm`.`Haus` ORDER BY 1";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->geb_ID == $al['geb'])
+        					   echo "<option selected value=\"$row->geb_ID\">$row->geb_ID: $row->geb_name</option>\n";
+        				    else
+        					   echo "<option value=\"$row->geb_ID\">$row->geb_ID: $row->geb_name</option>\n";
+                        }
+                }
+                ?>
+                </select>
+                &nbsp;&nbsp;Raum&nbsp;            
+                 <select name="al[raum]">
+                <?php 
+                    if ($al['raum'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT raum_ID, raum_nr, raum_name FROM `fhiiqm`.`Raum` WHERE geb_ID='" . $al['geb'] ."' ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->raum_ID == $al['raum'])
+        					   echo "<option selected value=\"$row->raum_ID\">$row->raum_nr $row->raum_name</option>\n";
+        				    else
+        					   echo "<option value=\"$row->raum_ID\">$row->raum_nr $row->raum_name</option>\n";
+                        }
+                }
+                ?>
+                </select>
+            </td>
+        </tr>
+        <tr><td>Verantwortlicher</td>
+            <td valign="top"><input class="long20" type="text" name="al[persknr]" id="persknr" value="<?php echo $al['persknr']; ?>"/>
+            </td>
+        </tr>
+    <input type="hidden" name="al[pid]" id="pid" value="<?php echo $al['pid']; ?>"/>
+    <input type="hidden" name="al[okn]" value="<?php echo $okn; ?>"/>
+