-
Notifications
You must be signed in to change notification settings - Fork 1
Public API
The enrollment module gives the developer working on outside plugins to interact directly with the enrollment process through the public API, synonymously, the cps object.
The enrollment module is scheduled to run daily somewhere between 2 and 3 am. 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 = cps::reprocess_course($course); // DoneThe following reprocess functions are available:
-
reprocess_coursetakes in a Moodle course -
reprocess_sectionstakes in a collection ofcps_sections -
reprocess_fortakes in acps_teacher, and reprocesses all section for him / her
Outside systems may add or modify how Moodle data is representing the CPS enrollment data (the CPS Enrollment Process is actually very simple).
$sections = cps_section::from_course($course);
// Going to unenroll everyone
cps::unenroll_users($sections);
// Going to reenroll everyone
cps::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.
cps::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