|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 01/2012 |
|
6 * |
|
7 * Laser-Liste |
|
8 */ |
|
9 |
|
10 error_reporting(E_ALL ^ E_NOTICE); |
|
11 |
|
12 session_start(); |
|
13 if (! isset($_SESSION["userid"])) |
|
14 { |
|
15 include_once ("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("lr",$_SESSION["recht"]) && !in_array("le",$_SESSION["recht"]))) |
|
21 { |
|
22 header("Location: start.php"); |
|
23 exit; |
|
24 } |
|
25 |
|
26 include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php"); |
|
27 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
28 |
|
29 ?> |
|
30 |
|
31 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
32 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
33 |
|
34 <head> |
|
35 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
36 <link type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" media="screen"/> |
|
37 <link type="text/css" href="/fhiiqm/css/db_print.css" rel="Stylesheet" media="print"/> |
|
38 <title>Liste Laser</title> |
|
39 </head> |
|
40 |
|
41 <body onload="document.ffilter.filter.focus();"> |
|
42 |
|
43 <?php |
|
44 echo " "; |
|
45 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
46 echo " user: " . $_SESSION["userid"]; |
|
47 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
48 echo "<div class=\"float-r\"><img src=\"img/laser.png\" border=\"0\" alt=\"Laser\" title=\"Laser\"/></div>\n"; |
|
49 |
|
50 // Felder, nach denen gefiltert werden kann |
|
51 $fields = array(2=>"ID",3=>"Bezeichnung",4=>"Art",5=>"Klasse",6=>"Typ",7=>"Schutzstufe",8=>"Hersteller",9=>"'in Betrieb'", |
|
52 10=>"Haus",11=>"Raum-Nr.",12=>"Verantwortlicher",13=>"Referenz-ID"); |
|
53 |
|
54 $zeil = $_GET["z"]; |
|
55 if (!$zeil) $zeil = $_POST["z"]; |
|
56 if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen |
|
57 $start = $_GET["st"]; |
|
58 if (!$start) $start=0; |
|
59 |
|
60 $sort = $_GET["s"]; // Sortierung nach Spalte |
|
61 if (!isset($sort) && !$sort) $sort = $_POST["s"]; |
|
62 |
|
63 $dir = $_GET["d"]; // Sortierrichtung |
|
64 if (!isset($dir) && !$dir) $dir = $_POST["d"]; |
|
65 |
|
66 $fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird |
|
67 if (!isset($fnum) && !$fnum) $fnum = $_POST["f"]; |
|
68 |
|
69 $filter = $_POST["filter"]; |
|
70 if (!isset($filter) && !$filter) $filter = $_GET["b"]; |
|
71 |
|
72 $subf = $_POST["subf"]; // submit |
|
73 |
|
74 if (!isset($fnum) && !$fnum) $fnum = 1; |
|
75 if (!isset($filter) && !$filter) $filter = ""; |
|
76 if (!isset($sort) && !$sort) $sort = 2; |
|
77 if (!isset($dir) && !$dir) $dir = ""; |
|
78 |
|
79 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
80 |
|
81 // Filter 'aktiv' |
|
82 if ($fnum == 9) |
|
83 { |
|
84 if ($filter == "ja") $filter = "1"; |
|
85 elseif ($filter == "nein") $filter = "0"; |
|
86 else $filter = ""; |
|
87 } |
|
88 $sql = "CALL laser_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz,@anzpl);"; |
|
89 // Parameter: Nr. Sortfeld, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Startsatz(0), Anzahl zu liefernde DS, Anzahl gefundener Laser |
|
90 $result = $dbc ->queryObjectArray($sql); |
|
91 |
|
92 if ($result) |
|
93 { |
|
94 $bg1 = "#F8F8F8"; |
|
95 $bg2 = "#DEDFE1"; |
|
96 $bg = "#FFFFFF"; |
|
97 |
|
98 echo "<div align='center'>\n"; |
|
99 echo "<p><b>Laser</b></p>\n"; |
|
100 |
|
101 echo "<table border='0' cellspacing='0'>\n"; |
|
102 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' />' |
|
103 können Sie nach relevanten Spalten auf- bzw. absteigend sortieren</td></tr> |
|
104 <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> |
|
105 <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten "; |
|
106 if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"])) |
|
107 echo ", '<img src='/fhiiqm/img/duplicate.gif' border='0' hight='11'>' - Duplizieren"; |
|
108 echo " des Lasers</td></tr>\n"; |
|
109 echo "</table>\n"; |
|
110 |
|
111 $anz = $dbc -> querySingleItem("SELECT @anz"); |
|
112 $anzpl = $dbc -> querySingleItem("SELECT @anzpl"); |
|
113 |
|
114 printf ("<p>Anzahl Laser: %s, Anzahl physischer Laser: %s </p>", $anz, $anzpl); |
|
115 |
|
116 if (isset($fnum) && $fnum>1 && !$filter && !$subf) |
|
117 { |
|
118 // Formular anzeigen fuer Filterbegriff |
|
119 $text = $fields[$fnum]; |
|
120 echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n"; |
|
121 echo "<input type='hidden' name='s' value='$sort'>"; |
|
122 echo "<input type='hidden' name='d' value='$dir'>"; |
|
123 echo "<input type='hidden' name='f' value='$fnum'>"; |
|
124 echo "<table width=\"25%\" border=\"0\">\n"; |
|
125 echo "<tr><td>filtern nach $text: </td>"; |
|
126 echo "<td><input id='filter' name='filter' type=\"text\" size=\"10\" maxlength=\"30\" value=\"$filter\"/></td>"; |
|
127 |
|
128 echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n"; |
|
129 echo "</form>\n"; |
|
130 echo "<p> </p>\n"; |
|
131 } |
|
132 echo "<table width='99%'>\n"; |
|
133 |
|
134 if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n"; |
|
135 |
|
136 // Listenkopf generieren |
|
137 echo "<tr bgcolor='#68ACBF'>"; |
|
138 tab_column(2,"ID",$sort,$dir,2,$fnum,$filter,$start,$zeil); |
|
139 tab_column(13,"ref-ID",$sort,$dir,13,$fnum,$filter,$start,$zeil); |
|
140 tab_column(3,"Bezeichnung",$sort,$dir,3,$fnum,$filter,$start,$zeil); |
|
141 echo "<th>Welle</th>"; |
|
142 tab_column(4,"Art",$sort,$dir,4,$fnum,$filter,$start,$zeil); |
|
143 tab_column(6,"Typ",$sort,$dir,6,$fnum,$filter,$start,$zeil); |
|
144 tab_column(5,"Klasse",$sort,$dir,5,$fnum,$filter,$start,$zeil); |
|
145 tab_column(7,"Schutzst.",$sort,$dir,7,$fnum,$filter,$start,$zeil); |
|
146 tab_column(8,"Hersteller",$sort,$dir,8,$fnum,$filter,$start,$zeil); |
|
147 tab_column(9,"Betrieb",$sort,$dir,9,$fnum,$filter,$start,$zeil); |
|
148 tab_column(10,"Haus",$sort,$dir,10,$fnum,$filter,$start,$zeil); |
|
149 tab_column(11,"Raum",$sort,$dir,11,$fnum,$filter,$start,$zeil); |
|
150 tab_column(12,"Verantw.",$sort,$dir,12,$fnum,$filter,$start,$zeil); |
|
151 |
|
152 echo "<th> </th>"; |
|
153 if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"])) |
|
154 echo "<th> </th></tr>\n"; |
|
155 |
|
156 foreach ($result as $row) |
|
157 { |
|
158 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
159 echo "<tr bgcolor='" . $bg . "'><td>$row->las_ID</td>"; |
|
160 echo "<td>$row->las_ref_ID</td>"; |
|
161 echo "<td>$row->las_bez</td>"; |
|
162 echo "<td>" .str_replace(".",",",str_replace(".00","",$row->las_welle_von))." - ".str_replace(".",",",str_replace(".00","",$row->las_welle_bis))."</td>"; |
|
163 echo "<td>$row->las_art_bez</td>"; |
|
164 echo "<td>$row->las_typ_bez</td>"; |
|
165 echo "<td>$row->las_klasse_bez</td>"; |
|
166 echo "<td>$row->schutzst_bez</td>"; |
|
167 echo "<td>$row->las_hersteller_bez</td>"; |
|
168 echo "<td>"; echo ($row->aktiv) ? "ja" : "nein"; echo "</td>"; |
|
169 echo "<td>$row->geb_ID</td>"; |
|
170 echo "<td>$row->raum_nr</td>"; |
|
171 echo "<td>$row->vma</td>"; |
|
172 echo "<td><a href='/fhiiqm/laser_ed.php?i=$row->las_ID'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>"; |
|
173 if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"])) |
|
174 echo "<td><a href='/fhiiqm/laser_ed.php?i=$row->las_ID&d=1&c=1'><img src=\"/fhiiqm/img/duplicate.gif\" alt='duplizieren' title='duplizieren' border='0'/></a></td>"; |
|
175 } |
|
176 echo "</table></div>\n"; |
|
177 |
|
178 echo "<br /> "; |
|
179 |
|
180 // Sortierung und Filter aus $_GET fuer weitere Seiten |
|
181 foreach ($_GET as $key=>$val) |
|
182 { |
|
183 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
184 } |
|
185 // Sortierung und Filter aus $_POST fuer weitere Seiten |
|
186 if ($subf) |
|
187 foreach ($_POST as $key=>$val) |
|
188 { |
|
189 if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val; |
|
190 if ($key == "filter") $liste .= "&b=" . $val; |
|
191 } |
|
192 |
|
193 // Links auf andere Seiten generieren |
|
194 liste_links($start,$zeil,$panz,$liste); |
|
195 |
|
196 } |
|
197 else |
|
198 { |
|
199 if ($dbc -> error) |
|
200 echo "error: " . $dbc -> error . "<br />\n"; |
|
201 { |
|
202 echo "<p class='red'> Leider nichts gefunden für ". $fields["$fnum"] . " wie '$filter'!</p><br />"; |
|
203 echo " <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Laserliste\" class=\"sc\">Laserliste</a></p>\n"; |
|
204 } |
|
205 |
|
206 } |
|
207 $dbc -> close(); |
|
208 if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"])) |
|
209 echo "<p> <a href=\"/fhiiqm/laser_ed.php\" target=\"_self\" title=\"Laser erfassen\" class=\"sc\">Weiteren Laser erfassen</a></p>\n"; |
|
210 |
|
211 ?> |
|
212 </body> |
|
213 </html> |