moodle/enrol/ldap/config.html
2010-01-16 18:29:51 +00:00

389 lines
15 KiB
HTML
Executable File

<?php // initialize variables
global $DB;
// general
if (!isset ($frm->enrol_ldap_host_url)) {
$frm->enrol_ldap_host_url = '';
}
if (!isset ($frm->enrol_ldap_version )) {
$frm->enrol_ldap_version = '';
}
if (!isset ($frm->enrol_ldap_bind_dn)) {
$frm->enrol_ldap_bind_dn = '';
}
if (!isset ($frm->enrol_ldap_bind_pw)) {
$frm->enrol_ldap_bind_pw = '';
}
if (!isset ($frm->enrol_ldap_search_sub)) {
$frm->enrol_ldap_search_sub = '0';
}
if (!isset ($frm->enrol_ldap_objectclass)) {
$frm->enrol_ldap_objectclass = '';
}
if (!isset ($frm->enrol_ldap_course_idnumber_updatelocal)) {
$frm->enrol_ldap_course_idnumber_updatelocal = '';
}
// fields
if (!isset ($frm->enrol_ldap_course_idnumber)) {
$frm->enrol_ldap_course_idnumber = '';
}
if (!isset ($frm->enrol_ldap_course_idnumber_updatelocal)) {
$frm->enrol_ldap_course_idnumber_updatelocal = false;
}
if (!isset ($frm->enrol_ldap_course_idnumber_editlock)) {
$frm->enrol_ldap_course_idnumber_editlock = false;
}
if (!isset ($frm->enrol_ldap_course_fullname)) {
$frm->enrol_ldap_course_fullname = '';
}
if (!isset ($frm->enrol_ldap_course_fullname_updatelocal)) {
$frm->enrol_ldap_course_fullname_updatelocal = false;
}
if (!isset ($frm->enrol_ldap_course_fullname_editlock)) {
$frm->enrol_ldap_course_fullname_editlock = false;
}
if (!isset ($frm->enrol_ldap_course_shortname)) {
$frm->enrol_ldap_course_shortname = '';
}
if (!isset ($frm->enrol_ldap_course_shortname_updatelocal)) {
$frm->enrol_ldap_course_shortname_updatelocal = false;
}
if (!isset ($frm->enrol_ldap_course_shortname_editlock)) {
$frm->enrol_ldap_course_shortname_editlock = false;
}
if (!isset ($frm->enrol_ldap_course_summary)) {
$frm->enrol_ldap_course_summary = '';
}
if (!isset ($frm->enrol_ldap_course_summary_updatelocal)) {
$frm->enrol_ldap_course_summary_updatelocal = false;
}
if (!isset ($frm->enrol_ldap_course_summary_editlock)) {
$frm->enrol_ldap_course_summary_editlock = false;
}
// Roles
$roles = get_all_roles();
foreach($roles as $role) {
if (!isset($frm->{'enrol_ldap_contexts_role'.$role->id})) {
$frm->{'enrol_ldap_contexts_role'.$role->id} = '';
}
if (!isset($frm->{'enrol_ldap_memberattribute_role'.$role->id})) {
$frm->{'enrol_ldap_memberattribute_role'.$role->id} = '';
}
}
// autocreate
if (!isset($frm->enrol_ldap_autocreate)) {
$frm->enrol_ldap_autocreate = false;
}
if (!isset($frm->enrol_ldap_category)) {
$frm->enrol_ldap_category = 1;
}
if (!isset($frm->enrol_ldap_template)) {
$frm->enrol_ldap_template = '';
}
?>
<table cellspacing="0" cellpadding="5" border="0" class="boxaligncenter">
<tr>
<td colspan="2">
<h4><?php print_string("enrol_ldap_server_settings", "enrol_ldap") ?> </h4>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_host_url:</td>
<td>
<input name="enrol_ldap_host_url" type="text" size="30" value="<?php echo $frm->enrol_ldap_host_url?>" />
<?php if (isset($err["enrol_ldap_host_url"])) echo $OUTPUT->error_text($err["enrol_ldap_host_url"]); ?>
</td>
<td>
<?php print_string("enrol_ldap_host_url","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_version:</td>
<td>
<?php
$versions[2] = "2";
$versions[3] = "3";
echo html_writer::select($versions, "enrol_ldap_version", $frm->enrol_ldap_version, false);
if (isset($err["enrol_ldap_version"])) echo $OUTPUT->error_text($err["enrol_ldap_version"]);
?>
</td>
<td>
<?php print_string("enrol_ldap_version","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_bind_dn:</td>
<td>
<input name="enrol_ldap_bind_dn" type="text" size="30" value="<?php echo $frm->enrol_ldap_bind_dn?>" />
<?php if (isset($err["enrol_ldap_bind_dn"])) echo $OUTPUT->error_text($err["ldap_bind_dn"]); ?>
</td><td>
<?php print_string("enrol_ldap_bind_dn","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">ldap_bind_pw:</td>
<td>
<input name="enrol_ldap_bind_pw" type="password" size="30" value="<?php echo $frm->enrol_ldap_bind_pw?>" />
<?php if (isset($err["enrol_ldap_bind_pw"])) echo $OUTPUT->error_text($err["enrol_ldap_bind_pw"]); ?>
</td><td>
<?php print_string("enrol_ldap_bind_pw","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">ldap_search_sub:</td>
<td>
<?php
$choices = array();
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
echo $OUTPUT->select(html_select::make ($choices, "enrol_ldap_search_sub", $frm->enrol_ldap_search_sub, false));
?>
<?php if (isset($err["enrol_ldap_search_sub"])) echo $OUTPUT->error_text($err["enrol_ldap_search_sub"]); ?>
</td><td>
<?php print_string("enrol_ldap_search_sub","enrol_ldap") ?>
</td>
</tr>
<?php /*
<tr>
<td colspan="2">
<h4><?php print_string("enrol_ldap_student_settings", "enrol_ldap") ?> </h4>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_student_contexts:</td>
<td>
<input name="enrol_ldap_student_contexts" type="text" SIZE="30 "value="<?php echo $frm->enrol_ldap_student_contexts?>" />
<?php if (isset($err["enrol_ldap_student_contexts"])) echo $OUTPUT->error_text($err["enrol_ldap_student_contexts"]); ?>
</td>
<td>
<?php print_string("enrol_ldap_student_contexts","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_student_memberattribute:</td>
<td>
<input name="enrol_ldap_student_memberattribute" type="text" size="30" value="<?php echo $frm->enrol_ldap_student_memberattribute?>" />
<?php if (isset($err["enrol_ldap_student_memberattribute"])) echo $OUTPUT->error_text($err["enrol_ldap_student_memberattribute"]); ?>
</td><td>
<?php print_string("enrol_ldap_student_memberattribute","enrol_ldap") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("enrol_ldap_teacher_settings", "enrol_ldap") ?> </h4>
</td>
</tr>
<tr valign="top">
<td align="right">enrol_ldap_teacher_contexts:</td>
<td>
<input name="enrol_ldap_teacher_contexts" type="text" SIZE="30 "value="<?php echo $frm->enrol_ldap_teacher_contexts?>" />
<?php if (isset($err["enrol_ldap_teacher_contexts"])) echo $OUTPUT->error_text($err["enrol_ldap_teacher_contexts"]); ?>
</td>
<td>
<?php print_string("enrol_ldap_teacher_contexts","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_teacher_memberattribute:</td>
<td>
<input name="enrol_ldap_teacher_memberattribute" type="text" size="30" value="<?php echo $frm->enrol_ldap_teacher_memberattribute?>" />
<?php if (isset($err["enrol_ldap_teacher_memberattribute"])) echo $OUTPUT->error_text($err["enrol_ldap_teacher_memberattribute"]); ?>
</td><td>
<?php print_string("enrol_ldap_teacher_memberattribute","enrol_ldap") ?>
</td>
</tr>
*/ ?>
<tr>
<td colspan="2">
<h4><?php print_string('enrol_ldap_roles', 'enrol_ldap'); ?></h4>
</td>
</tr>
<tr>
<td colspan="3">
<table>
<tr>
<th><?php print_string('roles', 'role'); ?></th>
<th><?php print_string('enrol_ldap_contexts', 'enrol_ldap'); ?></th>
<th><?php print_string('enrol_ldap_memberattribute', 'enrol_ldap'); ?></th>
</tr>
<?php foreach ($roles as $role) { ?>
<tr>
<td><?php echo htmlspecialchars($role->name, ENT_COMPAT, 'UTF-8'); ?></td>
<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>
<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>
</tr>
<?php } ?>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("enrol_ldap_course_settings", "enrol_ldap") ?> </h4>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_objectclass:</td>
<td>
<input name="enrol_ldap_objectclass" type="text" size="30" value="<?php echo $frm->enrol_ldap_objectclass?>"/>
<?php if (isset($err["enrol_ldap_objectclass"])) echo $OUTPUT->error_text($err["enrol_ldap_objectclass"]); ?>
</td>
<td>
<?php print_string("enrol_ldap_objectclass","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_course_idnumber:</td>
<td>
<input name="enrol_ldap_course_idnumber" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_idnumber?>"/>
<?php if (isset($err["enrol_ldap_course_idnumber"])) echo $OUTPUT->error_text($err["enrol_ldap_course_idnumber"]); ?>
<div style="text-align:right;margin-left:auto;margin-right:0">
<?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
<select name="enrol_ldap_course_idnumber_updatelocal">
<option value="0" <?php echo ($frm->enrol_ldap_course_idnumber_updatelocal ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_idnumber_updatelocal ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br/>
<?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
<select name="enrol_ldap_course_idnumber_editlock">
<option value="0" <?php echo ($frm->enrol_ldap_course_idnumber_editlock ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_idnumber_editlock ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select></div>
</td><td>
<?php print_string("enrol_ldap_course_idnumber","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_course_shortname:</td>
<td>
<input name="enrol_ldap_course_shortname" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_shortname?>"/>
<?php if (isset($err["enrol_ldap_course_shortname"])) echo $OUTPUT->error_text($err["enrol_ldap_course_shortname"]); ?>
<div style="text-align:right;margin-left:auto;margin-right:0">
<?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
<select name="enrol_ldap_course_shortname_updatelocal">
<option value="0" <?php echo ($frm->enrol_ldap_course_shortname_updatelocal ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_shortname_updatelocal ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br/>
<?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
<select name="enrol_ldap_course_shortname_editlock">
<option value="0" <?php echo ($frm->enrol_ldap_course_shortname_editlock ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_shortname_editlock ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select></div>
</td><td>
<?php print_string("enrol_ldap_course_shortname","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_course_fullname:</td>
<td>
<input name="enrol_ldap_course_fullname" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_fullname ?>"/>
<?php if (isset($err["enrol_ldap_course_fullname"])) echo $OUTPUT->error_text($err["enrol_ldap_course_fullname"]); ?>
<div style="text-align:right;margin-left:auto;margin-right:0">
<?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
<select name="enrol_ldap_course_fullname_updatelocal">
<option value="0" <?php echo ($frm->enrol_ldap_course_fullname_updatelocal ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_fullname_updatelocal ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br/>
<?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
<select name="enrol_ldap_course_idnumber_editlock">
<option value="0" <?php echo ($frm->enrol_ldap_course_fullname_editlock ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_fullname_editlock ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select></div>
</td><td>
<?php print_string("enrol_ldap_course_fullname","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_course_summary:</td>
<td>
<input name="enrol_ldap_course_summary" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_summary?>"/>
<?php if (isset($err["enrol_ldap_course_summary"])) echo $OUTPUT->error_text($err["enrol_ldap_course_summary"]); ?>
<div style="text-align:right;margin-left:auto;margin-right:0">
<?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
<select name="enrol_ldap_course_summary_updatelocal">
<option value="0" <?php echo ($frm->enrol_ldap_course_summary_updatelocal ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_summary_updatelocal ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br/>
<?php print_string("enrol_ldap_editlock", "enrol_ldap") ?>
<select name="enrol_ldap_course_summary_editlock">
<option value="0" <?php echo ($frm->enrol_ldap_course_summary_editlock ? '' : 'selected="selected"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_summary_editlock ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
</select></div>
</td><td>
<?php print_string("enrol_ldap_course_summary","enrol_ldap") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("enrol_ldap_autocreation_settings", "enrol_ldap") ?> </h4>
</td>
</tr>
<tr valign="top">
<td align="right">enrol_ldap_autocreate:</td>
<td>
<?php
echo html_writer::select('0'=>'no','1'=>'yes'), "enrol_ldap_autocreate", $frm->enrol_ldap_autocreate, false);
if (isset($err["enrol_ldap_autocreate"])) echo $OUTPUT->error_text($err["enrol_ldap_autocreate"]);
?>
</td>
<td>
<?php print_string("enrol_ldap_autocreate","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_category:</td>
<td>
<?php
$displaylist = array();
$parentlist = array();
make_categories_list($displaylist, $parentlist);
echo html_writer::select($displaylist, "enrol_ldap_category", $frm->enrol_ldap_category, false);
?>
<?php if (isset($err["enrol_ldap_category"])) echo $OUTPUT->error_text($err["enrol_ldap_category"]); ?>
</td><td>
<?php print_string("enrol_ldap_category","enrol_ldap") ?>
</td>
</tr>
<tr>
<td align="right">enrol_ldap_template:</td>
<td>
<input name="enrol_ldap_template" type="text" size="30" value="<?php echo $frm->enrol_ldap_template?>" />
<?php if (isset($err["enrol_ldap_template"])) echo $OUTPUT->error_text($err["enrol_ldap_template"]); ?>
</td><td>
<?php print_string("enrol_ldap_template","enrol_ldap") ?>
</td>
</tr>
</table>