I am using the external database enrollment plugin with Inaka's patch and some modifications to bring over course category based on data coming from my external database. It works great! Now I need to add logic to create SubCategories based on data from the external database as well. Has anyone done this? I can see the subcategories are linked to the categories by number, so I am not sure what logic needs to be added to the php files to enable this.
You can get the original patch from http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db/
Where I can find documentation about your patch?
I search enrolment plugins on Moodle.org but I can't find your patch there. Why you don't want to put it on moodle.org?
Thanks for your attention,
Where I can find documentation about your patch?
The patch is quite self-explanatory. It only adds a few more settings, and all of them have a small text explaining their meaning.
Why you don't want to put it on moodle.org?
Because it's a patch against the standard code, not a full plugin, module or block. As such it's a bit more difficult to publish it on moodle.org, unless we put it in the CVS contrib area.
We could certainly add an entry in the modules/blocks/plugins database here on moodle.org, but just to put a link to the place where we publish our patches, be it as patches at orodruin.escomposlinux.org or as a git tree at git.eteo.mondragon.edu.
Would that help you?
P.S. We intend to make it part of the standard code, but we've been out of time in the last months to push it upstream.
I can see the subcategories are linked to the categories in the database by number, so I think using the integration to create Categories and the Subcategories within these categories could be quite hard since the external database will not contain the number associated with the category? Any ideas on how this might need to be done?
The way I'd do it is by having a setting specifying the category separator (e.g. '|'), so we can use a character that is not going to be used in our category names (which can vary form site to site).
And then when fetching the category of the course from the external database, analyze the path of the category and created all the (parent) categories needed. For example, if the category is 'Comp. Sc.|1st Year|Comp. Architecture', we'd need to make sure there is a top level 'Comp. Sc.' category (or otherwise create it at that level), then a '1st Year' below the previous one, etc.
We'd need to match categories by name (as we don't have the internal IDs available in the external database, as you say), so we'd need to make sure we have no duplicated category names at the same level (which Moodle currently permits). If they are at different levels, we can sort it out.
It's just a little more work, but should be doable in a day or so.
It was easier than I expected (in fact, it's taken almost more time to test it than to code it ;)).
Here is a patch to apply on top of my external db plugin improvement (1.9 only). It adds support for course category autocreation, with any levels of subsubcategories.
There are a couple of new settings:
- Category autocreation (Yes/No)
- Category separator: the character we use as the category separator in the external database field that holds the category for the course.
This new feature will be part of my external db plugin improvement from now on (in 1.8, 1.9 and HEAD only).
Wow! I didn't realize you were going to work on this! Thank you so much! You saved me hours of work and likely frustration. This is a great addition to the integration !!!
I really appreciate it!
But this reminds me of what I assume is my own ignorance. When I go to download the package from your www site (http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db/) I create the folder structure on my hard drive and then download each file into the appropriate place. Is there a short-cut way to download the entire package at once?
Is there a short-cut way to download the entire package at once?
No there wasn't. But since a couple of minutes, you can download a .zip or .tar.gz with all of the required files in it
I've been working on the subcategories integration you created. It works great to create the categories and subcategories, but I am having some trouble getting it to create additional courses in the subcategories once they exist.
Interestingly, if I move the category and subcategories to the top of my list of categories - it works fine. If I move it lower in the list, below some other categories - it stops working.
I am wondering if perhaps I have something configured slightly wrong. In my external database I have one field in a view that lists the category name +'/'+ subcategory name. This field is called category.
Then in the Enrollment configurations, in the category field I have the field name "category" and in my category separator field I have a /.
Did I configure something wrong? Should I perhaps have 2 separate columns in my view for the category and subcategory? Could this setup have something to do with my problems? Could the slash be causing confusion with existing categories and subcategories that seem to automatically be separated by a / in Moodle?
Weird part is if I make the integrated category and subcategories the first ones in the list of categories, everything works fine. Of course, my users want the category to be the bottom one in the list, so this doesn't help me much.
Any ideas? Any help would be great.
Just wanted to say I was able to resolve this. The issue turned out to be related to the sort order for the courses. My site had reached the maximum sort order allowed! Ugh.
Here is the link to the defect if anyone else needs it.
Or can it be published as module?
As such, we are trying to make it part of the standard plugin, but haven't had much success so far.
In any case, we are going to support it for the foreseeable future, as we are using it internally
After some trial I got in trouble - if I want to use existing course as template. It looks like it is picking up the correct course as template but it does not copies all of its block, resources, etc. The only thing I can see copied is the type of course (weekly, topics) but no attendance, quizzes, articles. It shows on the side block for the first time but once you click on any of them, I'm getting "no content" screen and after getting back to main course page those items disappears from side menu.
Is it some version incompatibilities? I am using 1.9.2 (build 20080917). Should I upgrade to most recent build?