|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 08/2012 |
|
6 * |
|
7 * Liste Infos |
|
8 */ |
|
9 |
|
10 error_reporting(E_ALL ^ E_NOTICE); |
|
11 header('Content-type: text/html; charset="iso-8859-1',true); |
|
12 |
|
13 session_start(); |
|
14 if (! isset($_SESSION["userid"])) |
|
15 { |
|
16 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/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("ir",$_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"]))) |
|
22 { |
|
23 header("Location: start.php"); |
|
24 exit; |
|
25 } |
|
26 |
|
27 echo " "; |
|
28 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
29 echo " user: " . $_SESSION["userid"]; |
|
30 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
31 echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/document_image_ver.png\" border=\"0\" alt=\"Infodaten\" title=\"Infodaten\"/></div>\n"; |
|
32 |
|
33 // Felder, nach denen gefiltert werden kann |
|
34 $fields = array(2=>"Titel",4=>"Info-Typ",5=>"Produkt",6=>"Adressat", 7=>"Verantwortlicher"); |
|
35 |
|
36 $zeil = $_GET["z"]; |
|
37 if (!$zeil) $zeil = $_POST["z"]; |
|
38 if (!$zeil) $zeil = 9999; // Anzahl der gezeigten Zeilen |
|
39 $start = $_GET["st"]; // Start bei DS $start+1 |
|
40 if (!$start) $start=0; |
|
41 |
|
42 $sort = $_GET["s"]; // Sortierung nach Spalte |
|
43 if (!isset($sort) && !$sort) $sort = $_POST["s"]; |
|
44 |
|
45 $dir = $_GET["d"]; // Sortierrichtung |
|
46 if (!isset($dir) && !$dir) $dir = $_POST["d"]; |
|
47 |
|
48 $fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird |
|
49 if (!isset($fnum) && !$fnum) $fnum = $_POST["f"]; |
|
50 |
|
51 $filter = $_POST["filter"]; |
|
52 if (!isset($filter) && !$filter) $filter = $_GET["b"]; |
|
53 |
|
54 $subf = $_POST["subf"]; // submit |
|
55 |
|
56 if (!isset($fnum) || !$fnum) $fnum = 1; |
|
57 if (!isset($filter) || !$filter) $filter = ""; |
|
58 if (!isset($sort) || !$sort) $sort = 15; // Kennzeichen |
|
59 if (!$dir || $dir < "!") $dir = ""; |
|
60 // print_r ($_GET); echo "<br /><br />"; |
|
61 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
62 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
63 |
|
64 $dbc = new dbconnection(); |
|
65 |
|
66 $sql = "CALL info_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz);"; |
|
67 // Parameter: Nr. Sortfeld, Sortierrichtung, Nr. Filterfeld, Filterbegriff, (StartNr DS) -1, Anzahl Zeilen=DS, Anzahl gefundener Raeume |
|
68 // liefert: info_ID, iname, ilong, ityp, prod, adressat, author, idate, bdate, edate, lang, doc, infrel, infsort, ityp_ID, raum_ID, geb_ID, al_bez |
|
69 // echo "sql = $sql<br />"; |
|
70 $result = $dbc ->queryObjectArray($sql); |
|
71 |
|
72 if ($result) |
|
73 { |
|
74 $bg1 = "#F8F8F8"; |
|
75 $bg2 = "#DEDFE1"; |
|
76 $bg = "#FFFFFF"; |
|
77 |
|
78 echo "<div align='center'>\n"; |
|
79 echo "<p><b>Liste der Informationen</b></p>\n"; |
|
80 /* |
|
81 echo "<table border='0' cellspacing='0'>\n"; |
|
82 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' />' |
|
83 können Sie nach bestimmten Spalten auf- bzw. absteigend sortieren</td></tr> |
|
84 <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> |
|
85 <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten , |
|
86 '<img src='/fhiiqm/img/duplicate.gif' border='0' hight='11'>' - Duplizieren der Infodaten |
|
87 </td></tr>\n"; |
|
88 echo "</table>\n"; |
|
89 */ |
|
90 $ianz = $dbc -> querySingleItem("SELECT @anz"); |
|
91 printf ("<p>Anzahl gefundener Informationen: %s</p>", $ianz); |
|
92 |
|
93 if (isset($fnum) && $fnum>1 && !$filter && !$subf) |
|
94 { |
|
95 // Formular anzeigen fuer Filterbegriff |
|
96 $text = $fields[$fnum]; |
|
97 $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows |
|
98 echo "<form action='" . $_SERVER['PHP_SELF'] . "#tab_2' method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n"; |
|
99 echo "<input type='hidden' name='s' value='$sort'>"; |
|
100 echo "<input type='hidden' name='d' value='$dir'>"; |
|
101 echo "<input type='hidden' name='f' value='$fnum'>"; |
|
102 echo "<table width=\"45%\" border=\"0\">\n"; |
|
103 echo "<tr><td>filtern nach $text: </td>"; |
|
104 echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\"/></td>"; |
|
105 echo "<td>Zeilen/Seite? <select name='z'>\n"; |
|
106 foreach ($azeil as $key=>$val) |
|
107 { |
|
108 if ($key == $zeil) $select = "selected"; else $select = ""; |
|
109 echo "<option $select value='$key'>$val</option>\n"; |
|
110 } |
|
111 echo "</select></td>\n"; |
|
112 echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n"; |
|
113 echo "</form>\n"; |
|
114 echo "<p> </p>\n"; |
|
115 } |
|
116 echo "<table width='99%'>\n"; |
|
117 |
|
118 if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n"; |
|
119 |
|
120 // Listenkopf generieren |
|
121 echo "<tr bgcolor='#68ACBF'>"; |
|
122 echo "<th>ID</th>"; |
|
123 echo "<th>Kz</th>"; |
|
124 echo "<th>Titel</th>"; |
|
125 echo "<th>Kurzinfo</th>"; |
|
126 echo "<th>Info-Typ</th>"; |
|
127 echo "<th>Produkt</th>"; |
|
128 echo "<th>Adressat</th>"; |
|
129 echo "<th>Verantw.</th>"; |
|
130 echo "<th>Ort</th>"; |
|
131 echo "<th>Autor</th>"; |
|
132 echo "<th>erst. am</th>"; |
|
133 echo "<th>gilt ab</th>"; |
|
134 echo "<th>gilt bis</th>"; |
|
135 echo "<th>Status</th>"; |
|
136 /* tab_column(15,"Kz",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
137 tab_column(2,"Titel",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
138 tab_column(3,"Kurzinfo",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
139 tab_column(4,"Info-Typ",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
140 tab_column(5,"Produkt",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
141 tab_column(6,"Adressat",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
142 tab_column(7,"Verantw.",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
143 echo "<th>Ort</th>"; |
|
144 tab_column(8,"Autor",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
145 tab_column(9,"erst. am",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
146 tab_column(10,"gilt ab",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
147 tab_column(11,"gilt bis",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
148 */ |
|
149 // echo "<th>Sprache</th>"; |
|
150 // tab_column(12,"Status",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",0,"#ui-tabs-1","tabs_dyn_content.php"); |
|
151 echo "<th>Dokument</th>"; |
|
152 echo "<th>zu ID</th></tr>\n"; |
|
153 |
|
154 // 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> |
|
155 // </tr>\n"; |
|
156 // Format $row->prod: 'prod_name | prod_hier; prod_name | prod_hier; prod_name | prod_hier' |
|
157 foreach ($result as $row) |
|
158 { |
|
159 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
160 echo "<tr bgcolor='" . $bg . "'><td class=\"left\">$row->info_ID</td>"; |
|
161 echo "<td class=\"left\">$row->infsort</td>"; |
|
162 echo "<td class=\"left\">$row->iname</td>"; |
|
163 // if (strlen($row->ilong)>60) $row->ilong = substr($row->ilong,0,60)."..."; |
|
164 if ($row->ityp_ID == 81) $anl = " <b>→ '" . $row->al_bez . "'</b>"; else $anl=""; |
|
165 echo "<td class=\"left\">" . nl2br($row->ilong).$anl . "</td>"; |
|
166 echo "<td class=\"left\">$row->ityp</td>"; |
|
167 $prod = explode("; ",$row->prod); |
|
168 $prods = ""; |
|
169 foreach ($prod as $val) |
|
170 $prods .= "; " . substr($val,0,strpos($val,"|")-1); |
|
171 $prods = substr($prods,2); |
|
172 // echo "<td class=\"left\">" . str_replace(";",";<br />",$row->prod) . "</td>"; |
|
173 echo "<td class=\"left\">" . str_replace(";",";<br />",$prods) . "</td>"; |
|
174 echo "<td class=\"left\">" . str_replace(";","<br />",$row->adressat) . "</td>"; |
|
175 echo "<td class=\"left\">" . str_replace(";","<br />",$row->verantw) . "</td>"; |
|
176 if ($row->ityp_ID == 7 || substr($row->ityp_ID,0,1) == 8) // 7 = Betriebsstörung, 8 = Betriebsanweisung |
|
177 { if ($row->raum_ID) |
|
178 { |
|
179 $sql = "SELECT geb_ID, raum_nr FROM Raum WHERE raum_ID = $row->raum_ID"; |
|
180 $res = $dbc -> queryObjectArray($sql); |
|
181 foreach ($res as $ro) |
|
182 echo "<td>$ro->geb_ID, $ro->raum_nr</td>"; |
|
183 } |
|
184 elseif ($row->geb_ID && !$row->raum_ID) |
|
185 echo "<td>$row->geb_ID</td>"; |
|
186 else echo "<td> </td>"; |
|
187 } |
|
188 else echo "<td> </td>"; |
|
189 echo "<td class=\"left\">$row->author</td>"; |
|
190 if ($row->idate) |
|
191 { |
|
192 $dat = new DateTime($row->idate); |
|
193 echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>"; |
|
194 } |
|
195 else echo "<td> </td>"; |
|
196 if ($row->bdate) |
|
197 { |
|
198 $dat = new DateTime($row->bdate); |
|
199 echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>"; |
|
200 } |
|
201 else echo "<td> </td>"; |
|
202 if ($row->edate) |
|
203 { |
|
204 $dat = new DateTime($row->edate); |
|
205 echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>"; |
|
206 } |
|
207 else echo "<td> </td>"; |
|
208 // echo "<td class=\"left\">$row->lang</td>"; |
|
209 echo "<td class=\"left\">$row->freigabe</td>"; |
|
210 if (file_exists("infos/".$row->doc)) |
|
211 { |
|
212 $doc = substr($row->doc,strpos($row->doc,"_")+1); |
|
213 echo "<td class=\"left\"><a href=\"infos/$row->doc\">$doc</td>"; |
|
214 } |
|
215 else |
|
216 echo "<td class=\"left\">$row->doc</td>"; |
|
217 echo "<td class=\"left\">$row->infrel</td>"; |
|
218 echo "</tr>\n"; |
|
219 } |
|
220 echo "</table></div>\n"; |
|
221 |
|
222 echo "<br /> "; |
|
223 |
|
224 // Sortierung und Filter aus $_GET fuer weitere Seiten |
|
225 foreach ($_GET as $key=>$val) |
|
226 { |
|
227 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
228 } |
|
229 // Sortierung und Filter aus $_POST fuer weitere Seiten |
|
230 if ($subf) |
|
231 foreach ($_POST as $key=>$val) |
|
232 { |
|
233 if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val; |
|
234 if ($key == "filter") $liste .= "&b=" . $val; |
|
235 } |
|
236 |
|
237 // Links auf andere Seiten generieren |
|
238 liste_links($start,$zeil,$ianz,$liste,"#ui-tabs-1"); |
|
239 } |
|
240 else |
|
241 { |
|
242 if ($dbc -> error) |
|
243 echo "error: " . $dbc -> error . "<br />\n"; |
|
244 else |
|
245 { |
|
246 echo "<p class='red'> Leider nichts gefunden für ". $fields["$fnum"] . " wie '$filter'!</p><br />"; |
|
247 echo " <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Infoliste\" class=\"sc\">Infoliste</a></p>\n"; |
|
248 } |
|
249 |
|
250 } |
|
251 $dbc -> close(); |
|
252 |
|
253 if (!is_null($_SESSION["recht"]) && in_array("ie",$_SESSION["recht"])) |
|
254 echo "<p> <a href=\"info_ed.php\" target=\"_self\" title=\"Info erfassen\" class=\"sc\">Weitere Info erfassen</a></p>\n"; |
|
255 |
|
256 ?> |