|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 08/2011 |
|
6 * |
|
7 * Form Recherche Raum - Gefahr |
|
8 */ |
|
9 |
|
10 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
11 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
12 $okn = true; |
|
13 |
|
14 ?> |
|
15 <div align="center"> |
|
16 <h3><font face="Verdana, Arial, Helvetica, sans-serif"></font></h3> |
|
17 <p>Bitte Kriterien für die Suche wählen</p> |
|
18 </div> |
|
19 <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_rag" target="_self"> |
|
20 <div align="center"> |
|
21 <table width="50%" border="0" cellspacing="3" cellpadding="3"> |
|
22 <tr> |
|
23 <td>Haus</td> |
|
24 <td> |
|
25 <select name="rag[geb]" size="1" onchange="this.form.submit();"> |
|
26 <?php |
|
27 if ($rag["geb"] == -1) $select = " selected "; else $select = ""; |
|
28 echo "<option $select value=\"-1\"></option>\n"; |
|
29 $sql = "SELECT geb_ID, geb_name FROM Haus ORDER BY 1"; |
|
30 if ($result = $dbc->queryObjectArray($sql)) |
|
31 { |
|
32 foreach ($result as $row) |
|
33 { |
|
34 if ($row->geb_ID == $rag['geb']) |
|
35 echo "<option selected value=\"$row->geb_ID\">$row->geb_ID - $row->geb_name</option>\n"; |
|
36 else |
|
37 echo "<option value=\"$row->geb_ID\">$row->geb_ID - $row->geb_name</option>\n"; |
|
38 } |
|
39 } |
|
40 ?> |
|
41 </select> |
|
42 </td> |
|
43 </tr> |
|
44 <tr> |
|
45 <td>Raum-Nummer</td> |
|
46 <td><select name="rag[rnum]"> |
|
47 <?php |
|
48 if ($rag["rnum"] == -1) $select = " selected "; else $select = ""; |
|
49 echo "<option $select value=\"-1\"></option>\n"; |
|
50 if (isset($rag["geb"]) && $rag["geb"] > -1) $where = " WHERE geb_ID = '".$rag["geb"]."'"; else $where = ""; |
|
51 echo "Gebaeude: ".$rag["geb"]."<br />\n"; |
|
52 $sql = "SELECT geb_ID, raum_ID,raum_nr,raum_name FROM fhiiqm.Raum $where ORDER BY 1,3"; |
|
53 if ($result = $dbc->queryObjectArray($sql)) |
|
54 { |
|
55 foreach ($result as $row) |
|
56 { |
|
57 if ($row->raum_ID == $rag['rnum']) |
|
58 echo "<option selected value=\"$row->raum_ID\">$row->geb_ID - $row->raum_nr, $row->raum_name</option>\n"; |
|
59 else |
|
60 echo "<option value=\"$row->raum_ID\">$row->geb_ID - $row->raum_nr, $row->raum_name</option>\n"; |
|
61 } |
|
62 } |
|
63 ?> |
|
64 </select> |
|
65 </td> |
|
66 </tr> |
|
67 <tr> |
|
68 <td>Arbeitsplatz-Typ</td> |
|
69 <td><select name="rag[aptyp]"> |
|
70 <?php |
|
71 if ($rag["atyp"] == -1) $select = " selected "; else $select = ""; |
|
72 echo "<option $select value=\"-1\"></option>\n"; |
|
73 $sql = "SELECT arbplatz_typ,arbplatz_typ_bez FROM fhiiqm.Arbplatz_Typ ORDER BY 1"; |
|
74 if ($result = $dbc->queryObjectArray($sql)) |
|
75 { |
|
76 foreach ($result as $row) |
|
77 { |
|
78 if ($row->arbplatz_typ == $rag['atyp']) |
|
79 echo "<option selected value=\"$row->arbplatz_typ\">$row->arbplatz_typ - $row->arbplatz_typ_bez</option>\n"; |
|
80 else |
|
81 echo "<option value=\"$row->arbplatz_typ\">$row->arbplatz_typ - $row->arbplatz_typ_bez</option>\n"; |
|
82 } |
|
83 } |
|
84 ?> |
|
85 </select> |
|
86 </td> |
|
87 </tr> |
|
88 <tr> |
|
89 <td>Gefahr</td> |
|
90 <td><select name="rag[gef]"> |
|
91 <?php |
|
92 if ($rag["gef"] == -1) $select = " selected "; else $select = ""; |
|
93 echo "<option $select value=\"-1\"></option>\n"; |
|
94 $sql = "SELECT gefahr_ID,gefahrgr_ID,gefahr_bez FROM fhiiqm.Gefahr |
|
95 ORDER BY CONVERT(substring(gefahr_ID,1,INSTR(gefahr_ID,'.')-1),DECIMAL),CONVERT(SUBSTRING(gefahr_ID,INSTR(gefahr_ID,'.')+1),DECIMAL);"; |
|
96 if ($result = $dbc->queryObjectArray($sql)) |
|
97 { |
|
98 foreach ($result as $row) |
|
99 { |
|
100 if ($row->gefahr_ID == $rag['gef']) |
|
101 echo "<option selected value=\"$row->gefahr_ID\">$row->gefahr_ID - $row->gefahr_bez</option>\n"; |
|
102 else |
|
103 echo "<option value=\"$row->gefahr_ID\">$row->gefahr_ID - $row->gefahr_bez</option>\n"; |
|
104 } |
|
105 } |
|
106 ?> |
|
107 </select> |
|
108 </td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td>Verknüpfung</td> |
|
112 <td>UND |
|
113 <input type="radio" name="rag[bind]" value="AND" <?php if (isset($rag["bind"]) && $rag["bind"]=="AND") echo "checked"; else echo "checked";?>> |
|
114 ODER |
|
115 <input type="radio" name="rag[bind]" value="OR" <?php if (isset($rag["bind"]) && $rag["bind"]=="OR") echo "checked"; ?>></td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td>Sortierung nach<br />(in dieser Reihenfolge)</td><td> |
|
119 <?php |
|
120 $sort = array("-1"=>"","1"=>"Gebäude","2"=>"Raum-Nr.","6"=>"Arbeitsplatztyp","8"=>"Gefahr"); |
|
121 for ($i=1; $i<5; $i++) |
|
122 { |
|
123 echo "$i. <select name='rag[sort$i]'>\n"; |
|
124 foreach ($sort as $key=>$val) |
|
125 { |
|
126 $rsort = $sort . $i; |
|
127 if ($rag[$rsort] == $i) $select= " selected"; else $select = ""; |
|
128 echo "<option$select value='$key'>$val</option>\n"; |
|
129 } |
|
130 echo "</select> \n"; |
|
131 } |
|
132 echo "</td></tr>\n"; |
|
133 ?> |
|
134 <tr> |
|
135 <td> </td> |
|
136 <td><input class="button" type="submit" name="search" value="suchen"></td> |
|
137 </tr> |
|
138 </table> |
|
139 </div> |
|
140 </form> |