Moodle Plugins directory: Use template on course creation | Moodle.org
Use template on course creation
This local plugin allows site administrators to create "template" courses which will be restored into new courses on course creation. The intended use case is defining common blocks and activities for a given academic term.
Usage
The administrator will need to create a "template" course which contains the desired blocks and resources. This course will need a specially-named short name. By default the plugin will search for a course with the short name Template-[TERMCODE], where [TERMCODE] is the matching value for YYYYYY. For example, if a course had the termcode 201610, the module would search for a course with the short name Template-201610.
The administrator will need to define a regular expression for extracting the term code from the course idnumber. This will be used to identify which course template (if any) should be used on creation. For example, if your courses have idnumbers in the format XXXXXX.YYYYYY, where YYYYYY is the termcode, then the regular expression /[0-9]+\.([0-9]+)/ will return YYYYYY.
The plugin listens on the \core\event\course_created event and fires immediately on course creation. Once you've given a course the necessary short name you don't need to do anything further. The plugin will create a backup of the template course and import it into the new course.
You should consider overriding Moodle's default block settings in config.php: $CFG->defaultblocks_override = '';. Otherwise you will get two sets of blocks on course creation. Manually configure the blocks in the template course instead.
It worked!
Thanks.
Ricardo
My template course is set to use "Weekly Format", but all my courses are being created in "Topic Format".
Is this the expected behavior?
Note: The activities and resources present in the template are copied when creating new courses.
Ricardo
Thanks for the reply.
Are the activities and resources created in the template all copied to the new course created? Or is there any restriction?
Ricardo
My name is Carlos Rodriguez I'm a LMS mMoodle administrator. I'm using "Use template on course creation" plugin.
I modified the termcode to PADRE-[TERMCODE], and the regex to /[A-Za-z0-9\.]+([A-Z0-9]{8,})/. These works for a secuence of 8 digits like the nex one: FEV21100.NRC65026, but doesen't work for a secuence of 9 digits like the next one: MGAV41200.NRC66042
How should I modify the regex so that it woks for 8 and 9 digits?
I appreciate any help
Regads,
Carlos Rodriguez,
That ought to work. Assuming you're just trying to match everything to the right of the period, you could also do /[A-Za-z0-9]+\.([A-Z0-9]{8,})/.
Charles
The plugin worked fine for a few days, but rigth now isn´t working in our production application server.
But in our Test server is working fine. How can I see the log file of this plugin, in order to try to determinate th issue?
I appreciate any help
Regads,
Carlos Rodriguez,
We solve the issue. The plugin is working.
But we see the next thing. Of 5 courses, the plugin imports the content in 3 courses. But in the two remaining courses, remain still in blank.
We made many tests, and take other courses, but the plugin only import the content in 3 courses.
We have a question. How many courses can import the plugin at same time? Is possible that we have so many element in the course, and that's why the plugin stops?
I appreciate any help
Regads,
Carlos Rodriguez,