]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16598 Admin config setting to make enrolment key hint optional
authorskodak <skodak>
Wed, 24 Sep 2008 18:47:40 +0000 (18:47 +0000)
committerskodak <skodak>
Wed, 24 Sep 2008 18:47:40 +0000 (18:47 +0000)
enrol/manual/config.html
enrol/manual/enrol.php
lang/en_utf8/enrol_manual.php

index 24898c7b7e9599e8f2d3b298788afb0381a95e32..64788b4140358d3962a84e42f0a7033b5865a934 100644 (file)
     </td>
 </tr>
 
+<tr>
+    <td align="right">enrol_manual_showhint:</td>
+    <td>
+<?php
+    $choices = array();
+    $choices['0'] = get_string('no');
+    $choices['1'] = get_string('yes');
+    choose_from_menu ($choices, 'enrol_manual_showhint', $frm->enrol_manual_showhint, '');
+?>
+    </td><td>
+    <?php  print_string('enrol_manual_showhint', 'enrol_manual') ?>
+    </td>
+</tr>
+
 
 </table>
index ce8ce33ff4f36d2ad0e5272d998bc19e7eedcfb0..7385cb06f7ba70bd3dda82221038534b2b7e80cf 100644 (file)
@@ -176,8 +176,11 @@ function check_entry($form, $course) {
 
         redirect($destination);
 
+    } else if (!isset($CFG->enrol_manual_showhint) or $CFG->enrol_manual_showhint) {
+        $this->errormsg = get_string('enrolmentkeyhint', '', substr($course->password, 0, 1));
+
     } else {
-        $this->errormsg = get_string('enrolmentkeyhint', '', substr($course->password,0,1));
+        $this->errormsg = get_string('enrolmentkeyerror', 'enrol_manual');
     }
 }
 
@@ -217,6 +220,10 @@ function config_form($frm) {
         $frm->enrol_manual_keyholderrole = '';
     }
 
+    if (!isset($frm->enrol_manual_showhint)) {
+        $frm->enrol_manual_showhint = 1;
+    }
+
     include ("$CFG->dirroot/enrol/manual/config.html");
 }
 
index f0ff44a388c633bf3b6bdd98c7535865664faa39..d67c1ffb4032cf525d598118e7121537e08c5425 100644 (file)
@@ -9,6 +9,8 @@ $string['description'] = 'This is the default form of enrolment. There are two m
 <li>A course can have a password defined, known as an \"enrolment key\".  Anyone who knows this key is 
     able to add themselves to a course.</li>
 </ul>';
+$string['enrolmentkeyerror'] = 'That enrolment key was incorrect, please try again.';
 $string['enrolname'] = 'Internal Enrolment';
+$string['enrol_manual_showhint'] = 'Enable this setting to reveal the first character of the enrolment key as a hint if one enters an incorrect key.';
 $string['keyholderrole' ] = 'The role of the user that holds the enrolment key for a course. Displayed to students attempting to enrol on the course.';
 ?>