|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 04/2012 |
|
6 * |
|
7 * Liste Raeume Arbeitsplatztyp |
|
8 * |
|
9 */ |
|
10 |
|
11 error_reporting(E_ALL ^ E_NOTICE); |
|
12 |
|
13 session_start(); |
|
14 if (! isset($_SESSION["userid"])) |
|
15 { |
|
16 include_once ("inc/func_lib.inc.php"); |
|
17 login($_SERVER["PHP_SELF"]); |
|
18 exit; |
|
19 } |
|
20 |
|
21 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("rr",$_SESSION["recht"]) && !in_array("re",$_SESSION["recht"]))) |
|
22 { |
|
23 header("Location: start.php"); |
|
24 exit; |
|
25 } |
|
26 |
|
27 ?> |
|
28 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
29 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
30 |
|
31 <head> |
|
32 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
33 <link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
34 <link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
35 |
|
36 <title>Raum-Arbeitsplatztyp-Liste</title> |
|
37 </head> |
|
38 |
|
39 <body onload="document.ffilter.filter.focus();"> |
|
40 |
|
41 <?php |
|
42 echo " "; |
|
43 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
44 echo " user: " . $_SESSION["userid"]; |
|
45 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
46 echo "<div class=\"float-r\"><img src=\"img/house.png\" border=\"0\" alt=\"Raumdaten\" title=\"Raumdaten\"/></div>\n"; |
|
47 |
|
48 // Felder, nach denen gefiltert werden kann |
|
49 $fields = array(2=>"Gebäude",3=>"Raum-Nr.",5=>"Arbeitsplatztyp",6=>"Arbeitsplatztyp-Bez.",7=>"Raum-Typ"); |
|
50 |
|
51 $zeil = $_GET["z"]; |
|
52 if (!$zeil) $zeil = $_POST["z"]; |
|
53 if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen |
|
54 $start = $_GET["st"]; |
|
55 if (!$start) $start=0; |
|
56 |
|
57 $sort = $_GET["s"]; // Sortierung nach Spalte |
|
58 if (!isset($sort) && !$sort) $sort = $_POST["s"]; |
|
59 |
|
60 $dir = $_GET["d"]; // Sortierrichtung |
|
61 if (!isset($dir) && !$dir) $dir = $_POST["d"]; |
|
62 |
|
63 $fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird |
|
64 if (!isset($fnum) && !$fnum) $fnum = $_POST["f"]; |
|
65 |
|
66 $filter = $_POST["filter"]; |
|
67 if (!isset($filter) && !$filter) $filter = $_GET["b"]; |
|
68 |
|
69 $subf = $_POST["subf"]; // submit |
|
70 |
|
71 if (!isset($fnum) && !$fnum) $fnum = 1; |
|
72 if (!isset($filter) && !$filter) $filter = ""; |
|
73 if (!isset($sort) && !$sort) $sort = 2; |
|
74 if (!isset($dir) && !$dir) $dir = ""; |
|
75 |
|
76 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
77 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
78 $dbc = new dbconnection(); |
|
79 |
|
80 $sql = "CALL raum_arbplatztyp_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz);"; |
|
81 // Parameter: Nr. Sortfeld, Sortierrichtung, Nr. Filterfeld, Filterbegriff, (StartNr DS) -1, Anzahl Zeilen=DS, Anzahl gefundener Raeume |
|
82 // liefert: raum_ID,geb_ID,raum_nr,raum_name,arbplatz_typ,arbplatz_typ_bez,raumtyp_ID,raumtyp_bez |
|
83 |
|
84 $result = $dbc ->queryObjectArray($sql); |
|
85 |
|
86 if ($result) |
|
87 { |
|
88 $bg1 = "#F8F8F8"; |
|
89 $bg2 = "#DEDFE1"; |
|
90 $bg = "#FFFFFF"; |
|
91 |
|
92 echo "<div align='center'>\n"; |
|
93 echo "<p><b>Liste Räume - Arbeitsplatztypen</b></p>\n"; |
|
94 |
|
95 echo "<table border='0' cellspacing='0'>\n"; |
|
96 echo "<tr><td class='bigger'>Mittels '<img src='/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />' |
|
97 können Sie nach jeder Spalte auf- bzw. absteigend sortieren</td></tr> |
|
98 <tr><td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' ermöglicht das Filtern nach ausgewählten Spalten der Liste</td></tr> |
|
99 <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Raum-Arbeitsplatztyp</td></tr>\n"; |
|
100 echo "</table>\n"; |
|
101 |
|
102 $ranz = $dbc -> querySingleItem("SELECT @anz"); |
|
103 printf ("<p>Es wurden %s Räume gefunden.</p>", $ranz); |
|
104 |
|
105 if (isset($fnum) && $fnum>1 && !$filter && !$subf) |
|
106 { |
|
107 // Formular anzeigen fuer Filterbegriff |
|
108 $text = $fields[$fnum]; |
|
109 $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows |
|
110 echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n"; |
|
111 echo "<input type='hidden' name='s' value='$sort'>"; |
|
112 echo "<input type='hidden' name='d' value='$dir'>"; |
|
113 echo "<input type='hidden' name='f' value='$fnum'>"; |
|
114 echo "<table width=\"40%\" border=\"0\">\n"; |
|
115 echo "<tr><td>filtern nach $text: </td>"; |
|
116 echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\"/></td>"; |
|
117 echo "<td>Zeilen/Seite? <select name='z'>\n"; |
|
118 foreach ($azeil as $key=>$val) |
|
119 { |
|
120 if ($key == $zeil) $select = "selected"; else $select = ""; |
|
121 echo "<option $select value='$key'>$val</option>\n"; |
|
122 } |
|
123 echo "</select></td>\n"; |
|
124 echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n"; |
|
125 echo "</form>\n"; |
|
126 echo "<p> </p>\n"; |
|
127 } |
|
128 echo "<table>\n"; |
|
129 |
|
130 if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n"; |
|
131 |
|
132 // Listenkopf generieren |
|
133 echo "<tr bgcolor='#68ACBF'>"; |
|
134 tab_column(2,"Haus",$sort,$dir,2,$fnum,$filter,$start,$zeil); |
|
135 tab_column(3,"Raum-Nr.",$sort,$dir,3,$fnum,$filter,$start,$zeil); |
|
136 tab_column(4,"Bezeichnung",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
137 tab_column(5,"Arbplatz-Typ",$sort,$dir,5,$fnum,$filter,$start,$zeil); |
|
138 tab_column(6,"Arbplatz-Typ-Bez.",$sort,$dir,6,$fnum,$filter,$start,$zeil); |
|
139 tab_column(7,"Raum-Typ",$sort,$dir,7,$fnum,$filter,$start,$zeil); |
|
140 tab_column(8,"Raum-Typ_bez.",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
141 echo "<th> </th></tr>\n"; |
|
142 |
|
143 // echo "<tr bgcolor='#68ACBF'><th>Raum-Nr.</th><th>Bezeichnung</th><th>Haus</th><th>Typ</th><th>Fläche (m<sup>2</sup>)</th><th>Raumplan</th><th> </th> |
|
144 // </tr>\n"; |
|
145 foreach ($result as $row) |
|
146 { |
|
147 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
148 echo "<tr bgcolor='" . $bg . "'>"; |
|
149 echo "<td>$row->geb_ID</td>"; |
|
150 echo "<td class='left'>$row->raum_nr</td>"; |
|
151 echo "<td>$row->raum_name</td>"; |
|
152 echo "<td>". str_replace("; ","<br />",$row->arbplatz_typ)."</td>"; |
|
153 echo "<td>". str_replace("; ","<br />",$row->arbplatz_typ_bez)."</td>"; |
|
154 echo "<td>$row->raumtyp_ID</td>"; |
|
155 echo "<td>$row->raumtyp_bez</td>"; |
|
156 echo "<td><a href='/fhiiqm/raum_aptyp_ed.php?i=$row->raum_ID'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n"; |
|
157 } |
|
158 echo "</table></div>\n"; |
|
159 |
|
160 echo "<br /> "; |
|
161 |
|
162 // Sortierung und Filter aus $_GET fuer weitere Seiten |
|
163 foreach ($_GET as $key=>$val) |
|
164 { |
|
165 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
166 } |
|
167 // Sortierung und Filter aus $_POST fuer weitere Seiten |
|
168 if ($subf) |
|
169 foreach ($_POST as $key=>$val) |
|
170 { |
|
171 if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val; |
|
172 if ($key == "filter") $liste .= "&b=" . $val; |
|
173 } |
|
174 |
|
175 // Links auf andere Seiten generieren |
|
176 liste_links($start,$zeil,$ranz,$liste); |
|
177 |
|
178 // Export csv-Datei |
|
179 // echo " <span class='sc'><a href='/fhiiqm/raum_list_csv.php?s=$sort&d=$dir&f=$fnum&b=$filter&st=$start&z=$zeil'> |
|
180 // <img src='/fhiiqm/img/file_extension_xls.png' border='0' title='Export dieser Auswahl nach Excel(csv)' /></a></span>"; |
|
181 |
|
182 } |
|
183 else |
|
184 { |
|
185 if ($dbc -> error) |
|
186 echo "error: " . $dbc -> error . "<br />\n"; |
|
187 else |
|
188 { |
|
189 echo "<p class='red'> Leider nichts gefunden für ". $fields["$fnum"] . " wie '$filter'!</p><br />"; |
|
190 echo " <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Raumliste\">Raumliste</a></p>\n"; |
|
191 } |
|
192 |
|
193 } |
|
194 $dbc -> close(); |
|
195 /* |
|
196 if (!is_null($_SESSION["recht"]) && in_array("re",$_SESSION["recht"])) |
|
197 echo "<p> <a href=\"raum_ins.php\" target=\"_self\" title=\"Raum erfassen\" class=\"sc\">Weiteren Raum erfassen</a></p>\n"; |
|
198 */ |
|
199 ?> |
|
200 </body> |
|
201 </html> |