Hey gang. Long-time coder, first-time moodler here.
We are basically trying to design a PHP library here that can add a course and then add modules to it automatically based on a CSV file (or YAML or JSON file, etc).
This is specifically for Moodle 1.9.13 (Build: 20110801)
Apparently, in order to do this, there is a multi-step process that is only sporadically documented throughout the vast, untold recesses of the internet world.
Creating courses is relatively simple using the function create_course inside lib.php.
I'm having some big problems adding a module in the same way using add_course_module!!
I can create a new course using add_course_module, and this DOES show up in the mdl_course_modules database, however the instance value of courses I create this way is always 0, whereas with courses created through the API seem to populate automatically.
What am I missing here?
How do I,
1) Find out the instance of a newly created module,
2) "Type" the module as a label, an swf, etc...
3) Use code to add the module to a course and section?
Thank you,
DS