|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 08/2011, 05/2012 |
|
6 * |
|
7 * Arbeitsicherheit |
|
8 */ |
|
9 |
|
10 error_reporting(E_ALL ^ E_NOTICE); |
|
11 |
|
12 session_start(); |
|
13 if (! isset($_SESSION["userid"])) |
|
14 { |
|
15 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
16 login($_SERVER["PHP_SELF"]); |
|
17 exit; |
|
18 } |
|
19 |
|
20 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"]))) |
|
21 { |
|
22 header("Location: start.php"); |
|
23 exit; |
|
24 } |
|
25 |
|
26 ?> |
|
27 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
29 |
|
30 <head> |
|
31 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
32 <link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
33 <link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
34 <title>Arbeitssicherheit</title> |
|
35 </head> |
|
36 |
|
37 <body> |
|
38 |
|
39 |
|
40 <?php |
|
41 echo " "; |
|
42 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
43 echo " user: " . $_SESSION["userid"]; |
|
44 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
45 echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/role.png\" border=\"0\" alt=\"Raum-Gefahr\" title=\"Raum-Gefahr\"/></div>\n"; |
|
46 |
|
47 $rag = $_POST["rag"]; // Parameter aus Form |
|
48 $search = $_POST["search"]; |
|
49 if (!$search) $search = $_GET["s"]; |
|
50 |
|
51 $zeil = $rag["z"]; |
|
52 if (!$zeil) $zeil = $_GET["z"]; |
|
53 if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen |
|
54 $start = $_GET["st"]; // Start bei DS $start+1 |
|
55 if (!$start) $start=0; |
|
56 |
|
57 |
|
58 if (!is_array($rag)) |
|
59 { |
|
60 $rag["geb"] = $_GET["g"]; |
|
61 $rag["rnum"] = $_GET["r"]; |
|
62 $rag["aptyp"] = $_GET["a"]; |
|
63 $rag["gef"] = $_GET["f"]; |
|
64 $rag["bind"] = $_GET["b"]; |
|
65 $rag["sort1"] = $_GET["s1"]; |
|
66 $rag["sort2"] = $_GET["s2"]; |
|
67 $rag["sort3"] = $_GET["s3"]; |
|
68 $rag["sort4"] = $_GET["s4"]; |
|
69 } |
|
70 $_GET["g"] = $rag["geb"]; |
|
71 $_GET["r"] = $rag["rnum"]; |
|
72 $_GET["a"] = $rag["aptyp"]; |
|
73 $_GET["f"] = $rag["gef"]; |
|
74 $_GET["b"] = $rag["bind"]; |
|
75 $_GET["s1"] = $rag["sort1"]; |
|
76 $_GET["s2"] = $rag["sort2"]; |
|
77 $_GET["s3"] = $rag["sort3"]; |
|
78 $_GET["s4"] = $rag["sort4"]; |
|
79 $_GET["z"] = $zeil; |
|
80 |
|
81 echo "<div align='center'>\n"; |
|
82 echo "<p><b>Bericht Gefahren am Arbeitsplatz</b></p>\n"; |
|
83 echo "</div>\n"; |
|
84 |
|
85 if (!$search) |
|
86 { |
|
87 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/gefahr_ap_search_form.inc.php"); |
|
88 } |
|
89 else |
|
90 { |
|
91 echo "<div align='center'>\n"; |
|
92 |
|
93 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
94 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
95 |
|
96 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
97 |
|
98 $sql = "SELECT geb_ID, raum_nr, raum_name, r.raumtyp_ID, raumtyp_bez, ra.arbplatz_typ, arbplatz_typ_bez, a.gefahr_ID, gefahr_bez, r.raum_ID |
|
99 FROM Raum r LEFT OUTER JOIN Raum_Typ rt ON r.raumtyp_ID = rt.raumtyp_ID |
|
100 LEFT OUTER JOIN Raum_Arbplatz_Typ ra ON ra.raum_ID = r.raum_ID |
|
101 LEFT OUTER JOIN Arbplatz_Typ at ON ra.arbplatz_typ = at.arbplatz_typ |
|
102 LEFT OUTER JOIN Gefahr_Arbplatz a ON a.arbplatz_typ = at.arbplatz_typ |
|
103 LEFT OUTER JOIN Gefahr g ON a.gefahr_ID = g.gefahr_ID"; |
|
104 $lim = " LIMIT $start,$zeil"; |
|
105 |
|
106 if (!$rag["bind"]) $bind = " AND "; else $bind = $rag["bind"]; |
|
107 |
|
108 if ($rag["geb"]> -1) $where = " geb_ID = '$rag[geb]' "; |
|
109 if ($rag["rnum"]> -1) |
|
110 if ($where) $where .= "$bind r.raum_ID = '$rag[rnum]' "; else $where = " r.raum_ID = '$rag[rnum]' "; |
|
111 if ($rag["aptyp"]> -1) |
|
112 if ($where) $where .= "$bind ra.arbplatz_typ = '$rag[aptyp]' "; else $where = " ra.arbplatz_typ = '$rag[aptyp]' "; |
|
113 if ($rag["gef"]> -1) |
|
114 if ($where) $where .= "$bind a.gefahr_ID = '$rag[gef]' "; else $where = " a.gefahr_ID = '$rag[gef]' "; |
|
115 if ($where) $where = " WHERE $where"; |
|
116 |
|
117 if ($rag["sort1"]>0 || $rag["sort2"]>0 || $rag["sort3"]>0 || $rag["sort4"]>0) |
|
118 { |
|
119 if ($rag["sort1"]>0) $ord = " ORDER BY " . $rag["sort1"]; |
|
120 if ($rag["sort2"]>0) $ord .= ",".$rag["sort2"]; |
|
121 if ($rag["sort3"]>0) $ord .= ",".$rag["sort3"]; |
|
122 if ($rag["sort4"]>0) $ord .= ",".$rag["sort4"]; |
|
123 } |
|
124 |
|
125 $sql .= $where . $ord . $lim; |
|
126 // echo "sql = $sql<br />\n"; |
|
127 $result = $dbc ->queryObjectArray($sql); |
|
128 |
|
129 if ($rag["geb"] > -1) $krit = " [Gebäude = '" . $rag["geb"] ."']"; |
|
130 if ($rag["rnum"] > -1) |
|
131 { |
|
132 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
133 $krit .= $bd." [Raum-Nr. = '" . $rag["rnum"] ."']"; |
|
134 } |
|
135 if ($rag["aptyp"] > -1) |
|
136 { |
|
137 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
138 $krit .= $bd." [Arb.Platz-Typ = '" . $rag["aptyp"] ."']"; |
|
139 } |
|
140 if ($rag["gef"] > -1) |
|
141 { |
|
142 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
143 $krit .= $bd." [Gefahr = '" . $rag["gef"] ."']"; |
|
144 } |
|
145 if ($krit )echo "Suchergebnis für $krit"; else echo "Suchergebnis"; |
|
146 |
|
147 if ($result) |
|
148 { |
|
149 $bg1 = "#F8F8F8"; |
|
150 $bg2 = "#DEDFE1"; |
|
151 $bg = "#FFFFFF"; |
|
152 |
|
153 $sqlc = "SELECT COUNT(*) |
|
154 FROM Raum r LEFT OUTER JOIN Raum_Typ rt ON r.raumtyp_ID = rt.raumtyp_ID |
|
155 LEFT OUTER JOIN Raum_Arbplatz_Typ ra ON ra.raum_ID = r.raum_ID |
|
156 LEFT OUTER JOIN Arbplatz_Typ at ON ra.arbplatz_typ = at.arbplatz_typ |
|
157 LEFT OUTER JOIN Gefahr_Arbplatz a ON a.arbplatz_typ = at.arbplatz_typ $where"; |
|
158 $ianz = $dbc -> querySingleItem($sqlc); |
|
159 |
|
160 //$ianz = $dbc -> numrows($sql); //liefert nur $zeil! |
|
161 printf ("<p>Anzahl gefundener Datensätze: %s</p>", $ianz); |
|
162 |
|
163 echo "<table border='1' cellspacing='0' cellpadding='2'>\n"; |
|
164 // Listenkopf |
|
165 echo "<tr bgcolor='#68ACBF'>"; |
|
166 echo "<th>Gebäude</th>"; |
|
167 echo "<th>Raum-Nr.</th>"; |
|
168 echo "<th>Raum-Bez.</th>"; |
|
169 echo "<th>Arb.-Platz-Typ</th>"; |
|
170 echo "<th>Gefahr</th></tr>"; |
|
171 |
|
172 |
|
173 foreach ($result as $row) |
|
174 { |
|
175 if ($rid != $row->raum_ID) |
|
176 { |
|
177 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
178 echo "<tr bgcolor='" . $bg . "'>"; |
|
179 echo "<td>$row->geb_ID</td>"; |
|
180 echo "<td>$row->raum_nr</td>"; |
|
181 echo "<td>$row->raum_name</td>"; |
|
182 echo "<td>$row->arbplatz_typ - $row->arbplatz_typ_bez</td>"; |
|
183 } |
|
184 else |
|
185 { |
|
186 echo "<tr bgcolor='" . $bg . "'>"; |
|
187 echo "<td> </td><td> </td><td> </td><td> </td>"; |
|
188 } |
|
189 echo "<td>$row->gefahr_ID - $row->gefahr_bez</td></tr>\n"; |
|
190 $rid = $row->raum_ID; |
|
191 } |
|
192 echo "</table>\n"; |
|
193 |
|
194 echo "<p></p><table width=60%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'> |
|
195 <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>"; |
|
196 |
|
197 echo "</div>\n"; |
|
198 |
|
199 echo "<br /> "; |
|
200 // Parameter aus $_GET fuer weitere Seiten |
|
201 $_GET["s"] = 1; // bewirkt weitere Suche |
|
202 foreach ($_GET as $key=>$val) |
|
203 { |
|
204 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
205 } |
|
206 // Links auf andere Seiten generieren |
|
207 liste_links($start,$zeil,$ianz,$liste); |
|
208 } |
|
209 else |
|
210 { |
|
211 echo "<p class='red'> Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>"; |
|
212 echo "</div>\n"; |
|
213 } |
|
214 echo "<br /><br /> <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Gefahren\" class=\"sc\">neuer Bericht Arbeitsplatz-Gefahr</a></p>\n"; |
|
215 } |
|
216 |
|
217 ?> |
|
218 |
|
219 </body> |
|
220 </html> |