|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 11/2012 |
|
6 * |
|
7 * Form Mitarbeiter/Objekte FHI |
|
8 */ |
|
9 |
|
10 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
11 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
12 $okn = true; |
|
13 if (!$ma) $ma['geb'] = 'A'; |
|
14 |
|
15 ?> |
|
16 <div align="center"> |
|
17 <h5>* - Felder sind erforderlich!</h5> |
|
18 </div> |
|
19 <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_ma"> |
|
20 <div align="center"> |
|
21 <table width="60%" border="0" cellspacing="3" cellpadding="3"> |
|
22 <tr> |
|
23 <td>Name *</td> |
|
24 <td><input name="ma[name]" type="text" size="30" maxlength="30" value="<?php echo $ma['name']; ?>" /> |
|
25 <?php |
|
26 if (isset($ma['name']) && $ma['name']<'!') |
|
27 { |
|
28 echo "<br><span class=\"red\">Name ist erforderlich!</span>\n"; |
|
29 $okn = false; |
|
30 } |
|
31 ?> |
|
32 </td> |
|
33 </tr> |
|
34 <tr> |
|
35 <td>Vorname</td> |
|
36 <td><input name="ma[vname]" type="text" size="30" maxlength="30" value="<?php echo $ma['vname']; ?>" /> |
|
37 <?php |
|
38 /* if (isset($ma['vname']) && $ma['vname']<'!') |
|
39 { |
|
40 echo "<br><span class=\"red\">Vorname ist erforderlich!</span>\n"; |
|
41 $okn = false; |
|
42 } */ |
|
43 ?> |
|
44 </td> |
|
45 </tr> |
|
46 <tr> |
|
47 <td>Titel</td> |
|
48 <td><input name="ma[titel]" type="text" size="30" maxlength="30" value="<?php echo $ma['titel']; ?>" /></td> |
|
49 </tr> |
|
50 <tr><td>Ort</td> |
|
51 <td valign="top">Haus |
|
52 <select name="ma[geb]" onchange="this.form.submit();"> |
|
53 <?php |
|
54 if ($ma['geb'] == -1) $select = " selected "; else $select = ""; |
|
55 echo "<option $select value=\"-1\"></option>\n"; |
|
56 $sql = "SELECT geb_ID, geb_name FROM `fhiiqm`.`Haus` ORDER BY 1"; |
|
57 if ($result = $dbc->queryObjectArray($sql)) |
|
58 { |
|
59 foreach ($result as $row) |
|
60 { |
|
61 if ($row->geb_ID == $ma['geb']) |
|
62 echo "<option selected value=\"$row->geb_ID\">$row->geb_ID: $row->geb_name</option>\n"; |
|
63 else |
|
64 echo "<option value=\"$row->geb_ID\">$row->geb_ID: $row->geb_name</option>\n"; |
|
65 } |
|
66 } |
|
67 ?> |
|
68 </select> |
|
69 Raum |
|
70 <select name="ma[raum]"> |
|
71 <?php |
|
72 if ($ma['raum'] == -1) $select = " selected "; else $select = ""; |
|
73 echo "<option $select value=\"-1\"></option>\n"; |
|
74 $sql = "SELECT raum_ID, raum_nr, raum_name FROM `fhiiqm`.`Raum` WHERE geb_ID='" . $ma['geb'] ."' ORDER BY 2"; |
|
75 if ($result = $dbc->queryObjectArray($sql)) |
|
76 { |
|
77 foreach ($result as $row) |
|
78 { |
|
79 if ($row->raum_ID == $ma['raum']) |
|
80 echo "<option selected value=\"$row->raum_ID\">$row->raum_nr $row->raum_name</option>\n"; |
|
81 else |
|
82 echo "<option value=\"$row->raum_ID\">$row->raum_nr $row->raum_name</option>\n"; |
|
83 } |
|
84 } |
|
85 ?> |
|
86 </select> |
|
87 </td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td>Telefon</td> |
|
91 <td><div id="addtel"> |
|
92 <select name="ma[tel][]" size="1"> |
|
93 <?php |
|
94 $select = null; |
|
95 $select = ( "-1"==$ma['tel'][0] ) ? ' selected' : null; |
|
96 echo "<option $select value=\"-1\"></option>\n"; |
|
97 $sql = "SELECT telefon_nr,geb_ID,raum_nr, telefon_typ FROM fhiiqm.Telefon t |
|
98 LEFT OUTER JOIN Raum r ON t.raum_ID=r.Raum_ID |
|
99 ORDER BY telefon_nr |
|
100 "; |
|
101 if ($result = $dbc->queryObjectArray($sql)) |
|
102 { |
|
103 foreach ($result as $row) |
|
104 { |
|
105 if ($row->telefon_typ == "fax") $teln = $row->telefon_nr." FAX"; else $teln = $row->telefon_nr; |
|
106 if ($row->raum_nr) $telr = "[". $row->geb_ID. " ". $row->raum_nr . "]"; else $telr = ""; |
|
107 $select = ( $row->telefon_nr==$ma['tel'][0] ) ? ' selected' : null; |
|
108 echo "<option $select value=\"$row->telefon_nr\">$teln $telr</option>\n"; |
|
109 $tel .= "'".$row->telefon_nr. "':'" . $teln ." ". $telr. "',"; |
|
110 } |
|
111 } |
|
112 $tel = substr($tel,0,strlen($tel)-1); |
|
113 ?> |
|
114 </select> |
|
115 <script type="text/javascript"> |
|
116 <!-- |
|
117 arr = {<?php echo ($tel); ?>}; // Ergebnis: {key:'value',key:'value',...} |
|
118 //--> |
|
119 </script> |
|
120 oder neu <input name="ma[ntel][]" type="text" size="20" maxlength="20" value="<?php echo $ma['ntel'][0]; ?>" /> |
|
121 öffentlich <input name="ma[pub][]" type="checkbox" value="1" <?php if ($ma['pub'][0]) echo "checked"; ?> /> |
|
122 <a href="<?php echo "javascript:addInput('addtel');" ?>" title="weitere Telefon-Nr."><img src="/fhiiqm/img/add.png" /></a> |
|
123 <a href="<?php echo "javascript:delInput('addtel');" ?>" title="löschen letzte Telefon-Nr."><img src="/fhiiqm/img/delete.png" /></a><br /> |
|
124 <?php |
|
125 if (isset($ma) && (!$ok || $sub)) |
|
126 { |
|
127 if (count($ma['ntel'])>1 || count($ma['tel'])>1) |
|
128 { |
|
129 $i=0; |
|
130 foreach ($ma['tel'] as $atel) |
|
131 { |
|
132 if ($i>0) |
|
133 { |
|
134 echo "<select name=\"ma[tel][]\" size=\"1\">"; |
|
135 |
|
136 $select = ( "-1" == $atel ) ? ' selected' : null; |
|
137 echo "<option $select value=\"-1\"></option>\n"; |
|
138 foreach ($result as $row) |
|
139 { |
|
140 if ($row->telefon_typ == "fax") $teln = $row->telefon_nr." FAX"; else $teln = $row->telefon_nr; |
|
141 if ($row->raum_nr) $telr = "[". $row->geb_ID. " ". $row->raum_nr . "]"; else $telr = ""; |
|
142 $select = ( $row->telefon_nr == $atel ) ? ' selected' : null; |
|
143 echo "<option $select value=\"$row->telefon_nr\">$teln $telr</option>\n"; |
|
144 } |
|
145 echo "</select>"; |
|
146 echo " oder neu <input name=\"ma[ntel][]\" type=\"text\" size=\"20\" maxlength=\"20\" value=\"".$ma['ntel'][$i]."\" />"; |
|
147 echo " öffentlich <input name=\"ma[pub][$i]\" type=\"checkbox\" value=\"1\""; |
|
148 $check = ($ma['pub'][$i]) ? " checked" : "" ; |
|
149 echo "$check /><br />"; |
|
150 } |
|
151 $i++; |
|
152 } |
|
153 } |
|
154 } |
|
155 ?> |
|
156 </div> |
|
157 </td> |
|
158 </tr> |
|
159 <tr> |
|
160 <td>E-Mail</td> |
|
161 <td><input name="ma[email]" type="text" size="30" maxlength="100" value="<?php echo $ma['email']; ?>" /></td> |
|
162 </tr> |
|
163 <tr><td>Abteilung *</td> |
|
164 <td valign="top"> |
|
165 <select name="ma[abt]"> |
|
166 <?php |
|
167 $sql = "SELECT abt_ID, abt_name, abt_long FROM `fhiiqm`.`Abteilung` ORDER BY abt_ID+0"; |
|
168 if ($result = $dbc->queryObjectArray($sql)) |
|
169 { |
|
170 foreach ($result as $row) |
|
171 { |
|
172 if ($row->abt_ID == $ma['abt']) |
|
173 echo "<option selected value=\"$row->abt_ID\">$row->abt_name: $row->abt_long</option>\n"; |
|
174 else |
|
175 echo "<option value=\"$row->abt_ID\">$row->abt_name: $row->abt_long</option>\n"; |
|
176 } |
|
177 } |
|
178 ?> |
|
179 </select> |
|
180 Mitarbeiter FHI? <input name="ma[fhi]" type="checkbox" value="1" <?php if ($ma['fhi']) echo "checked"; ?> /> |
|
181 <input type="hidden" name="okn" value="<?php echo $okn; ?>" /> |
|
182 </td> |
|
183 </tr> |
|
184 <!-- |
|
185 </table> |
|
186 </div> |
|
187 </form> |
|
188 --> |