Skip to content
philcali edited this page Dec 12, 2011 · 3 revisions

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.

Reprocessing

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); // Done

The following reprocess functions are available:

  • reprocess_course takes in a Moodle course
  • reprocess_sections takes in a collection of ues_sections
  • reprocess_for takes in a ues_teacher, and reprocesses all section for him / her

Handling Enrollment

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.

Other Helpful Functions

  • require_daos just loads the dao library with a single call.
  • require_extensions these are provider extensions.
  • require_libs calls require_daos and require_extensions... useful for provider development

Clone this wiki locally