|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 10/2011 |
|
6 * |
|
7 * Form Rechtezuordnung |
|
8 */ |
|
9 |
|
10 |
|
11 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
12 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
|
13 $okn = true; |
|
14 |
|
15 if (!is_null($_SESSION["recht"]) && !in_array("rte",$_SESSION["recht"])) |
|
16 { |
|
17 $text = ""; |
|
18 $ro = " readonly='readonly'"; |
|
19 $da = " disabled='disabled'"; |
|
20 } |
|
21 else |
|
22 { |
|
23 if (!$pget) $text = "Eingabe"; else $text="Ändern / Löschen"; |
|
24 $ro = ""; |
|
25 $da = ""; |
|
26 } |
|
27 ?> |
|
28 <div align="center"> |
|
29 <h3><font face="Verdana, Arial, Helvetica, sans-serif"><?php echo $text;?> Nutzer & Rechte fhiiqm</font></h3> |
|
30 <h5>* - Felder sind erforderlich!</h5> |
|
31 <table> |
|
32 <tr><td class="bigger">Die Auswahl eines Mitarbeiters geschieht durch Eingeben von mindesten 2 Zeichen in das Mitarbeiter-Feld. |
|
33 </td></tr> |
|
34 <tr><td class="bigger"><div class="red">Achtung! </div>Umlaute wie 'ä', 'ü', 'ö', 'ß' werden nicht gefunden, bitte benachbarte Zeichen eingeben.</td></tr> |
|
35 <tr><td class="bigger"> </td></tr> |
|
36 </table> |
|
37 </div> |
|
38 <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_recht"> |
|
39 <div align="center"> |
|
40 <table width="30%" border="0" cellspacing="3" cellpadding="3"> |
|
41 <tr><td>Mitarbeiter *</td> |
|
42 <td valign="top"><input class="long20" type="text" name="rt[pers]" id="persknr" value="<?php echo $rt['pers'] . "\"" . $ro; ?>/> |
|
43 <?php |
|
44 if (isset($ins) && $rt['pid']<"1") |
|
45 { |
|
46 echo "<br /><span class=\"red\">Mitarbeiter ist erforderlich!</span>\n"; |
|
47 $okn = false; |
|
48 } |
|
49 else |
|
50 if ($okn) $okn = true; else $okn=false; |
|
51 ?> |
|
52 </td> |
|
53 </tr> |
|
54 <!-- |
|
55 <tr> |
|
56 <td>Mitarbeiter FHI *</td> |
|
57 <td> |
|
58 <select name="rt[pers]" size="10"> |
|
59 <?php |
|
60 /* $select = null; |
|
61 // $select = ("-1"==$rt['pers'] ) ? ' selected' : null; |
|
62 // echo "<option $select value=\"-1\"></option>\n"; |
|
63 $sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter ORDER BY 2"; |
|
64 if ($result = $dbc->queryObjectArray($sql)) |
|
65 { |
|
66 foreach ($result as $row) |
|
67 { |
|
68 if (isset($rt['pers'])) $select = ($row->persknr==$rt['pers'] ) ? ' selected' : null; |
|
69 echo "<option $select value=\"$row->persknr\">$row->pname</option>\n"; |
|
70 } |
|
71 } */ |
|
72 ?> |
|
73 </select> |
|
74 <?php |
|
75 /* if (isset($ins) && $rt['pers']<1) |
|
76 { |
|
77 echo "<br /><span class=\"red\">Mitarbeiter ist erforderlich!</span>\n"; |
|
78 $okn = false; |
|
79 } |
|
80 else |
|
81 if ($okn) $okn = true; else $okn=false; */ |
|
82 ?> |
|
83 </td> |
|
84 </tr> |
|
85 --> |
|
86 <tr> |
|
87 <td>Nutzername *</td> |
|
88 <td><input name="rt[userid]" type="text" size="10" maxlength="10" value="<?php echo $rt['userid'] . "\"" . $ro; ?>/> |
|
89 <?php |
|
90 if (isset($rt['userid']) && $rt['userid']<'!') |
|
91 { |
|
92 echo "<br><span class=\"red\">Nutzername(userid) ist erforderlich!</span>\n"; |
|
93 $okn = false; |
|
94 } |
|
95 else |
|
96 if ($okn) $okn = true; else $okn=false; |
|
97 ?> |
|
98 </td> |
|
99 </tr> |
|
100 <tr> |
|
101 <td>Rechte <br /><br /> |
|
102 <span class="green">Recht muß explizit gewählt werden</span><br /><br /> |
|
103 Mehrfachauswahl möglich:<br /> |
|
104 [Strg]-Taste + Anklicken der<br /> |
|
105 gewünschten Listeneinträge |
|
106 </td> |
|
107 <td> |
|
108 <select name="rt[recht][]" size="14" multiple="multiple"<?php echo $da; ?>> |
|
109 <?php |
|
110 // $select = null; |
|
111 // if (is_array($rt['recht'])) $select = in_array( "-1", $rt['recht'] ) ? ' selected' : null; |
|
112 // echo "<option $select value=\"-1\"></option>\n"; |
|
113 $sql = "SELECT recht_ID, thema FROM fhiiqm.recht ORDER BY 2"; |
|
114 if ($result = $dbc->queryObjectArray($sql)) |
|
115 { |
|
116 foreach ($result as $row) |
|
117 { |
|
118 if (is_array($rt['recht'])) $select = in_array( $row->recht_ID, $rt['recht'] ) ? ' selected' : null; |
|
119 echo "<option $select value=\"$row->recht_ID\">$row->thema</option>\n"; |
|
120 } |
|
121 } |
|
122 ?> |
|
123 </select> |
|
124 <?php |
|
125 /* if (isset($ins) && (count($rt["recht"])< 1) || (count($rt["recht"])==1 && $rt["recht"][0]== "-1")) |
|
126 { |
|
127 echo "<br><span class=\"red\">mindestens ein Recht ist erforderlich!</span>\n"; |
|
128 $okn = false; |
|
129 } |
|
130 else |
|
131 if ($okn) $okn = true; else $okn=false; |
|
132 */ |
|
133 ?> |
|
134 </td> |
|
135 </tr> |
|
136 <tr> |
|
137 <td>Rechteinschränkung Produktgruppe<br /><br /> |
|
138 <span class="green">nichts auswählen = alle Rechte</span><br /><br /> |
|
139 Mehrfachauswahl möglich |
|
140 </td> |
|
141 <td> |
|
142 <select name="rt[prodg][]" size="7" multiple="multiple"<?php echo $da; ?>> |
|
143 <?php |
|
144 $select = null; |
|
145 // if (is_array($rt['prodg'])) $select = in_array( "-1", $rt['prodg'] ) ? ' selected' : null; |
|
146 // echo "<option $select value=\"-1\"></option>\n"; |
|
147 $sql = "SELECT prod_group_ID, prod_group_name FROM fhiiqm.Produkt_Gruppe ORDER BY 2"; |
|
148 if ($result = $dbc->queryObjectArray($sql)) |
|
149 { |
|
150 foreach ($result as $row) |
|
151 { |
|
152 if (is_array($rt['prodg'])) $select = in_array( $row->prod_group_ID, $rt['prodg'] ) ? ' selected' : null; |
|
153 echo "<option $select value=\"$row->prod_group_ID\">$row->prod_group_name</option>\n"; |
|
154 } |
|
155 } |
|
156 ?> |
|
157 </select> |
|
158 </td> |
|
159 </tr> |
|
160 <input type="hidden" name="rt[pid]" id="pid" value="<?php echo $rt['pid']; ?>"/> |
|
161 <!-- <input type="hidden" name="rt[pget]" value="<?php echo $rt['pget']; ?>"/> --> |
|
162 <input type="hidden" name="rt[okn]" value="<?php echo $okn; ?>"/> |
|
163 <!-- </table> |
|
164 </div> |
|
165 </form> --> |