Merged from 1.7.
[moodle.git] / enrol / ldap / config.html
CommitLineData
64031bbb 1<?php // initialize variables
2
64031bbb 3// general
5a0345c2 4if (!isset ($frm->enrol_ldap_host_url)) {
5 $frm->enrol_ldap_host_url = '';
6}
7if (!isset ($frm->enrol_ldap_version )) {
8 $frm->enrol_ldap_version = '';
9}
10if (!isset ($frm->enrol_ldap_bind_dn)) {
11 $frm->enrol_ldap_bind_dn = '';
12}
13if (!isset ($frm->enrol_ldap_bind_pw)) {
14 $frm->enrol_ldap_bind_pw = '';
15}
16if (!isset ($frm->enrol_ldap_search_sub)) {
17 $frm->enrol_ldap_search_sub = '0';
18}
5a0345c2 19if (!isset ($frm->enrol_ldap_objectclass)) {
20 $frm->enrol_ldap_objectclass = '';
21}
22if (!isset ($frm->enrol_ldap_course_idnumber_updatelocal)) {
23 $frm->enrol_ldap_course_idnumber_updatelocal = '';
24}
64031bbb 25// fields
5a0345c2 26if (!isset ($frm->enrol_ldap_course_idnumber)) {
27 $frm->enrol_ldap_course_idnumber = '';
28}
29if (!isset ($frm->enrol_ldap_course_idnumber_updatelocal)) {
30 $frm->enrol_ldap_course_idnumber_updatelocal = false;
31}
32if (!isset ($frm->enrol_ldap_course_idnumber_editlock)) {
33 $frm->enrol_ldap_course_idnumber_editlock = false;
34}
35if (!isset ($frm->enrol_ldap_course_fullname)) {
36 $frm->enrol_ldap_course_fullname = '';
37}
38if (!isset ($frm->enrol_ldap_course_fullname_updatelocal)) {
39 $frm->enrol_ldap_course_fullname_updatelocal = false;
40}
41if (!isset ($frm->enrol_ldap_course_fullname_editlock)) {
42 $frm->enrol_ldap_course_fullname_editlock = false;
43}
44if (!isset ($frm->enrol_ldap_course_shortname)) {
45 $frm->enrol_ldap_course_shortname = '';
87c75906 46}
5a0345c2 47if (!isset ($frm->enrol_ldap_course_shortname_updatelocal)) {
48 $frm->enrol_ldap_course_shortname_updatelocal = false;
49}
50if (!isset ($frm->enrol_ldap_course_shortname_editlock)) {
51 $frm->enrol_ldap_course_shortname_editlock = false;
52}
53if (!isset ($frm->enrol_ldap_course_summary)) {
54 $frm->enrol_ldap_course_summary = '';
55}
56if (!isset ($frm->enrol_ldap_course_summary_updatelocal)) {
57 $frm->enrol_ldap_course_summary_updatelocal = false;
58}
59if (!isset ($frm->enrol_ldap_course_summary_editlock)) {
60 $frm->enrol_ldap_course_summary_editlock = false;
61}
87c75906 62
63// Roles
64$roles = get_records('role');
65foreach($roles as $role) {
66 if (!isset($frm->{'enrol_ldap_contexts_role'.$role->id})) {
67 $frm->{'enrol_ldap_contexts_role'.$role->id} = '';
68 }
69
70 if (!isset($frm->{'enrol_ldap_memberattribute_role'.$role->id})) {
71 $frm->{'enrol_ldap_memberattribute_role'.$role->id} = '';
72 }
73}
74
64031bbb 75// autocreate
b490cf71 76if (!isset($frm->enrol_ldap_autocreate)) {
77 $frm->enrol_ldap_autocreate = false;
78}
79if (!isset($frm->enrol_ldap_category)) {
80 $frm->enrol_ldap_category = 1;
81}
82if (!isset($frm->enrol_ldap_template)) {
83 $frm->enrol_ldap_template = '';
84}
f9667a5a 85
64031bbb 86?>
87
88<table cellspacing="0" cellpadding="5" border="0" align="center">
89<tr>
90 <td colspan="2">
91 <h4><?php print_string("enrol_ldap_server_settings", "enrol_ldap") ?> </h4>
92 </td>
93</tr>
210eddc7 94<tr valign="top">
894ff63f 95 <td align="right">enrol_ldap_host_url:</td>
96 <td>
b1503075 97 <input name="enrol_ldap_host_url" type="text" SIZE="30" value="<?php echo $frm->enrol_ldap_host_url?>">
894ff63f 98 <?php if (isset($err["enrol_ldap_host_url"])) formerr($err["enrol_ldap_host_url"]); ?>
99 </td>
64031bbb 100 <td>
101 <?php print_string("enrol_ldap_host_url","enrol_ldap") ?>
102 </td>
103</tr>
210eddc7 104<tr valign="top">
894ff63f 105 <td align="right">enrol_ldap_version:</td>
106 <td>
64031bbb 107 <?php
108 $versions[2] = "2";
109 $versions[3] = "3";
110 choose_from_menu($versions, "enrol_ldap_version", $frm->enrol_ldap_version, "");
894ff63f 111 if (isset($err["enrol_ldap_version"])) formerr($err["enrol_ldap_version"]);
64031bbb 112 ?>
894ff63f 113 </td>
64031bbb 114 <td>
115 <?php print_string("enrol_ldap_version","enrol_ldap") ?>
116 </td>
117</tr>
118
210eddc7 119<tr valign="top">
120 <td align="right">enrol_ldap_bind_dn:</td>
64031bbb 121 <td>
122 <input name="enrol_ldap_bind_dn" type="text" size="30" value="<?php echo $frm->enrol_ldap_bind_dn?>">
123 <?php if (isset($err["enrol_ldap_bind_dn"])) formerr($err["ldap_bind_dn"]); ?>
124 </td><td>
125 <?php print_string("enrol_ldap_bind_dn","enrol_ldap") ?>
126 </td>
127</tr>
128
210eddc7 129<tr valign="top">
130 <td align="right">ldap_bind_pw:</td>
64031bbb 131 <td>
132 <input name="enrol_ldap_bind_pw" type="text" size="30" value="<?php echo $frm->enrol_ldap_bind_pw?>">
133 <?php if (isset($err["enrol_ldap_bind_pw"])) formerr($err["enrol_ldap_bind_pw"]); ?>
134 </td><td>
135 <?php print_string("enrol_ldap_bind_pw","enrol_ldap") ?>
136 </td>
137</tr>
138
bdf09a84 139<tr valign="top">
140 <td align="right">ldap_search_sub:</td>
141 <td>
142<?php
1007a3f1 143 $choices = array();
bdf09a84 144 $choices["0"] = get_string("no");
145 $choices["1"] = get_string("yes");
1007a3f1 146 choose_from_menu ($choices, "enrol_ldap_search_sub", $frm->enrol_ldap_search_sub, "");
bdf09a84 147?>
148 <?php if (isset($err["enrol_ldap_search_sub"])) formerr($err["enrol_ldap_search_sub"]); ?>
149 </td><td>
150 <?php print_string("enrol_ldap_search_sub","enrol_ldap") ?>
151 </td>
152</tr>
153
87c75906 154<?php /*
64031bbb 155<tr>
156 <td colspan="2">
157 <h4><?php print_string("enrol_ldap_student_settings", "enrol_ldap") ?> </h4>
158 </td>
159</tr>
210eddc7 160<tr valign="top">
894ff63f 161 <td align="right">enrol_ldap_student_contexts:</td>
162 <td>
b1503075 163 <input name="enrol_ldap_student_contexts" type="text" SIZE="30 "value="<?php echo $frm->enrol_ldap_student_contexts?>">
64031bbb 164 <?php if (isset($err["enrol_ldap_student_contexts"])) formerr($err["enrol_ldap_student_contexts"]); ?>
165 </td>
166 <td>
167 <?php print_string("enrol_ldap_student_contexts","enrol_ldap") ?>
168 </td>
169</tr>
210eddc7 170<tr valign="top">
171 <td align="right">enrol_ldap_student_memberattribute:</td>
64031bbb 172 <td>
173 <input name="enrol_ldap_student_memberattribute" type="text" size="30" value="<?php echo $frm->enrol_ldap_student_memberattribute?>">
174 <?php if (isset($err["enrol_ldap_student_memberattribute"])) formerr($err["enrol_ldap_student_memberattribute"]); ?>
175 </td><td>
176 <?php print_string("enrol_ldap_student_memberattribute","enrol_ldap") ?>
177 </td>
178</tr>
179
180<tr>
181 <td colspan="2">
182 <h4><?php print_string("enrol_ldap_teacher_settings", "enrol_ldap") ?> </h4>
183 </td>
184</tr>
210eddc7 185<tr valign="top">
894ff63f 186 <td align="right">enrol_ldap_teacher_contexts:</td>
187 <td>
b1503075 188 <input name="enrol_ldap_teacher_contexts" type="text" SIZE="30 "value="<?php echo $frm->enrol_ldap_teacher_contexts?>">
64031bbb 189 <?php if (isset($err["enrol_ldap_teacher_contexts"])) formerr($err["enrol_ldap_teacher_contexts"]); ?>
190 </td>
191 <td>
192 <?php print_string("enrol_ldap_teacher_contexts","enrol_ldap") ?>
193 </td>
194</tr>
210eddc7 195<tr valign="top">
196 <td align="right">enrol_ldap_teacher_memberattribute:</td>
64031bbb 197 <td>
198 <input name="enrol_ldap_teacher_memberattribute" type="text" size="30" value="<?php echo $frm->enrol_ldap_teacher_memberattribute?>">
199 <?php if (isset($err["enrol_ldap_teacher_memberattribute"])) formerr($err["enrol_ldap_teacher_memberattribute"]); ?>
200 </td><td>
201 <?php print_string("enrol_ldap_teacher_memberattribute","enrol_ldap") ?>
202 </td>
203</tr>
87c75906 204*/ ?>
205
206<tr>
207 <td colspan="2">
208 <h4><?php print_string('enrol_ldap_roles', 'enrol_ldap'); ?></h4>
209 </td>
210</tr>
211<tr>
212 <td colspan="3">
213 <table>
214 <tr>
215 <th><?php print_string('role_name', 'enrol_ldap'); ?></th>
216 <th><?php print_string('enrol_ldap_contexts', 'enrol_ldap'); ?></th>
217 <th><?php print_string('enrol_ldap_memberattribute', 'enrol_ldap'); ?></th>
218 </tr>
219<?php foreach ($roles as $role): ?>
220 <tr>
221 <td><?php echo htmlspecialchars($role->name, ENT_COMPAT, 'UTF-8'); ?></td>
222 <td><input type="text" size="30" name="enrol_ldap_contexts_role<?php echo $role->id; ?>" value="<?php echo htmlspecialchars($frm->{'enrol_ldap_contexts_role'.$role->id}); ?>" /></td>
223 <td><input type="text" size="30" name="enrol_ldap_memberattribute_role<?php echo $role->id; ?>" value="<?php echo htmlspecialchars($frm->{'enrol_ldap_memberattribute_role'.$role->id}); ?>" /></td>
224 </tr>
225<?php endforeach; ?>
226 </table>
227 </td>
228</tr>
64031bbb 229
230<tr>
231 <td colspan="2">
232 <h4><?php print_string("enrol_ldap_course_settings", "enrol_ldap") ?> </h4>
233 </td>
234</tr>
210eddc7 235<tr valign="top">
236 <td align="right">enrol_ldap_objectclass:</td>
64031bbb 237 <td>
238 <input name=enrol_ldap_objectclass type="text" size="30" value="<?php echo $frm->enrol_ldap_objectclass?>">
239 <?php if (isset($err["enrol_ldap_objectclass"])) formerr($err["enrol_ldap_objectclass"]); ?>
240 </td>
241 <td>
242 <?php print_string("enrol_ldap_objectclass","enrol_ldap") ?>
243 </td>
244</tr>
210eddc7 245<tr valign="top">
246 <td align="right">enrol_ldap_course_idnumber:</td>
64031bbb 247 <td>
248 <input name="enrol_ldap_course_idnumber" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_idnumber?>">
249 <?php if (isset($err["enrol_ldap_course_idnumber"])) formerr($err["enrol_ldap_course_idnumber"]); ?>
250 <div align="right">
251 <?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
252 <select name="enrol_ldap_course_idnumber_updatelocal">
253 <option value="0" <?php echo ($frm->enrol_ldap_course_idnumber_updatelocal ? '' : 'selected="yes"') ?> >
254 <?php print_string("no") ?></option>
255 <option value="1" <?php echo ($frm->enrol_ldap_course_idnumber_updatelocal ? 'selected="yes"' : '') ?> >
256 <?php print_string("yes") ?></option>
71502268 257 </select><br/>
64031bbb 258 <?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
259 <select name="enrol_ldap_course_idnumber_editlock">
260 <option value="0" <?php echo ($frm->enrol_ldap_course_idnumber_editlock ? '' : 'selected="yes"') ?> >
261 <?php print_string("no") ?></option>
262 <option value="1" <?php echo ($frm->enrol_ldap_course_idnumber_editlock ? 'selected="yes"' : '') ?> >
263 <?php print_string("yes") ?></option>
264 </select></div>
265 </td><td>
266 <?php print_string("enrol_ldap_course_idnumber","enrol_ldap") ?>
267 </td>
268</tr>
210eddc7 269<tr valign="top">
270 <td align="right">enrol_ldap_course_shortname:</td>
64031bbb 271 <td>
272 <input name="enrol_ldap_course_shortname" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_shortname?>">
273 <?php if (isset($err["enrol_ldap_course_shortname"])) formerr($err["enrol_ldap_course_shortname"]); ?>
274 <div align="right">
275 <?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
276 <select name="enrol_ldap_course_shortname_updatelocal">
277 <option value="0" <?php echo ($frm->enrol_ldap_course_shortname_updatelocal ? '' : 'selected="yes"') ?> >
278 <?php print_string("no") ?></option>
279 <option value="1" <?php echo ($frm->enrol_ldap_course_shortname_updatelocal ? 'selected="yes"' : '') ?> >
280 <?php print_string("yes") ?></option>
71502268 281 </select><br/>
64031bbb 282 <?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
283 <select name="enrol_ldap_course_shortname_editlock">
284 <option value="0" <?php echo ($frm->enrol_ldap_course_shortname_editlock ? '' : 'selected="yes"') ?> >
285 <?php print_string("no") ?></option>
286 <option value="1" <?php echo ($frm->enrol_ldap_course_shortname_editlock ? 'selected="yes"' : '') ?> >
287 <?php print_string("yes") ?></option>
288 </select></div>
289 </td><td>
290 <?php print_string("enrol_ldap_course_shortname","enrol_ldap") ?>
291 </td>
292</tr>
293
210eddc7 294<tr valign="top">
295 <td align="right">enrol_ldap_course_fullname:</td>
64031bbb 296 <td>
297 <input name="enrol_ldap_course_fullname" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_fullname ?>">
298 <?php if (isset($err["enrol_ldap_course_fullname"])) formerr($err["enrol_ldap_course_fullname"]); ?>
299 <div align="right">
300 <?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
301 <select name="enrol_ldap_course_fullname_updatelocal">
302 <option value="0" <?php echo ($frm->enrol_ldap_course_fullname_updatelocal ? '' : 'selected="yes"') ?> >
303 <?php print_string("no") ?></option>
304 <option value="1" <?php echo ($frm->enrol_ldap_course_fullname_updatelocal ? 'selected="yes"' : '') ?> >
305 <?php print_string("yes") ?></option>
71502268 306 </select><br/>
64031bbb 307 <?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
308 <select name="enrol_ldap_course_idnumber_editlock">
309 <option value="0" <?php echo ($frm->enrol_ldap_course_fullname_editlock ? '' : 'selected="yes"') ?> >
310 <?php print_string("no") ?></option>
311 <option value="1" <?php echo ($frm->enrol_ldap_course_fullname_editlock ? 'selected="yes"' : '') ?> >
312 <?php print_string("yes") ?></option>
313 </select></div>
314 </td><td>
315 <?php print_string("enrol_ldap_course_fullname","enrol_ldap") ?>
316 </td>
317</tr>
318
210eddc7 319<tr valign="top">
320 <td align="right">enrol_ldap_course_summary:</td>
64031bbb 321 <td>
322 <input name="enrol_ldap_course_summary" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_summary?>">
323 <?php if (isset($err["enrol_ldap_course_summary"])) formerr($err["enrol_ldap_course_summary"]); ?>
324 <div align="right">
325 <?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
326 <select name="enrol_ldap_course_summary_updatelocal">
327 <option value="0" <?php echo ($frm->enrol_ldap_course_summary_updatelocal ? '' : 'selected="yes"') ?> >
328 <?php print_string("no") ?></option>
329 <option value="1" <?php echo ($frm->enrol_ldap_course_summary_updatelocal ? 'selected="yes"' : '') ?> >
330 <?php print_string("yes") ?></option>
71502268 331 </select><br/>
64031bbb 332 <?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
333 <select name="enrol_ldap_course_summary_editlock">
334 <option value="0" <?php echo ($frm->enrol_ldap_course_summary_editlock ? '' : 'selected="yes"') ?> >
335 <?php print_string("no") ?></option>
336 <option value="1" <?php echo ($frm->enrol_ldap_course_summary_editlock ? 'selected="yes"' : '') ?> >
337 <?php print_string("yes") ?></option>
338 </select></div>
339 </td><td>
340 <?php print_string("enrol_ldap_course_summary","enrol_ldap") ?>
341 </td>
342</tr>
343
344<tr>
345 <td colspan="2">
346 <h4><?php print_string("enrol_ldap_autocreation_settings", "enrol_ldap") ?> </h4>
347 </td>
348</tr>
210eddc7 349<tr valign="top">
894ff63f 350 <td align="right">enrol_ldap_autocreate:</td>
351 <td>
64031bbb 352 <?php
353 choose_from_menu(array('0'=>'no','1'=>'yes'), "enrol_ldap_autocreate", $frm->enrol_ldap_autocreate, "");
894ff63f 354 if (isset($err["enrol_ldap_autocreate"])) formerr($err["enrol_ldap_autocreate"]);
64031bbb 355 ?>
894ff63f 356 </td>
64031bbb 357 <td>
358 <?php print_string("enrol_ldap_autocreate","enrol_ldap") ?>
359 </td>
360</tr>
210eddc7 361<tr valign="top">
362 <td align="right">enrol_ldap_category:</td>
64031bbb 363 <td>
364 <?php
365 $displaylist = array();
366 $parentlist = array();
367 make_categories_list($displaylist, $parentlist);
368 choose_from_menu($displaylist, "enrol_ldap_category", $frm->enrol_ldap_category, "");
369
370 ?>
371 <?php if (isset($err["enrol_ldap_category"])) formerr($err["enrol_ldap_category"]); ?>
372 </td><td>
373 <?php print_string("enrol_ldap_category","enrol_ldap") ?>
374 </td>
375</tr>
376
210eddc7 377<tr valign="top">
378 <td align="right">enrol_ldap_template:</td>
64031bbb 379 <td>
380 <input name=enrol_ldap_template type="text" size="30" value="<?php echo $frm->enrol_ldap_template?>">
381 <?php if (isset($err["enrol_ldap_template"])) formerr($err["enrol_ldap_template"]); ?>
382 </td><td>
383 <?php print_string("enrol_ldap_template","enrol_ldap") ?>
384 </td>
385</tr>
386
f7d18493 387<tr>
388 <td colspan="2">
389 <h4><?php print_string("enrol_ldap_general_options", "enrol_ldap") ?> </h4>
390 </td>
391</tr>
392
64031bbb 393</table>