Use template on course creation

General plugins (Local) ::: local_course_template
Maintained by Charles Fulton, Andrew Zito
This local plugin allows site administrators to create "template" courses which will be restored into new courses on course creation.
Latest release:
314 sites
291 downloads
50 fans
Current versions available: 6

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. 

Screenshots

Screenshot #0

Contributors

Charles Fulton (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Cory Robbins
    Mon, 18 May 2020, 10:43 PM
    Just a heads up... It seems that it DOES work if I do a traditional backup and restore of my template course to a new course that begins with the shortname naming convention. I guess there may be an issue with when shortnames are changed? Anyway, it seems to be working.
  • Eric Phetteplace
    Sat, 13 June 2020, 2:23 AM
    I was struggling with getting this plugin to work while ignoring shortname (since the settings make it sound like everything hinges on idnumber) and creating courses that I _know_ match my regex from testing. Seeing Cory's comment, I changed my template's shortname to be the same as its idnumber and did the same with my created course—and it worked. So I don't know exactly what's going on but it seems like shortname is somehow related to the term code matching procedure.
  • Andrew Zito
    Sat, 13 June 2020, 2:44 AM
    I'm not sure I 100% follow the precise nature of the issue here (not assigning blame, this plugin has some jargon and complexity difficulties), but I can review the way the plugin works: The ID NUMBER of new courses is matched to the SHORTNAME of the template course. So the shortname of your template matters, the shortname of your new courses does not.
  • Joanna Beaver
    Mon, 27 July 2020, 5:55 PM
    Hello, I am using 3.9 version of the plugin and I'm finding that changes made after the template has been used are not showing in future courses created using that template. Are templates not amendable after first use?
  • Andrew Zito
    Mon, 27 July 2020, 7:18 PM
    Hi Joanna, it is the case that courses created based on the template will not be updated when you update the template, but it sounds like you are describing something else. You're saying that changes to the template are not reflected even in courses created after the template change was made?
  • Joanna Beaver
    Mon, 27 July 2020, 10:06 PM
    Hi Andrew, yes that's right. I found that I could create the template + save. Make changes to the template + save. Use the template to successfully create course 1. If I then modified the template and created course 2, it did not contain the changes I had just made and instead delivered me the same template as was served for course 1. It seemed as soon as the template was used once, it no longer reflected any subsequent changes.
  • Andrew Zito
    Mon, 27 July 2020, 11:39 PM
    Hi Joanna, we've discussed this internally and determined that what you're seeing is the caching behavior. For now, you'll have to clear the cache in between each change. We recognize that this is less than ideal, so we're going to look at making the caching behavior more intelligent.
  • Charles Fulton
    Sat, 1 Aug 2020, 1:05 AM
    Hi Joanna, we've released a new vesrsion (3.6.2) that allows you to disable the caching behavior. That should clear up the problem that you're encountering.
  • Charles Fulton
    Sat, 1 Aug 2020, 1:05 AM
    Hi Joanna, we've released a new vesrsion (3.6.2) that allows you to disable the caching behavior. That should clear up the problem that you're encountering.
  • Eric Phetteplace
    Sat, 8 Aug 2020, 4:22 AM
    I believe there's a bug in the most recent version (3.6.2) of this plugin. We're on 3.8.2. I upgraded and it started running a "\local_course_template\task\cleanup_task" every second, filling up the task queue and maxing out our task runners so no other tasks could complete. I tried turning off the new caching option but the behavior persisted. The plugin would not allow me to downgrade to 3.4.1 so I had to uninstall it.
  • Charles Fulton
    Sat, 8 Aug 2020, 4:54 AM
    Hi Eric, thanks for the report. That's unexpected; the task should run once at 3 AM server time. The caching behavior change shouldn't have affected that part of the plugin; we'll look into it right away.
  • Charles Fulton
    Thu, 13 Aug 2020, 1:00 AM
    Hi Eric, we've identified the cause of that failure and released a new version (v3.6.3) that addreses it. Thanks again for the report.
  • Eric Phetteplace
    Thu, 13 Aug 2020, 6:12 AM
    Glad to hear it! Thanks for your work on this plugin!
  • is it possible when a change is been made in main course, to be automatically to be added to the other courses?

    Thanks
  • Alexis Boza
    Fri, 2 Oct 2020, 2:27 AM
    Hi!!!

    The plugin does not work with the external database course creation right??

    I actually try it, and seems only work with individual course creation and bulk csv course creation.
Please login to post comments