|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 07/2012 |
|
6 * |
|
7 * Report Gefaehrdungsanalye/Vorsorge Arbeitsbereiche (Raum-Arb.-Gruppen) |
|
8 * |
|
9 */ |
|
10 |
|
11 error_reporting(E_ALL ^ E_NOTICE); |
|
12 |
|
13 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
14 { |
|
15 session_start(); |
|
16 if (! isset($_SESSION["userid"])) |
|
17 { |
|
18 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
19 login($_SERVER["PHP_SELF"]); |
|
20 exit; |
|
21 } |
|
22 |
|
23 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"]))) |
|
24 { |
|
25 header("Location: start.php"); |
|
26 exit; |
|
27 } |
|
28 } |
|
29 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
30 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
31 |
|
32 ?> |
|
33 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
34 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
35 |
|
36 <head> |
|
37 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
38 <link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
39 <link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
40 <title>Report Abt./AG Gefährdungen Maßnahmen Vorsorge</title> |
|
41 </head> |
|
42 |
|
43 <body> |
|
44 |
|
45 <?php |
|
46 echo " "; |
|
47 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
48 { |
|
49 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
50 echo " user: " . $_SESSION["userid"]; |
|
51 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
52 } |
|
53 echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/role.png\" border=\"0\" alt=\"AG,Raum-Gefahr\" title=\"AG,Raum-Gefahr\"/></div>\n"; |
|
54 |
|
55 $rag = $_POST["rag"]; // Parameter aus Form |
|
56 $search = $_POST["search"]; |
|
57 if (!$search) $search = $_GET["s"]; |
|
58 |
|
59 $zeil = $rag["z"]; |
|
60 if (!$zeil) $zeil = $_GET["z"]; |
|
61 if (!$zeil) $zeil = 9999; // Anzahl der gezeigten Zeilen |
|
62 $start = $_GET["st"]; // Start bei DS $start+1 |
|
63 if (!$start) $start=0; |
|
64 |
|
65 |
|
66 if (!is_array($rag)) |
|
67 { |
|
68 $rag["geb"] = $_GET["g"]; |
|
69 $rag["abt"] = $_GET["a"]; |
|
70 $rag["ag"] = $_GET["ag"]; |
|
71 $rag["rnum"] = $_GET["r"]; |
|
72 $rag["ma"] = $_GET["m"]; |
|
73 $rag["gf"] = $_GET["f"]; |
|
74 $rag["vs"] = $_GET["v"]; |
|
75 $rag["bind"] = $_GET["b"]; |
|
76 $rag["sort1"] = $_GET["s1"]; |
|
77 $rag["sort2"] = $_GET["s2"]; |
|
78 $rag["sort3"] = $_GET["s3"]; |
|
79 $rag["sort4"] = $_GET["s4"]; |
|
80 } |
|
81 $_GET["g"] = $rag["geb"]; |
|
82 $_GET["r"] = $rag["rnum"]; |
|
83 $_GET["a"] = $rag["abt"]; |
|
84 $_GET["ag"] = $rag["ag"]; |
|
85 $_GET["m"] = $rag["ma"]; |
|
86 $_GET["f"] = $rag["gf"]; |
|
87 $_GET["v"] = $rag["vs"]; |
|
88 $_GET["b"] = $rag["bind"]; |
|
89 $_GET["s1"] = $rag["sort1"]; |
|
90 $_GET["s2"] = $rag["sort2"]; |
|
91 $_GET["s3"] = $rag["sort3"]; |
|
92 $_GET["s4"] = $rag["sort4"]; |
|
93 $_GET["z"] = $zeil; |
|
94 |
|
95 if ($search && $_GET['s'] != 2) |
|
96 { |
|
97 echo "<span class='sc'>"; |
|
98 echo "<br /> <a href=\"/fhiiqm/as_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
99 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"RAG GMV\" class=\"sc\">neuer Bericht Abt./AG-Gefährdungen Maßnahmen Vorsorge</a>\n"; |
|
100 echo "</span>"; |
|
101 } |
|
102 echo "<div align='center'>\n"; |
|
103 echo "<p><b>(8) Bericht Gefährdungen: Maßnahmen, Vorsorge in Arbeitsgruppen</b></p>\n"; |
|
104 echo "</div>\n"; |
|
105 |
|
106 if (!$search) |
|
107 { |
|
108 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/rag_gv_search_form.inc.php"); |
|
109 } |
|
110 else |
|
111 { |
|
112 echo "<div align='center'>\n"; |
|
113 |
|
114 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
115 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
116 |
|
117 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
118 |
|
119 // Tabelle 'rag_gfmsnvs' aktualisieren |
|
120 $sql = "CALL rag_ma_raum_gef_massn_vors(1,'',0, '',0,999,@anz);"; |
|
121 // liefert: rag_ID,rag_bez,abt_name,raeume,ma,gefahr-massnahmen,vorsorge, Dokumente Betriebsanweisung; loescht alten Inhalt, fuellt Tabelle 'rag_gfmsnvs' |
|
122 $result = $dbc ->queryObjectArray($sql); |
|
123 |
|
124 $sql = "SELECT rag_ID, rag_bez, abt_name, ma, raeume, gefahr_msn, vorsorge, doc |
|
125 FROM `fhiiqm`.`rag_gfmsnvs` "; |
|
126 $lim = " LIMIT $start,$zeil"; |
|
127 |
|
128 if (!$rag["bind"]) $bind = " AND "; else $bind = $rag["bind"]; |
|
129 |
|
130 if ($rag["geb"]> -1) $where = " raeume LIKE '%$rag[geb]:%' "; |
|
131 if ($rag["rnum"]) |
|
132 if ($where) $where .= "$bind raeume LIKE '%$rag[rnum]%' "; else $where = " raeume LIKE '%$rag[rnum]%' "; |
|
133 if ($rag["abt"]> -1) |
|
134 if ($where) $where .= "$bind abt_name = '$rag[abt]' "; else $where = " abt_name = '$rag[abt]' "; |
|
135 if ($rag["ag"]> -1) |
|
136 if ($where) $where .= "$bind rag_ID = $rag[ag] "; else $where = " rag_ID = $rag[ag] "; |
|
137 if ($rag["ma"]) |
|
138 if ($where) $where .= "$bind ma LIKE '%$rag[ma]%' "; else $where = " ma LIKE '%$rag[ma]%' "; |
|
139 if ($rag["gf"]> -1) |
|
140 if ($where) $where .= "$bind gefahr_msn LIKE '%$rag[gf]%' "; else $where = " gefahr_msn LIKE '%$rag[gf]%' "; |
|
141 if ($rag["vs"]> -1) |
|
142 if ($where) $where .= "$bind vorsorge LIKE '%$rag[vs]%' "; else $where = " vorsorge LIKE '%$rag[vs]%' "; |
|
143 if ($where) $where = " WHERE $where"; |
|
144 |
|
145 if ($rag["sort1"]>0 || $rag["sort2"]>0 || $rag["sort3"]>0 || $rag["sort4"]>0 || $rag["sort5"]>0) |
|
146 { |
|
147 if ($rag["sort1"]>0) $ord = "ORDER BY ".$rag["sort1"]; |
|
148 if ($rag["sort2"]>0) $ord .= ",".$rag["sort2"]; |
|
149 if ($rag["sort3"]>0) $ord .= ",".$rag["sort3"]; |
|
150 if ($rag["sort4"]>0) $ord .= ",".$rag["sort4"]; |
|
151 if ($rag["sort5"]>0) $ord .= ",".$rag["sort5"]; |
|
152 } |
|
153 $sql .= $where . $ord . $lim; |
|
154 // echo "sql = $sql<br />\n"; |
|
155 $result = $dbc ->queryObjectArray($sql); |
|
156 |
|
157 if ($rag["geb"] > -1) $krit = " [Gebäude = '" . $rag["geb"] ."']"; |
|
158 if ($krit) $bd = " ".$bind; else $bd = ""; |
|
159 if ($rag["rnum"]) $krit .= $bd. " [Raum-Nr. = '" . $rag['rnum'] ."']"; |
|
160 $bd = ($krit)? (" ".$bind) : " "; |
|
161 if ($rag["abt"] > -1) $krit .= $bd. " [Abteilung = '" . $rag['abt'] ."']"; |
|
162 if ($rag["ag"] > -1) |
|
163 { |
|
164 $agbez = $dbc -> querySingleItem("SELECT rag_bez FROM fhiiqm.RaumArb_Gruppe WHERE rag_ID = ".$rag['ag']); |
|
165 $bd = ($krit)? (" ".$bind) : " "; |
|
166 $krit .= $bd. " [Arbeitsgruppe = '$agbez']"; |
|
167 } |
|
168 $bd = ($krit)? (" ".$bind) : " "; |
|
169 if ($rag["ma"]) $krit .= $bd. " [Mitarbeiter wie '" . $rag['ma'] ."']"; |
|
170 $bd = ($krit)? (" ".$bind) : " "; |
|
171 if ($rag["gf"] > -1) $krit .= $bd. " [Gefährdung = '" . $rag['gf'] ."']"; |
|
172 $bd = ($krit)? (" ".$bind) : " "; |
|
173 if ($rag["vs"] > -1) $krit .= $bd. " [Vorsorge = '" . $rag['vs'] ."']"; |
|
174 if ($krit )echo "Suchergebnis für $krit"; else echo "Suchergebnis"; |
|
175 |
|
176 if ($result) |
|
177 { |
|
178 $bg1 = "#F8F8F8"; |
|
179 $bg2 = "#DEDFE1"; |
|
180 $bg = "#FFFFFF"; |
|
181 |
|
182 $sqlc = "SELECT COUNT(*) |
|
183 FROM rag_gfmsnvs $where"; |
|
184 $ianz = $dbc -> querySingleItem($sqlc); |
|
185 |
|
186 //$ianz = $dbc -> numrows($sql); //liefert nur $zeil! |
|
187 printf ("<p>Anzahl gefundener Datensätze: %s</p>", $ianz); |
|
188 |
|
189 echo "<table width='99%' border='1' cellspacing='0' cellpadding='2'>\n"; |
|
190 $cols=7; |
|
191 // Listenkopf |
|
192 echo "<tr bgcolor='#68ACBF'>"; |
|
193 if ($rag["bind"]=="OR" || !$rag['abt'] || $rag['abt'] == -1) |
|
194 { |
|
195 echo "<th>Abteilung</th>"; |
|
196 $cols +=1; |
|
197 } |
|
198 echo "<th>Arbeitsgruppe</th>"; |
|
199 echo "<th>Räume</th>"; |
|
200 echo "<th>Mitarbeiter</th>"; |
|
201 echo "<th>Gefährdung, Maßnahmen</th>"; |
|
202 echo "<th>Vorsorge</th>"; |
|
203 echo "<th>Betriebsanweisung</th>"; |
|
204 echo "</tr>"; |
|
205 |
|
206 function doc_bez($val) |
|
207 { // Callback-Funktion fuer array_map |
|
208 return substr($val,strpos($val,"_")+1); |
|
209 } |
|
210 |
|
211 foreach ($result as $row) |
|
212 { |
|
213 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
214 echo "<tr bgcolor='" . $bg . "'>"; |
|
215 if ($rag["bind"]=="OR" || !$rag['abt'] || $rag['abt'] == -1) echo "<td>$row->abt_name</td>"; |
|
216 if (strpos($row->rag_bez,"DynamiX")) $row->rag_bez = str_replace("X","χ",$row->rag_bez); |
|
217 echo "<td>$row->rag_bez</td>"; |
|
218 echo "<td>".str_replace(";","<br />",$row->raeume)."</td>"; |
|
219 if ($rag['ma']) |
|
220 { |
|
221 $ma = str_replace(lcfirst($rag['ma']),"<b>".lcfirst($rag['ma'])."</b>",$row->ma); |
|
222 $ma = str_replace(ucfirst($rag['ma']),"<b>".ucfirst($rag['ma'])."</b>",$ma); |
|
223 } |
|
224 else $ma = $row->ma; |
|
225 echo "<td>".str_replace(";","<br />",$ma)."</td>"; |
|
226 echo "<td width='35%'>".str_replace(";","<br />",$row->gefahr_msn)."</td>"; |
|
227 if (strpos($row->vorsorge,";")===0) $row->vorsorge = substr($row->vorsorge,1); |
|
228 echo "<td>".str_replace(";","<br />",$row->vorsorge)."</td>"; |
|
229 if ($row->doc > " ") |
|
230 { |
|
231 echo "<td>"; |
|
232 $docs = explode("; ",$row->doc); |
|
233 $docu = array_unique(array_map("doc_bez",$docs)); // array docs ohne 'id_' und ohne mehrfache values |
|
234 foreach ($docs as $key => $doc) |
|
235 if (array_key_exists($key,$docu)) |
|
236 echo "<a href='/fhiiqm/infos/$doc'>".substr($doc,strpos($doc,"_")+1)."</a><br />"; |
|
237 echo "</td>"; |
|
238 } |
|
239 else echo "<td> </td>"; |
|
240 echo "</tr>\n"; |
|
241 } |
|
242 echo "</table>\n"; |
|
243 |
|
244 |
|
245 echo "<p></p><table width=80%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'> |
|
246 <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>"; |
|
247 echo "</div>\n"; |
|
248 |
|
249 echo "<br /> "; |
|
250 if ($search != 2) // Aufruf aus fhiiqm |
|
251 { |
|
252 // Parameter aus $_GET fuer weitere Seiten |
|
253 $_GET["s"] = 1; // bewirkt weitere Suche |
|
254 foreach ($_GET as $key=>$val) |
|
255 { |
|
256 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
257 } |
|
258 // Links auf andere Seiten generieren |
|
259 liste_links($start,$zeil,$ianz,$liste); |
|
260 } |
|
261 } |
|
262 else |
|
263 { |
|
264 echo "<p class='red'> Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>"; |
|
265 echo "</div>\n"; |
|
266 echo "<br /> "; |
|
267 } |
|
268 if ($search != 2) |
|
269 { |
|
270 echo "<span class='sc'>"; |
|
271 echo "<br /><br /> <a href=\"/fhiiqm/as_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
272 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"RAG GMV\" class=\"sc\">neuer Bericht Abt./AG-Gefährdungen Maßnahmen Vorsorge</a>\n"; |
|
273 echo "</span>"; |
|
274 } |
|
275 else |
|
276 echo "<a href='javascript:history.back();' onMouseOver=\"{window.status='Zurück'; return true;}\">« Zurück</a>"; |
|
277 } |
|
278 |
|
279 ?> |
|
280 |
|
281 </body> |
|
282 </html> |