4 (Yes, that's the correct English spelling ;-) )
6 enrol.class.php contains a simple 'factory' method that
7 will instantiate your class when called. For an example
8 of a complete class, take a look at the 'manual' class.
10 Each plugin is in a subfolder here.
12 Except for the configuration methods, most methods
13 defined in the API are optional -- callers will use
14 method_exists() to determine whether your plugin offers
15 the functionality they are after.
34 You probably will want to offer at least get_student_courses().
36 These methods are triggered when a user logs in successfully,
37 and they are expected to populate $USER->student and
38 $USER->teacher arrays and maintain (add/delete) entries from
39 user_students and user_teachers.
41 These methods are relevant for most plugins, and are the main
42 interest for plugins that work with a read-only backend such
43 as LDAP or a database.
45 Note that with the multi-enrol infrastructure two things have
46 changed. We now have an 'enrol' field in those tables, and
47 each plugin must maintain only its own enrolment records.
48 Conversely, the $USER->student and ->teacher arrays have the
49 enrolment type as value, like
51 $USER->student = array ( $courseid => $plugintype );
59 With the advent of roles, there could well not be students and
60 teachers any more, so enrolment plugins have to be more flexible
61 about how they map outside data to the internal roles.
63 This one method should do everything, calling functions from
64 lib/accesslib.php as necessary to set up relationships.
67 Interactive enrolment methods
68 =============================
75 These methods are for enrolment plugins that allow for user
76 driven enrolment. These methods are relevant for plugins
77 that implement payment gateways (credit card, paypal),
78 as well as "magic password" schemes.
80 Only one interactive enrolment method can be active for
81 a given course. The site default can be set from
82 Admin->Enrolment, and then individual courses can be
83 set to specific interactive enrolment methods.
89 If your class offers a cron() method, it will be invoked by
90 the standard Moodle cron every time it is called. Note that if the
91 tasks are not lightweight you must control how frequently they
92 execute, perhaps offering a config option.
94 For really heavy cron processing, an alternative is to have
95 a separate script to be called separately. Currently the LDAP
96 and DB plugins have external scripts.
102 Martin Dougiamas and Shane Elliott, Moodle.com
103 Martin Langhoff and Patrick Li, Catalyst IT