Automate and programmatically clone/copy and existing course

Automate and programmatically clone/copy and existing course

Jerry Lau -
回帖数:3

Hello folks.

We are using Moodle 3.11 and beta testing version 4.1 dev and this idea came up

Is there a way to programmatically on the backend write a program or script to "copy" and create a new course from an existing course the users wishes to copy from rather than doing it manually?

For example, if I have a web form which ask the users to:

  1. Select the category of the course they wish to copy (dropdown).
  2. Then it shows the courses within that category (dropdown) which the user selects.
  3. Then it shows a dropdown of the categories that the user wishes to put the copied course into.
  4. Then optionally, it has a text field of what the "nw" title of the course name is going to be.
  5. They click on Next and it then triggers some sort of db or php script to get that course and data they selected and creates it in the category they selected.

Is this possible and what are the points of problem that may come up if this can be done?

thanks

Dave


回复Jerry Lau

Re: Automate and programmatically clone/copy and existing course

Flotter Totte -
Plugin developers的头像
Hi Dave, take a look at the "course templates" plugin, I think it does what you are looking for: https://moodle.org/plugins/local_course_templates
Flotter
回复Flotter Totte

Re: Automate and programmatically clone/copy and existing course

Jerry Lau -
thank you but this is done manually..

I want to do it programmatically from our SIS system once a new class is created in the SIS ERP, then is triggered to create the moodle course from a template.. not sure if possible as they are 2 distinct platforms and tech stack
回复Jerry Lau

Re: Automate and programmatically clone/copy and existing course

Flotter Totte -
Plugin developers的头像
Oh, ic.... the 5 steps you mentioned are not what you are looking for (to be manually) but what you want to automate. Did you already take a look at this plugin? https://moodle.org/plugins/local_course_template (almost same name as the previous one I mentioned, but focused on automating template based course creation).