|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 11/2012 |
|
6 * |
|
7 * Telefonliste ohne Anmeldung |
|
8 * |
|
9 * $_GET["e"] = 1, ='editieren', muss gesetzt sein |
|
10 * |
|
11 */ |
|
12 |
|
13 error_reporting(E_ALL ^ E_NOTICE); |
|
14 |
|
15 if (isset($_GET["i"]) && $_GET["i"]) $edit = $_GET["i"]; // wegen tab_column, "i" als "e" missbraucht -> editieren ermoeglichen |
|
16 if (!$edit) $edit = $_GET["e"]; |
|
17 if (!$edit) $edit = $_POST["e"]; |
|
18 if (isset($edit)) |
|
19 { |
|
20 session_start(); |
|
21 if (! isset($_SESSION["userid"])) |
|
22 { |
|
23 include_once ("inc/func_lib.inc.php"); |
|
24 login($_SERVER["PHP_SELF"]); |
|
25 exit; |
|
26 } |
|
27 |
|
28 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("fmr",$_SESSION["recht"]) && !in_array("fme",$_SESSION["recht"]) |
|
29 && !in_array("ddr",$_SESSION["recht"]) && !in_array("dde",$_SESSION["recht"]))) |
|
30 { |
|
31 header("Location: start.php"); |
|
32 exit; |
|
33 } |
|
34 } |
|
35 ?> |
|
36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
37 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
38 |
|
39 <head> |
|
40 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
41 <link href="http://achilleus.rz-berlin.mpg.de/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> |
|
42 <link href="http://achilleus.rz-berlin.mpg.de/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> |
|
43 |
|
44 <title>MA-Telefonliste</title> |
|
45 </head> |
|
46 |
|
47 <body onload="document.ffilter.filter.focus();"> |
|
48 |
|
49 <?php |
|
50 if (isset($edit)) |
|
51 { |
|
52 echo " "; |
|
53 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
54 echo " user: " . $_SESSION["userid"]; |
|
55 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
56 echo "<div class=\"float-r\"><img src=\"img/group.png\" border=\"0\" alt=\"Telefonliste\" title=\"Telefonliste\"/></div>\n"; |
|
57 } |
|
58 |
|
59 // Felder, nach denen gefiltert werden kann |
|
60 $fields = array(2=>"Name",3=>"Vorname",5=>"Abteilung",6=>"Telefon/Fax",9=>"Haus", 10=>"Raum"); |
|
61 // $fieldf = array(2=>"trim(nachname)",3=>"vorname",5=>"abt_name",6=>"mt.telefon_nr",9=>"geb_ID", 10=>"raum_nr"); |
|
62 $fieldf = array(2=>"name",3=>"vorname",5=>"abt_name",6=>"telefon_nr",9=>"geb_ID", 10=>"raum_nr"); |
|
63 |
|
64 $sort = $_GET["s"]; // Sortierung nach Spalte |
|
65 if (!isset($sort) && !$sort) $sort = $_POST["s"]; |
|
66 |
|
67 $dir = $_GET["d"]; // Sortierrichtung |
|
68 if (!isset($dir) && !$dir) $dir = $_POST["d"]; |
|
69 |
|
70 $fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird |
|
71 if (!isset($fnum) && !$fnum) $fnum = $_POST["f"]; |
|
72 |
|
73 $filter = $_POST["filter"]; |
|
74 if (!isset($filter) && !$filter) $filter = $_GET["b"]; |
|
75 |
|
76 $subf = $_POST["subf"]; // submit |
|
77 |
|
78 if (!isset($fnum) || !$fnum) $fnum = 1; |
|
79 if (!isset($filter) || !$filter) $filter = ""; |
|
80 if (!isset($sort) || !$sort) $sort = 2; // Name |
|
81 if (!$dir || $dir < "!") $dir = ""; |
|
82 // print_r ($_REQUEST); echo "<br /><br />"; |
|
83 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
84 include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
85 |
|
86 $dbc = new dbconnection(); |
|
87 /* |
|
88 $sql = "SELECT m.persknr, TRIM(nachname) as name, vorname, titel, abt_name, mt.telefon_nr, telefon_typ, public, geb_ID, raum_nr, email |
|
89 FROM Mitarbeiter m LEFT OUTER JOIN |
|
90 Abteilung a ON m.abt_tel=a.abt_ID LEFT OUTER JOIN |
|
91 MA_Telefon mt ON m.persknr=mt.persknr INNER JOIN |
|
92 Telefon t ON mt.telefon_nr=t.telefon_nr LEFT OUTER JOIN |
|
93 Raum r ON t.raum_ID = r.raum_ID |
|
94 WHERE aktiv>0 AND (m.abt_tel <> 7) |
|
95 UNION |
|
96 SELECT m.persknr, TRIM(nachname) as name, vorname, titel, IFNULL(rag_bez,'INF') as abt_name, mt.telefon_nr, telefon_typ, public, geb_ID, raum_nr, email |
|
97 FROM Mitarbeiter m LEFT OUTER JOIN |
|
98 MA_Telefon mt ON m.persknr=mt.persknr INNER JOIN |
|
99 Telefon t ON mt.telefon_nr=t.telefon_nr LEFT OUTER JOIN |
|
100 Raum r ON t.raum_ID = r.raum_ID LEFT OUTER JOIN |
|
101 MA_RaumArbGruppe ma ON m.persknr=ma.persknr LEFT OUTER JOIN |
|
102 RaumArb_Gruppe rag ON ma.rag_ID=rag.rag_ID |
|
103 WHERE aktiv>0 AND m.abt_tel=7"; |
|
104 */ |
|
105 $sql = "SELECT persknr, name, vorname, titel, abt_name, telefon_nr, telefon_typ, public, geb_ID, raum_nr, email FROM v_tel_list"; |
|
106 if ($filter) $wher = " WHERE " . $fieldf[$fnum] . " LIKE " . "'%$filter%'"; else $wher = ""; |
|
107 if ($sort == 2) $sort = "2, 3, 5"; |
|
108 if ($sort == 5) $sort = "5, 2, 3"; |
|
109 if ($sort) $ord = " ORDER BY $sort, 6"; // immer nach Telefon-Nr als 2. |
|
110 $sql .= $wher . $ord; |
|
111 // echo "sql = $sql<br /><br />"; |
|
112 $result = $dbc ->queryObjectArray($sql); |
|
113 |
|
114 if ($result) |
|
115 { |
|
116 $bg1 = "#F8F8F8"; |
|
117 $bg2 = "#DEDFE1"; |
|
118 $bg = "#FFFFFF"; |
|
119 $getp = "&s=$sort&d=$dir&f=$fnum&b=$filter"; // Parameter Listenanzeige |
|
120 |
|
121 echo "<div align='center'>\n"; |
|
122 echo "<p><b>Mitarbeiter - Telefonliste</b></p>\n"; |
|
123 |
|
124 echo "<table border='0' cellspacing='0'>\n"; |
|
125 echo "<tr><td class='bigger'>Mittels '<img src='http://achilleus.rz-berlin.mpg.de/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='http://achilleus.rz-berlin.mpg.de/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />' |
|
126 können Sie nach bestimmten Spalten auf- bzw. absteigend sortieren</td></tr> |
|
127 <tr><td class='bigger'>'<img src='http://achilleus.rz-berlin.mpg.de/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' ermöglicht das Filtern nach ausgewählten Spalten der Liste</td></tr> |
|
128 <tr><td class='bigger'>Rote Telefon-/Fax-Nummern sind nur intern erreichbar</td></tr>"; |
|
129 if ($edit) |
|
130 echo "<tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Angaben</tr>"; |
|
131 |
|
132 echo "</table><br />\n"; |
|
133 |
|
134 if (isset($fnum) && $fnum>1 && !$filter && !$subf) |
|
135 { |
|
136 // Formular anzeigen fuer Filterbegriff |
|
137 $text = $fields[$fnum]; |
|
138 $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows |
|
139 echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n"; |
|
140 echo "<input type='hidden' name='s' value='$sort'>"; |
|
141 echo "<input type='hidden' name='d' value='$dir'>"; |
|
142 echo "<input type='hidden' name='f' value='$fnum'>"; |
|
143 echo "<input type='hidden' name='e' value='$edit'>"; |
|
144 echo "<table width=\"45%\" border=\"0\">\n"; |
|
145 echo "<tr><td>filtern nach $text: </td>"; |
|
146 echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\"/></td>"; |
|
147 /* |
|
148 echo "<td>Zeilen/Seite? <select name='z'>\n"; |
|
149 foreach ($azeil as $key=>$val) |
|
150 { |
|
151 if ($key == $zeil) $select = "selected"; else $select = ""; |
|
152 echo "<option $select value='$key'>$val</option>\n"; |
|
153 } |
|
154 echo "</select></td>\n"; |
|
155 */ |
|
156 echo "<td><input class=\"button\" type=\"hidden\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n"; |
|
157 echo "</form>\n"; |
|
158 echo "<p> </p>\n"; |
|
159 } |
|
160 echo "<table width='55%'>\n"; |
|
161 |
|
162 if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td></tr>\n"; |
|
163 |
|
164 // Listenkopf generieren |
|
165 echo "<tr bgcolor='#68ACBF'>"; |
|
166 tab_column(2,"Name",$sort,$dir,2,$fnum,$filter,$start,$zeil,$edit); |
|
167 tab_column(3,"Vorname",$sort,$dir,3,$fnum,$filter,$start,$zeil,$edit); |
|
168 tab_column(5,"Abteilung",$sort,$dir,5,$fnum,$filter,$start,$zeil,$edit); |
|
169 tab_column(6,"Telefon/Fax",$sort,$dir,6,$fnum,$filter,$start,$zeil,$edit); |
|
170 tab_column(9,"Haus",$sort,$dir,9,$fnum,$filter,$start,$zeil,$edit); |
|
171 tab_column(10,"Raum",$sort,$dir,10,$fnum,$filter,$start,$zeil,$edit); |
|
172 if ($edit && !is_null($_SESSION["recht"]) && in_array("fme", $_SESSION["recht"])) |
|
173 echo "<th> </th>"; |
|
174 echo "</tr>\n"; |
|
175 foreach ($result as $row) |
|
176 { |
|
177 if ($row->persknr != $vpnr) |
|
178 { |
|
179 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
180 $titel = ($row->titel)? ", $row->titel" : "" ; |
|
181 $email = ($row->email)? "<a href='mailto:$row->email'>$row->name$titel</a>" : "$row->name$titel"; |
|
182 echo "<tr bgcolor='" . $bg . "'><td >$email</td>"; |
|
183 echo "<td>$row->vorname</td>"; |
|
184 echo "<td>$row->abt_name</td>"; |
|
185 // echo "<td class=\"left\">$row->telnr " . ($row->telefon_typ == 'fax')? ", " . strtoupper($row->telefon_typ) : "" . "</td>"; |
|
186 $ttyp = ($row->telefon_typ == 'fax')? " " . strtoupper($row->telefon_typ) : ""; |
|
187 $rot = ($row->public)? "" : " class=\"red\""; |
|
188 echo "<td$rot>$row->telefon_nr $ttyp</td>"; |
|
189 echo "<td>$row->geb_ID</td>"; |
|
190 echo "<td>$row->raum_nr</td>"; |
|
191 if ($edit && !is_null($_SESSION["recht"]) && in_array("fme", $_SESSION["recht"])) |
|
192 echo "<td><a href='/fhiiqm/ma_tel_ed.php?i=$row->persknr$getp'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>"; |
|
193 echo "</tr>\n"; |
|
194 } |
|
195 else |
|
196 { |
|
197 echo "<tr bgcolor='" . $bg . "'><td colspan='3'> </td>"; |
|
198 $ttyp = ($row->telefon_typ == 'fax')? " " . strtoupper($row->telefon_typ) : ""; |
|
199 $rot = ($row->public)? "" : " class=\"red\""; |
|
200 echo "<td$rot>$row->telefon_nr $ttyp</td>"; |
|
201 echo "<td>$row->geb_ID</td>"; |
|
202 echo "<td>$row->raum_nr</td>"; |
|
203 if ($edit && !is_null($_SESSION["recht"]) && in_array("fme", $_SESSION["recht"])) |
|
204 echo "<td> </td>"; |
|
205 echo "</tr>\n"; |
|
206 } |
|
207 $vpnr = $row->persknr; |
|
208 } |
|
209 echo "</table></div>\n"; |
|
210 |
|
211 } |
|
212 else |
|
213 { |
|
214 echo "<div align=center>"; |
|
215 if ($dbc -> error) |
|
216 echo "error: " . $dbc -> error . "<br />\n"; |
|
217 else |
|
218 { |
|
219 echo "<p class='red'> Leider nichts gefunden für ". $fields["$fnum"] . " wie '$filter'!</p><br />"; |
|
220 echo " <a href=\"" . $_SERVER["PHP_SELF"] . "?$edit\" target=\"_self\" title=\"Telefonliste\" class=\"sc\">Telefonliste</a></p>\n"; |
|
221 } |
|
222 echo "</div>"; |
|
223 } |
|
224 |
|
225 ?> |
|
226 </body> |
|
227 </html> |