Moodle plugins directory: Use template on course creation: Versions: v3.3.0 | Moodle.org
Use template on course creation
Use template on course creation v3.3.0
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.
Requirements
- Moodle 3.3 (build 2017051500 or later)
Installation
Copy the course_template folder into your /local directory and visit your Admin Notification page to complete the installation.
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.
Sample regular expressions
The basic use case above, /[0-9]+\.([0-9]+)/
, would return YYYYYY
from the following idnumbers:
9999.201610
3781.201730
A more complicated example, /[A-Za-z0-9\.]+([0-9]{6})/
, would capture the following:
4422.201610
7866a.201730
XLSB7201610
Acknowledgements
This plugin was inspired by the course enrollment/templating plugin in use at Wesleyan University. The restoration controller settings are derived from LSU's Simplified Restore block.
Author
Charles Fulton (fultonc@lafayette.edu)
Version information
- Version build number
- 2017082401
- Version release name
- v3.3.0
- Can be updated from
- v0.1.0 (2017030300), v0.2.0 (2017050900), v0.3.0 (2017082400)
- Can be updated to
- v3.4.1 (2018051301)
- Maturity
- Stable version
- MD5 Sum
- 9c58783adb5bf2f58d553786e8b59f32
- Supported software
- Moodle 3.3
- Latest release for Moodle 3.3
Version control information
- Version control system (VCS)
- GIT
- VCS repository URL
- VCS tag
- v3.3.0
Default installation instructions for plugins of the type General plugins (Local)
- Make sure you have all the required versions.
- Download and unpack the module.
- Place the folder in the "local" subdirectory.
- Visit http://yoursite.com/admin to finish the installation.