Use template on course creation

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.
Price option: Free

Supports Moodle 3.1-5.2 See all versions
Latest release: 3 years ago
Installations: 337
Downloads (last 90 days): 160

Frankenstyle name: local_course_template
Local plugins

Comments

Product ratings and reviews are coming to Moodle Marketplace. Until then, existing comments remain available to read, but new posts have been disabled.

Hi Stefan, not with the current version of the plugin. Adding an explicit configuration option to allow targeting all new courses (without regard for the idnumber) is a possible enhancement for a future release.
hi charles - is it possible to forego the regex and just use the same template for all courses? our courses are automatically created without any specific ID
Ah, my bad - it appears to be working now, thanks for the assistance!
Hi Brian, the plugin looks at the idnumber and not the shortname of a newly-created course. Please see https://github.com/LafColITS/moodle-local_course_template/wiki for specific examples.
Charles
I'm trying to get this plugin working, but having no luck so far...when I manually create a course that should match the pattern, my template content does not show up in the course.
Course short names are as follows:
SUBJ--NUM_YYYY-TT_SEC (ENG--900_2017-SP_01 as an example)
Current term extraction pattern:
/([0-9]+\-[A-Z]+)/ (should return 2017-SP for the example course short name above)
Template name format:
Template-[TERMCODE]
Template Course Name:
Template-2017-SP
So if I create a test course with the short name ENG--900_2017-SP_01, it does not seem to be triggering the automatic restore from the template. Any thought as to what might be wrong? Maybe the regex?
Thanks Charles,
I tried using your supplied regex, but the plugin still doesn't work. I have also tried other regex codes I found through Google (Stackexchange). I don't believe the regex is the issue here. Any other ideas what may be wrong?
Mable Simons
That regex seems wrong to me. If you're trying to get 1 from an idnumber of 1-002-02 you'd want to return the first digit, not a later digit. Something like this ought to work: /^(\d)-\d+-\d+/
Charles
Hello,
I am trying to get this plugin to work, but it has thus far not done anything for me. The plugin has installed correctly, and I can find its details in Local Plugins/Use template on course creation. I have set the term code to /^[^\d]*(\d+)/ and the shortname format to Template-[TERMCODE]
I have created a template in the Miscelaneous category. It is titled "Certificate Template", has the shortname "Template-1", and includes a forum activity and a standard block.
I create a new course in a separate category with a title of, let's say "foo" and a shortname of "bar". Its idea is "1-002-02". The regex code should return a "1" in this situation. However, when I view my created course, it does not look like it fits the template I created. Does anyone know why this has happened?
Best regards,
Mable Simons
Dear Charles,
Thank you for sharing your extremely useful plugin. You saved my time a lot and plugin is extremely useful for me.
@Mar
This is really useful. For example, I need to create many courses for students projects. Each student should have a course to collaborate with the supervisor. I created template course with predefined structures and assign a shortcode. Then, when I create a course, I enter the course template idnumber to match a template course shortcode. The plugin automatically creates the structure. Otherwise, I have to restore one by one. This is really useful if you are creating many courses with the same structure.
@ charles
I found a minor issue:
The plugin can create only sections up to the number of sections in course default settings. If the course default sections are less than the number of sections of the template, extra sections will not create. If I set a number of default sections to a higher number, the plugin will create sections with default section names. This is a minor issue if someone has many course templates with a different number of sections.
Best Regards
Ranil
Hi Mar, I'm not really in a place to make that recommendation. The plugin works automatically so long as the correct preconditions are met. If you've been creating courses manually then it'll absolutely be faster.
Hi!
Until now, we have used backup and restore in a new course for creating courses with similar structure and content. In this case, we maintain the content configured but not the Settings of the course. I'd like to know the advantage of using this plug-in instead of a backup. I guess that the time consumed restoring a course is much longer than the time for creating a course from a template. Could you please confirm it and provide more advantages (if possible) in using the plugin? I would like to install it in our Moodle but I need to provide all the advantages to the management in order to make a decision.
Thank you very much!!
This plugin uses a specialized form of regex. It uses 'preg_match'
- http://php.net/manual/en/function.preg-match.php
- http://php.fnlist.com/regexp/preg_match
Hi, this is a really interesting plugin, we have been working on course templating but in our system we have a category called "templates" and below that mirror the wider category of Moodle. In short this allows us to apply different templates at any category level, if not template is found for that category then the next one above it is used so as long as you have a template set for the top / site level category then one will always be applied. This allows us to apply slightly different templates for different schools / faculties. I just thought I would mention this as it could be a useful feature to add to your own plugin.
The regular expression is needed in order to the parse the idnumber of the new course and extract the term code. The term code is then used to identify which template course to use, if any.
Hi Charles,
I understand that i have to create a template course in which the short name contains the template id. Subsequently I can create courses by giving them a course id that triggers the course creation by using the template id. I don't understand the part of a regular expression. How and where to do what? Could you describe that?