|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 12/2011 |
|
6 */ |
|
7 |
|
8 error_reporting(E_ALL ^ E_NOTICE); |
|
9 |
|
10 session_start(); |
|
11 if (! isset($_SESSION["userid"])) |
|
12 { |
|
13 include_once ("inc/func_lib.inc.php"); |
|
14 login($_SERVER["PHP_SELF"]); |
|
15 exit; |
|
16 } |
|
17 |
|
18 if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("lr",$_SESSION["recht"]) && !in_array("le",$_SESSION["recht"]))) |
|
19 { |
|
20 header("Location: start.php"); |
|
21 exit; |
|
22 } |
|
23 |
|
24 include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php"); |
|
25 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
26 |
|
27 |
|
28 $la = $_POST["la"]; |
|
29 $laid = $_GET["i"]; |
|
30 $copy = $_GET["c"]; |
|
31 $sub = $_POST["eintragen"]; |
|
32 $del = $_POST["del"]; |
|
33 $dup = $_POST["dup"]; |
|
34 if (!$dup) $dup = $_GET["d"]; |
|
35 $ok = $_POST["ok"]; |
|
36 if (!$la['okn']) $ok=false; |
|
37 $duptext=""; |
|
38 |
|
39 if ($dup) |
|
40 { // Anlage duplizieren |
|
41 include_once ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/func_lib.inc.php"); |
|
42 $tab = "Laser"; |
|
43 $key = "las_ID"; |
|
44 $val = $laid; |
|
45 // $ret=1; |
|
46 $ret = duplicate_record ($tab, $key, $val); |
|
47 if ($ret) |
|
48 { |
|
49 $laid=$ret; |
|
50 $addr = $_SERVER["PHP_SELF"] . "?i=$laid&c=1"; |
|
51 header("Location: $addr"); |
|
52 exit; |
|
53 } |
|
54 else $duptext = " - Fehler beim Duplizieren von ". $al["bez"]; |
|
55 } |
|
56 |
|
57 ?> |
|
58 |
|
59 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
60 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
61 |
|
62 <head> |
|
63 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
64 <link type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" media="screen"/> |
|
65 <link type="text/css" href="/fhiiqm/css/db_print.css" rel="Stylesheet" media="print"/> |
|
66 <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" /> |
|
67 <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.6.2.min.js"></script> |
|
68 <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.16.custom.min.js"></script> |
|
69 <title>Laser</title> |
|
70 </head> |
|
71 |
|
72 <body> |
|
73 |
|
74 <?php |
|
75 echo " "; |
|
76 echo "<div class=\"float-br smaller\" valign='top'>"; |
|
77 echo " user: " . $_SESSION["userid"]; |
|
78 echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
79 echo "<div class=\"float-r\"><img src=\"img/laser.png\" border=\"0\" alt=\"Laser\" title=\"Laser\"/></div>\n"; |
|
80 ?> |
|
81 |
|
82 <div align='center'> |
|
83 |
|
84 <script> |
|
85 $(document).ready(function() { |
|
86 $("#lbez").focus(); |
|
87 $("#persknr").autocomplete({ |
|
88 source: "/fhiiqm/inc/ma_list_ac.inc.php", |
|
89 minLength: 2, |
|
90 select: function(event,ui){$("#pid").val(ui.item.id);} |
|
91 }); |
|
92 $("input").persknr("long20").addClass("long20"); |
|
93 }); |
|
94 </script> |
|
95 |
|
96 <?php |
|
97 // print_r($al); |
|
98 |
|
99 if ($laid) $text = "editieren"; else $text = "erfassen"; |
|
100 if ($copy) $duptext = " (Kopie)"; |
|
101 echo "<h3>Laser $text$duptext<h3>"; |
|
102 |
|
103 echo "</div>\n"; |
|
104 |
|
105 if (!$ok || (!$sub && !$del && !$dup)) |
|
106 { |
|
107 if ($laid && (!$sub || !$del) && !isset($al)) |
|
108 { // update |
|
109 $sql = "SELECT las_ID, las_bez, las_welle_von, las_welle_bis, |
|
110 las_art_ID, las_klasse_ID, las_typ_ID, leistung, einheit_leistung, |
|
111 apertur, einheit_apertur, energie, einheit_energie, frequenz, einheit_frequenz, |
|
112 impulsbreite, einheit_impulsbreite, l.las_hersteller_ID, schutzst_ID, |
|
113 l.aktiv, l.persknr, l.raum_ID, geb_ID, las_info, |
|
114 CONCAT(nachname,', ',vorname) AS vname, las_hersteller_bez |
|
115 FROM fhiiqm.Laser l LEFT OUTER JOIN fhiiqm.Mitarbeiter m |
|
116 ON l.persknr=m.persknr LEFT OUTER JOIN fhiiqm.Laser_Hersteller h |
|
117 ON l.las_hersteller_ID=h.las_hersteller_ID LEFT OUTER JOIN fhiiqm.Raum r |
|
118 ON l.raum_ID=r.Raum_ID |
|
119 WHERE las_ID = $laid"; |
|
120 if ($result = $dbc -> queryObjectArray($sql)) |
|
121 { |
|
122 foreach ($result as $row) |
|
123 { |
|
124 $la["lbez"] = $row->las_bez; |
|
125 $la['wvon'] = $row->las_welle_von; |
|
126 $la['wbis'] = $row->las_welle_bis; |
|
127 $la["lart"] = $row->las_art_ID; |
|
128 $la['lkla'] = $row->las_klasse_ID; |
|
129 $la['ltyp'] = $row->las_typ_ID; |
|
130 $la['leist'] = $row->leistung; |
|
131 $la["apt"] = $row->apertur; |
|
132 $la["eapt"] = $row->einheit_apertur; |
|
133 $la["eng"] = $row->energie; |
|
134 $la["eeng"] = $row->einheit_energie; |
|
135 $la["efrq"] = $row->frequenz; |
|
136 $la["efrq"] = $row->einheit_frequenz; |
|
137 $la["ipb"] = $row->impulsbreite; |
|
138 $la["eipb"] = $row->einheit_impulsbreite; |
|
139 $la["akt"] = $row->aktiv; |
|
140 $la["hstid"] = $row->las_hersteller_ID; |
|
141 $la["suid"] = $row->schutzst_ID; |
|
142 $la["persknr"] = $row->vname; |
|
143 $la["pid"] = $row->persknr; |
|
144 $la["geb"] = $row->geb->ID; |
|
145 $la["raum"] = $row->raum_ID; |
|
146 $la["linfo"] = $row->las_info; |
|
147 |
|
148 } |
|
149 } |
|
150 } |
|
151 include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/laser_form.inc.php"); |
|
152 if ($sub || $del) |
|
153 { |
|
154 if ($sub) |
|
155 $frage = "Alle Angaben ok?"; |
|
156 elseif ($del) |
|
157 $frage = "Laser wirklich löschen?"; |
|
158 echo "<tr> |
|
159 <td class=\"red\" valign=\"top\" align=\"left\">$frage</td> |
|
160 <td><input type=\"checkbox\" name=\"ok\" value=\"1\""; |
|
161 if ($ok) echo "checked"; |
|
162 echo "></td>\n</tr>\n"; |
|
163 } |
|
164 if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"])) |
|
165 { |
|
166 echo " |
|
167 <tr><td> </td>\n |
|
168 <td><input class=\"button\" type=\"submit\" name=\"eintragen\" value=\" eintragen \" />"; |
|
169 if ($laid) |
|
170 { |
|
171 echo " <input class=\"buttonr\" type=\"submit\" value=\"löschen\" name=\"del\" title=\"delete\" />"; |
|
172 echo " <input class=\"button\" type=\"submit\" value=\"duplizieren\" name=\"dup\" title=\"delete\" />"; |
|
173 } |
|
174 echo "</td></tr>\n"; |
|
175 } |
|
176 echo "</table>\n"; |
|
177 echo "</div>\n"; |
|
178 if (!is_null($_SESSION["recht"]) && !in_array("le", $_SESSION["recht"])) |
|
179 echo "<p class='sc'> <a href=\"laser_flist.php\" target=\"_self\" title=\"Laser\">« zur Laserliste</a></p>\n"; |
|
180 echo "</form>\n"; |
|
181 |
|
182 |
|
183 } |
|
184 else |
|
185 { |
|
186 echo "speichern"; |
|
187 } |
|
188 ?> |
|
189 </body> |
|
190 </html> |