|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 06/2012 |
|
6 * |
|
7 * Report Abteilung - AG - Arbplatztypen (Raum-Arb.-Gruppen) |
|
8 * $_GET['s']=2 - Aufruf aus adm-fhi-Seite ohne Anmeldung |
|
9 * |
|
10 */ |
|
11 |
|
12 error_reporting(E_ALL ^ E_NOTICE); |
|
13 |
|
14 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
15 { |
|
16 session_start(); |
|
17 if (! isset($_SESSION["userid"])) |
|
18 { |
|
19 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
20 login($_SERVER["PHP_SELF"]); |
|
21 exit; |
|
22 } |
|
23 |
|
24 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"]))) |
|
25 { |
|
26 header("Location: start.php"); |
|
27 exit; |
|
28 } |
|
29 } |
|
30 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
31 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
32 |
|
33 ?> |
|
34 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
36 |
|
37 <head> |
|
38 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
39 <link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
40 <link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
41 <title>Report Abteilung-AG-Arb.platztypen</title> |
|
42 </head> |
|
43 |
|
44 <body> |
|
45 |
|
46 <?php |
|
47 echo " "; |
|
48 if (!isset($_GET['s']) || $_GET['s'] != 2 ) |
|
49 { |
|
50 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
51 echo " user: " . $_SESSION["userid"]; |
|
52 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
53 } |
|
54 echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/role.png\" border=\"0\" alt=\"RaumArbGruppe\" title=\"Raum-Arbeitsgruppe\"/></div>\n"; |
|
55 |
|
56 $rag = $_POST["rag"]; // Parameter aus Form |
|
57 $search = $_POST["search"]; |
|
58 if (!$search) $search = $_GET["s"]; |
|
59 |
|
60 $zeil = $rag["z"]; |
|
61 if (!$zeil) $zeil = $_GET["z"]; |
|
62 if (!$zeil) $zeil = 9999; // Anzahl der gezeigten Zeilen |
|
63 $start = $_GET["st"]; // Start bei DS $start+1 |
|
64 if (!$start) $start=0; |
|
65 |
|
66 if (!is_array($rag)) |
|
67 { |
|
68 $rag["abt"] = $_GET["a"]; |
|
69 $rag["sort1"] = $_GET["s1"]; |
|
70 $rag["sort2"] = $_GET["s2"]; |
|
71 $rag["sort3"] = $_GET["s3"]; |
|
72 } |
|
73 $_GET["a"] = $rag["abt"]; |
|
74 $_GET["s1"] = $rag["sort1"]; |
|
75 $_GET["s2"] = $rag["sort2"]; |
|
76 $_GET["s3"] = $rag["sort3"]; |
|
77 $_GET["z"] = $zeil; |
|
78 |
|
79 if ($search && $_GET['s'] != 2) |
|
80 { |
|
81 echo "<span class='sc'>"; |
|
82 echo "<br /> <a href=\"/fhiiqm/raum_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
83 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Abt-AG-Arbpltyp\" class=\"sc\">neuer Bericht Abteilung-AG-Arbeitsplatztypen</a>\n"; |
|
84 echo "</span>"; |
|
85 } |
|
86 echo "<div align='center'>\n"; |
|
87 echo "<p><b>Bericht Abteilung - AG - Arbeitsplatztypen</b></p>\n"; |
|
88 echo "</div>\n"; |
|
89 if (!$search) |
|
90 { |
|
91 ?> |
|
92 <div align="center"> |
|
93 <p>Bitte Kriterien für die Suche wählen</p> |
|
94 <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_raum" target="_self"> |
|
95 <table width="50%" border="0" cellspacing="3" cellpadding="3"> |
|
96 <tr> |
|
97 <td>Abteilung</td> |
|
98 <td> |
|
99 <select name="rag[abt]" size="1"> |
|
100 <?php |
|
101 if ($rag["abt"] == -1) $select = " selected "; else $select = ""; |
|
102 echo "<option $select value=\"-1\"></option>\n"; |
|
103 $sql = "SELECT abt_ID, abt_name, abt_long FROM Abteilung ORDER BY 1"; |
|
104 if ($result = $dbc->queryObjectArray($sql)) |
|
105 { |
|
106 foreach ($result as $row) |
|
107 { |
|
108 if ($row->abt_ID == $rag['abt']) |
|
109 echo "<option selected value=\"$row->abt_ID\">$row->abt_name - $row->abt_long</option>\n"; |
|
110 else |
|
111 echo "<option value=\"$row->abt_ID\">$row->abt_name - $row->abt_long</option>\n"; |
|
112 } |
|
113 } |
|
114 ?> |
|
115 </select> |
|
116 </td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td>Sortierung nach<br />(in dieser Reihenfolge)</td><td> |
|
120 <?php |
|
121 $sort = array("-1"=>"","1"=>"Abteilung","3"=>"Arbeitsgruppe","4"=>"Arbeitsplatz-Typ"); |
|
122 for ($i=1; $i<4; $i++) |
|
123 { |
|
124 echo "$i. <select name='rag[sort$i]'>\n"; |
|
125 foreach ($sort as $key=>$val) |
|
126 { |
|
127 $rsort = $sort . $i; |
|
128 if ($rag[$rsort] == $i) $select= " selected"; else $select = ""; |
|
129 echo "<option$select value='$key'>$val</option>\n"; |
|
130 } |
|
131 echo "</select> \n"; |
|
132 } |
|
133 echo "</td></tr>\n"; |
|
134 |
|
135 $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows |
|
136 echo "<tr><td>Zeilen/Seite?</td><td><select name='rag[z]'>\n"; |
|
137 if (!$rag['z']) $rag['z'] = 9999; |
|
138 foreach ($azeil as $key=>$val) |
|
139 { |
|
140 if ($key == $rag['z']) $select = "selected"; else $select = ""; |
|
141 echo "<option $select value='$key'>$val</option>\n"; |
|
142 } |
|
143 echo "</select></td></tr>\n"; |
|
144 |
|
145 ?> |
|
146 <tr> |
|
147 <td> </td> |
|
148 <td><input class="button" type="submit" name="search" value="Bericht erstellen"/></td> |
|
149 </tr> |
|
150 </table> |
|
151 </div> |
|
152 </form> |
|
153 <?php |
|
154 } |
|
155 else |
|
156 { |
|
157 echo "<div align='center'>\n"; |
|
158 |
|
159 $sql = "SELECT DISTINCT rg.abt_ID,abt_name,rag_bez, ra.arbplatz_typ, arbplatz_typ_bez, rg.rag_ID |
|
160 FROM fhiiqm.RaumArb_Gruppe rg LEFT OUTER JOIN Abteilung a ON rg.abt_ID=a.abt_ID |
|
161 LEFT OUTER JOIN Raum_RaumArbGruppe rr ON rg.rag_ID=rr.rag_ID |
|
162 LEFT OUTER JOIN Raum r ON rr.raum_ID=r.raum_ID |
|
163 LEFT OUTER JOIN Raum_Arbplatz_Typ ra ON r.raum_ID=ra.raum_ID |
|
164 LEFT OUTER JOIN Arbplatz_Typ t ON ra.arbplatz_typ=t.arbplatz_typ"; |
|
165 |
|
166 $lim = " LIMIT $start,$zeil"; |
|
167 |
|
168 if ($rag["abt"]> -1) |
|
169 $where = " rg.abt_ID = '$rag[abt]' "; |
|
170 if ($where) $where = " WHERE $where"; |
|
171 |
|
172 if ($rag["sort1"]>0 || $rag["sort2"]>0 || $rag["sort3"]>0) |
|
173 { |
|
174 if ($rag["sort1"]>0) $ord = $rag["sort1"]; |
|
175 if ($rag["sort2"]>0) $ord .= ",".$rag["sort2"]; |
|
176 if ($rag["sort3"]>0) $ord .= ",".$rag["sort3"]; |
|
177 } |
|
178 |
|
179 $sql .= $where; |
|
180 $ianz = $dbc -> numrows($sql); |
|
181 if ($ord) $ord = " ORDER BY ".$ord; else $ord = ""; |
|
182 $sql .= $ord . $lim; |
|
183 // echo "sql = $sql<br />\n"; |
|
184 $result = $dbc ->queryObjectArray($sql); |
|
185 |
|
186 if ($rag["abt"] > -1) |
|
187 { |
|
188 $abtn = $dbc -> querySingleItem("SELECT abt_name FROM Abteilung WHERE abt_ID=".$rag["abt"]); |
|
189 $krit = " [Abteilung = '$abtn']"; |
|
190 } |
|
191 if ($krit )echo "Suchergebnis für $krit<p></p>\n"; else echo "Suchergebnis<p></p>\n"; |
|
192 |
|
193 if ($result) |
|
194 { |
|
195 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
196 |
|
197 $bg1 = "#F8F8F8"; |
|
198 $bg2 = "#DEDFE1"; |
|
199 $bg = "#FFFFFF"; |
|
200 echo "<table border='1' cellspacing='0' cellpadding='2'>\n"; |
|
201 // Listenkopf |
|
202 echo "<tr bgcolor='#68ACBF'>"; |
|
203 if (!$rag['abt'] || $rag['abt'] == -1) echo "<th>Abteilung</th>"; |
|
204 echo "<th>Arbeitsgruppe</th>"; |
|
205 echo "<th>Arbeitsplatz-Typ</th>"; |
|
206 echo "</tr>\n"; |
|
207 |
|
208 foreach ($result as $row) |
|
209 { |
|
210 if ($row->rag_ID != $rid) |
|
211 { |
|
212 if ($rid) echo "</td></tr>\n"; |
|
213 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
214 echo "<tr bgcolor='" . $bg . "'>"; |
|
215 if (!$rag['abt'] || $rag['abt'] == -1) echo "<td>$row->abt_name"; |
|
216 echo "<td>$row->rag_bez"; |
|
217 echo "<td>$row->arbplatz_typ - $row->arbplatz_typ_bez"; |
|
218 } |
|
219 else |
|
220 echo "<br />$row->arbplatz_typ - $row->arbplatz_typ_bez"; |
|
221 $rid = $row->rag_ID; |
|
222 } |
|
223 echo "</table>\n"; |
|
224 echo "<p></p><table width=40%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'> |
|
225 <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>"; |
|
226 echo "</div>\n"; |
|
227 |
|
228 echo "<br /> "; |
|
229 if ($search != 2) // Aufruf aus fhiiqm |
|
230 { |
|
231 // Parameter aus $_GET fuer weitere Seiten |
|
232 $_GET["s"] = 1; // bewirkt weitere Suche |
|
233 foreach ($_GET as $key=>$val) |
|
234 { |
|
235 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
236 } |
|
237 // Links auf andere Seiten generieren |
|
238 liste_links($start,$zeil,$ianz,$liste); |
|
239 } |
|
240 } |
|
241 else |
|
242 { |
|
243 echo "<p class='red'> Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>"; |
|
244 echo "</div>\n"; |
|
245 echo "<br /> "; |
|
246 } |
|
247 if ($search != 2) |
|
248 { |
|
249 echo "<span class='sc'>"; |
|
250 echo "<br /><br /> <a href=\"/fhiiqm/raum_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>« zur Berichtsübersicht</a>"; |
|
251 echo " | <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Raum-Typ\" class=\"sc\">neuer Bericht Abteilung-AG-Arbeitsplatztypen</a>\n"; |
|
252 echo "</span>"; |
|
253 } |
|
254 else |
|
255 echo "<a href='javascript:history.back();' onMouseOver=\"{window.status='Zurück'; return true;}\">« Zurück</a>"; |
|
256 } |
|
257 |
|
258 ?> |
|
259 |
|
260 </body> |
|
261 </html> |