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