-
Notifications
You must be signed in to change notification settings - Fork 1
Public API
The enrollment module gives the developer working on outside plugins a way to interact directly with the enrollment process through the public API, synonymously, the ues object.
The enrollment module is scheduled to run daily somewhere in the hour of your choosing. By this time, new enrollment information may be available. To reprocess a course on demand (fetches new enrollment from the provider and performs enrollment):
$errors = ues::reprocess_course($course); // DoneThe following reprocess functions are available:
-
reprocess_coursetakes in a Moodle course -
reprocess_sectionstakes in a collection ofues_sections -
reprocess_fortakes in aues_teacher, and reprocesses all section for him / her
Outside systems may add or modify how Moodle data is representing the enrollment data (the Enrollment Process is actually very simple).
$sections = ues_section::from_course($course);
// Going to unenroll everyone
ues::unenroll_users($sections);
// Going to re-enroll everyone
ues::enroll_users($sections);A common idiom is: unenroll users, do some work, enroll users / create courses. The inject_manifest function takes care of this for you.
ues::inject_manifest($sections, function($section) use ($newid) {
$section->idnumber = $newid;
});Why call it inject_manifest? When called in such a way, that is exactly what the public API is doing for you.
-
require_daosjust loads the dao library with a single call. -
require_extensionsthese are provider extensions. -
require_libscallsrequire_daosandrequire_extensions... useful for provider development