General developer forum

Automating course creation with student and teacher enrollment

 
Picture of Donal O'keeffe
Automating course creation with student and teacher enrollment
 

Hi there,


I am developing a plug-in as part of a project I am doing in university.

I have a full moodle environment running locally and all works well.

One of the guidelines of my project is to make sure it is easily reproduceable, and I was wondering if there was a way to package all of my work up(including database) in order for other people to begin work on it without too much manual work. Is this possible?


Ideally I'd like to run a script which creates courses, enrolls students and enrolls lectures all at once.


Many thanks in advance,

Donal. 

 
Average of ratings: -
Picture of Mark Johnson
Re: Automating course creation with student and teacher enrollment
Core developersParticularly helpful MoodlersPlugin developers

You're already along the right lines by writing your code as a Moodle plugin, as this allows you to easily package it up and install it in another Moodle environment.

If you're creating custom database tables, make sure do so by generating an install.xml with XMLDB to have them automatically created when someone installs your plugin (XMLDB may be able to reverse-engineer the install.xml if you already created the tables manually).

Moodle will also execute db/install.php in your plugin as part of the install process, so you can put code in there to set up initial data that's required by the plugin.  However, if this is just example data for development, you might want to write unit/behat tests instead with setUp/Background code that creates the data before running each test.


 
Average of ratings: Useful (2)
Picture of Donal O'keeffe
Re: Automating course creation with student and teacher enrollment
 

Thanks very much for your response.

I'll have a look at these and see how I get on.

 
Average of ratings: -