Enrolment Duration and External DB Enrolment

Enrolment Duration and External DB Enrolment

by Stephen Martin -
Number of replies: 4
If I understand the process correctly, the Enrolment Duration setting is irrelevant for students enroled via DB enrolment (since enrolment is determined by the external table).

First, is this interpretation correct?

If it is correct, what is the best route for creating the same functionality for DB enroled students?

Here's the scenario. We register our students for training courses though a third-party system that integrates with our accounting and billing system. We then use database authentication and database enrolment to create student accounts in Moodle and course enrolments. On our Moodle site we have a mix of facilitator-assisted and self-paced courses. For the facilitator assisted courses, we have discrete sessions with start and end dates (these classes are usually 8 to 10 weeks long). For these, the DB settings work fine because when the course is over, we just shut it down. When a new session starts up, we create a new course in Moodle.

For the self-paced, there is no universal start and stop date. Rather, students can register and start any time they want. We do, however, want to limit access to 30-days from their start date. Normally, enrolment duration would work for this, but because we're using DB enrolment, that setting will be superseded by the DB enrolment table contents.
Average of ratings: -
In reply to Stephen Martin

Re: Enrolment Duration and External DB Enrolment

by Manuel NT -

 Hi , external DB enrolment   just rum scripts  to take your  data  and  put the  on moodle ,  the sintax on mdl_role_assingments still  the same ,  your  users  are enrolled with timeend = 0 ; So just change the  value (timestamp format) to 365  days (maxymun moodle  value on form) ;

In reply to Manuel NT

Re: Enrolment Duration and External DB Enrolment

by Stephen Martin -
I think I need to describe what I'm trying to do a little better.

We have a separate student information system that handles student enrolment, billing, etc. I extract Moodle enrolments from this system and use External DB Authentication. The Enrolment table has two columns--student ID and course ID.

Within the course, I have set Enrolment Duration to 30 days under the Course Settings. This works fine for any students I manually enrol. But students enroled using DB enrolment have a duration of unlimited (even though the course is set for 30 days).

How can I get the DB enrolment to use the setting within the course? I can't hardcode a global change into the import script because some of my courses allow unlimited enrolment, some allow 60 days, some allow 90 days, etc.

Basically, I want DB enrolment to respect the enrolment duration setting within the course.
In reply to Stephen Martin

Re: Enrolment Duration and External DB Enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hmmmm, I'm not sure external DB enrolment is what you really need.

The rationale for the external DB enrolment plugin is that the external DB is authoritative with respect to the enrolments. If a given user appears in the external DB, then she is enroled in the course. If she doesn't, then she's unenroled. There's no concept of enrolment duration: either she is or she isn't.

So in order to achive what you want, you'd need to remove the students from your externa DB after the right period of time.

On the other hand, if you want Moodle to keep track of enrolment durations, then you need to use 'manual' enrolments. That doesn't mean you need to enrol students by hand. You can use 'flat file enrolment' and specify the starting and ending time for the enrolments (beware, you need to use Unix timestamp values here).

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: Enrolment Duration and External DB Enrolment

by Stephen Martin -
Thanks!

Looks like 'flat file enrolment' is what I'm looking for.

Excellent!