Use template on course creation

Local plugins ::: 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:
340 sites
305 downloads
54 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

Show comments
  • Ricardo Caiado
    Mon, Sep 11, 2023, 5:03 AM
    Hi, Charles.

    It worked!

    Thanks.

    Ricardo
  • Ricardo Caiado
    Mon, Sep 18, 2023, 12:48 AM
    Hi, Charles.

    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
  • Charles Fulton
    Mon, Sep 18, 2023, 10:04 PM
    Hi Ricardo, that's expected behavior. New courses are still created according to the course creation defaults in site administration, which includes both the course format and the number of topics.
  • Ricardo Caiado
    Mon, Sep 18, 2023, 10:43 PM
    Hi, Charles,

    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
  • Charles Fulton
    Mon, Sep 18, 2023, 10:45 PM
    No restriction. If they're in the template course and they're backed up, they should be restored in the new course. The only thing the plugin does is make sure you don't have two copies of the Announcements forum.
  • Bruce Wilbee
    Fri, Apr 5, 2024, 2:15 AM
    We are creeping through our implementation and everything seems to be working well. We are using an external database to handle enrollments and course creation. Has anyone seen anything which will populate course start and end dates based on the dates in the external database?
  • Rob Lowney
    Tue, Jun 4, 2024, 5:23 PM
    Our Moodle hosting partner has just installed this plugin for us and it seems to be working well, however I've encountered something odd and I wonder if anyone has any suggestions? Our SIS created about 2000 Moodle courses in bulk and as expected this plugin restored a template to each one of the new courses. However for about 400 courses, the template didn't restore fully. Our template has four resources in it (two forums, one book, one URL), and in those 400 courses, only one, two or three of the resources were restored into the course. It's as if the backup failed to restore completely. Has this occurred for anyone else and if so, are you aware of any resolution? Thanks!
  • Charles Fulton
    Tue, Jun 4, 2024, 9:31 PM
    Hi Rob, that's an odd problem. At our local institution we've done about 800 without that error occurring, although it's possible that it did happen and no one noticed. I'm not sure a partial backup failure would leave any trace in the logs. Any chance your temporary directory was low on disk space during the process?
  • Rob Lowney
    Sun, Jun 23, 2024, 10:27 AM
    Thanks for the reply Charles - we managed to get to the bottom of it, the issue was actually on the SIS side, not Moodle. We are new to using Banner from Ellucian. We discovered a setting in the console for the Banner-Moodle integration (called "ILP"). If we set the 'concurrency' to the minimum of 1, it seems to create courses on Moodle in a slow and steady manner and allows the plugin to restore the template to each course. So all working well now. Thanks for creating this great plugin, it's going to be crucial for our Moodle rollout each academic year.
  • Ed Wright
    Wed, Oct 23, 2024, 8:06 PM
    Hi, I have posted this on the Stash block page as well, but wondered if anyone had any ideas: If I place e.g. 20 stash items in a "template" course, then on course creation of a new course, the first stash item copies across, and then the whole process seems to fail, with no sections being copied to the new course, and no activities etc being copied across. If I remove the stash items from the template course then the new course is created successfully with all sections & content copied across. Thanks
  • swami silver
    Fri, Oct 25, 2024, 11:22 PM
    Hi Charles and Andrew Zito. Tnx for developing this.

    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,
  • Charles Fulton
    Sat, Oct 26, 2024, 2:20 AM
    Hi Carlos,

    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
  • swami silver
    Mon, Oct 28, 2024, 10:31 PM
    It Works Thanks Charles! Big hug.
  • swami silver
    Thu, Nov 14, 2024, 10:44 PM
    Hi 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,
  • swami silver
    Thu, Feb 20, 2025, 9:53 PM
    Hi Charles,

    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,
1 2 3 4 5 6
Please login to post comments