MDL-21437 data - checkbox and multimenu fields search working + require all too
[moodle.git] / enrol / README.txt
CommitLineData
b8e13a57 1ENROLMENT MODULES
2-----------------
3
4(Yes, that's the correct English spelling ;-) )
5
63aea881 6enrol.class.php contains a simple 'factory' method that
7will instantiate your class when called. For an example
8of a complete class, take a look at the 'manual' class.
b8e13a57 9
63aea881 10Each plugin is in a subfolder here.
b8e13a57 11
4317f92f 12Except for the configuration methods, most methods
63aea881 13defined in the API are optional -- callers will use
14method_exists() to determine whether your plugin offers
15the functionality they are after.
16
17
18Mandatory methods
9e7f597e 19=================
63aea881 20
9e7f597e 21 config_form()
22 process_config()
63aea881 23
24
25Login-time methods
9e7f597e 26==================
27
28 Before Moodle 1.7
29 -----------------
30
31 get_student_courses()
32 get_teacher_courses()
4317f92f 33
9e7f597e 34 You probably will want to offer at least get_student_courses().
4317f92f 35
9e7f597e 36 These methods are triggered when a user logs in successfully,
4317f92f 37 and they are expected to populate $USER->student and
9e7f597e 38 $USER->teacher arrays and maintain (add/delete) entries from
39 user_students and user_teachers.
4317f92f 40
9e7f597e 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.
4317f92f
PS
44
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.
9e7f597e 48 Conversely, the $USER->student and ->teacher arrays have the
49 enrolment type as value, like
4317f92f 50
9e7f597e 51 $USER->student = array ( $courseid => $plugintype );
4317f92f 52
9e7f597e 53
54 Moodle 1.7 and later
55 --------------------
56
57 setup_enrolments()
58
4317f92f 59 With the advent of roles, there could well not be students and
9e7f597e 60 teachers any more, so enrolment plugins have to be more flexible
61 about how they map outside data to the internal roles.
4317f92f
PS
62
63 This one method should do everything, calling functions from
9e7f597e 64 lib/accesslib.php as necessary to set up relationships.
4317f92f
PS
65
66
63aea881 67Interactive enrolment methods
9e7f597e 68=============================
63aea881 69
70 print_entry()
71 check_entry()
72 check_group_entry()
73 get_access_icons()
74
75These methods are for enrolment plugins that allow for user
4317f92f 76driven enrolment. These methods are relevant for plugins
63aea881 77that implement payment gateways (credit card, paypal),
4317f92f 78as well as "magic password" schemes.
63aea881 79
80Only one interactive enrolment method can be active for
81a given course. The site default can be set from
82Admin->Enrolment, and then individual courses can be
83set to specific interactive enrolment methods.
84
85
86Cron
9e7f597e 87====
63aea881 88
89If your class offers a cron() method, it will be invoked by
69a00d09 90the standard Moodle cron every time it is called. Note that if the
63aea881 91tasks are not lightweight you must control how frequently they
92execute, perhaps offering a config option.
93
94For really heavy cron processing, an alternative is to have
95a separate script to be called separately. Currently the LDAP
4317f92f 96and DB plugins have external scripts.
63aea881 97
98
99Guilty Parties
100--------------
b8e13a57 101
102Martin Dougiamas and Shane Elliott, Moodle.com
63aea881 103Martin Langhoff and Patrick Li, Catalyst IT
b8e13a57 104