DB External enrolment question - How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?

DB External enrolment question - How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?

by John Reese -
Number of replies: 4

Hello folks,

Environment: 2.2.4 (20120719), MySQL 5.1, PHP 5.3.3, RHEL 6.2 64-bit

Background: Our student information system (SIS) creates multiple classes with student/user enrolment information on a daily basis.

DB Enrolment method: synchronizing on a daily basis one class PER/IN EACH moodle course (i.e one class = 1 moodle course)

Questions using external DB enrolment:

  1. How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?
  2. Is the only way to do it manually and then run the sync manually/on-demand basis? If so, what would be the best way to call the sync script from and have it run as a web-based application (one that users can just login to a protected site and click on say ... "run sync process")?
  3. We looked at meta courses but that would mean we would have to create X amount of empty child courses just for the enrolment sync which would be a waste of empty courses. 

Example Scenario:

Moodle Course ID: 12345

Db external enrolment identifier: Course ID Number

SIS classes: 2013A, 2013B, 2013C, 2013D, 2013E, 2013F, 2013F, 2013G, ... and so on

So if we want to add SIS enrolments from classes 2013A to 2013F to Moodle Course ID: 12345, we would do this manually by:

  1. Enter class 2013A in the "Course ID Number" of Moodle Course ID: 12345
  2. Manually run the synch script
  3. Change the "Course ID Number" to 2013B of Moodle Course ID: 12345
  4. Manually run the synch script again 
  5. Change the "Course ID Number" to 2013C of Moodle Course ID: 12345
  6. Manually run the synch script again  
  7. Change the "Course ID Number" to 2013D of Moodle Course ID: 12345
  8. Manually run the synch script again  
  9. Change the "Course ID Number" to 2013E of Moodle Course ID: 12345
  10. Manually run the synch script again 
  11. Change the "Course ID Number" to 2013F of Moodle Course ID: 12345
  12. Manually run the synch script again 

This would give us all the enrolments from these 6 classes into one Moodle course.

Is there a way to programmatically do this (or an easier way/workaround)?

Thanks

John.

 

 

 

 

 

 

 

Average of ratings: -
In reply to John Reese

Re: DB External enrolment question - How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?

by Chad Bergeron -

I think metacourses are the way to appropriately handle this.  Moodle can automatically create the empty courses, but you can just hide them.  If they're unutilized, it isn't really a waste.  Otherwise you might try creating a separate view in your SIS for Moodle to look at and having the SIS system strip off the trailing letter or otherwise present the same ID for all the matching courses.

In reply to Chad Bergeron

Re: DB External enrolment question - How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?

by John Reese -

I think I came up with a similar approach... I will create a temporary table with multiple associations of classes to a single moodle course. I will then write a script to put it into the external db and run the sync script.

In reply to John Reese

Re: DB External enrolment question - How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?

by Chad Bergeron -

That's an alternative, but I didn't suggest it because many people are pulling their enrollments directly from a system they can't change.  I too pull down, run a little sed over the file, then put into a temporary table.

In reply to John Reese

Re: DB External enrolment question - How to programmatically (if possible) sync to enrol users from multiple classes into one (1)/the same moodle course?

by John Reese -

Actually, I would suggest a new feature.

A script that would automatically enrol users to a group similar to what we do with external db enrolment to a course smile

Then we can just create a group and associate multiple groups to a course. This would be like multiple enrolments for one course