]> git.mjollnir.org Git - moodle.git/commitdiff
New confirmation step when self-enrolling
authormoodler <moodler>
Sun, 17 Aug 2003 04:53:44 +0000 (04:53 +0000)
committermoodler <moodler>
Sun, 17 Aug 2003 04:53:44 +0000 (04:53 +0000)
course/enrol.php
lang/en/moodle.php

index ed87bcec075dd75c12ac98e14ec48e8c46bfb097..cc9797673dd738952ef93a768f6951aee4272811 100644 (file)
         }
     }
 
+    $strloginto = get_string("loginto", "", $course->shortname);
+    $strcourses = get_string("courses");
 
     if (! $site = get_site()) {
         error("Could not find a site!");
     }
 
     if ($course->password == "") {   // no password, so enrol
-        
+
         if (isguest()) {
             add_to_log($course->id, "course", "guest", "view.php?id=$course->id", "$USER->id");
+
+        } else if (empty($confirm)) {
+
+            print_header($strloginto, $course->fullname, "<a href=\".\">$strcourses</a> -> $strloginto"); 
+            echo "<br />";
+            notice_yesno(get_string("enrolmentconfirmation"), "enrol.php?id=$course->id&confirm=1", $CFG->wwwroot);
+            print_footer();
+            exit;
+
         } else {
+
             if (! enrol_student($USER->id, $course->id)) {
                 error("An error occurred while trying to enrol you.");
             }
             add_to_log($course->id, "course", "enrol", "view.php?id=$course->id", "$USER->id");
-        }
 
-        $USER->student["$id"] = true;
+            $USER->student["$id"] = true;
         
-        if ($SESSION->wantsurl) {
-            $destination = $SESSION->wantsurl;
-            unset($SESSION->wantsurl);
-        } else {
-            $destination = "$CFG->wwwroot/course/view.php?id=$id";
+            if ($SESSION->wantsurl) {
+                $destination = $SESSION->wantsurl;
+                unset($SESSION->wantsurl);
+            } else {
+                $destination = "$CFG->wwwroot/course/view.php?id=$id";
+            }
+    
+            redirect($destination);
         }
-
-        redirect($destination);
     }
 
     $teacher = get_teacher($course->id);
         $password = "";
     }
 
-    $strloginto = get_string("loginto", "", $course->shortname);
-    $strcourses = get_string("courses");
 
-    print_header($strloginto, $strloginto, "<A HREF=\".\">$strcourses</A> -> $strloginto", "form.password"); 
+    print_header($strloginto, $course->fullname, "<A HREF=\".\">$strcourses</A> -> $strloginto", "form.password"); 
 
     print_course($course); 
 
index dbcf998084da005f17fa21e0abad70f64cff1327..0be7ca11cd4aaf40ee7aa646765f79b653958a9f 100644 (file)
@@ -272,6 +272,7 @@ $string['emailpasswordsent'] = "Thank you for confirming the change of password.
 <p>An email containing your new password has been sent to your address at <b>\$a->email</b>.
 <p>The new password was automatically generated - you might like to
 <a href=\$a->link>change your password</a> to something easier to remember.";
+$string['enrolmentconfirmation'] = "You are about to enroll yourself as a member of this course.<br />Are you sure you wish to do this?";
 $string['enrolmentkey'] = "Enrolment key";
 $string['enrolmentkeyfrom'] = "This course requires an 'enrolment key' - a one-time<BR>
 password that you should have received from \$a";