Merge branch 'MDL-26384-m21' of git://github.com/ankitagarwal/moodle into MOODLE_21_S...
[moodle.git] / enrol / README.txt
blob70ce970189cb0e051676c59f92e0306b9c8030b9
1 ENROLMENT MODULES
2 -----------------
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.
18 Mandatory methods
19 =================
21   config_form()
22   process_config()
25 Login-time methods
26 ==================
28   Before Moodle 1.7
29   -----------------
31       get_student_courses()
32       get_teacher_courses()
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 );
54   Moodle 1.7 and later
55   --------------------
57       setup_enrolments()
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 =============================
70   print_entry()
71   check_entry()
72   check_group_entry()
73   get_access_icons()
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.
86 Cron
87 ====
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.
99 Guilty Parties
100 --------------
102 Martin Dougiamas and Shane Elliott, Moodle.com
103 Martin Langhoff and Patrick Li, Catalyst IT