Quiz

new course format with automatic quiz creation

 
Picture of Francesco Pisano
new course format with automatic quiz creation
 

Hello,

I have to create a new course format, very similar to the "topics format" but I need that it creates a quiz activity automatically on course creation, like the "topics format" automatically creates the "Announcements" activity .


I have already done the clone of "topics format".
But I don't know where, and how, I have to implement the automatic creation of that activity.


This is a step of a bigger job: I will work step by step.

My moodle version is 3.4


Thanks,

  Francesco

 
Average of ratings: -
Picture of AL Rachels
Re: new course format with automatic quiz creation
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Francesco,

Couldn't you just create a course with your quiz, make a backup of the course, then whenever you need a new course, restore your backup as a new course. After the restore, rename the course to whatever you need it to be.

 
Average of ratings: -
Picture of Francesco Pisano
Re: new course format with automatic quiz creation
 

Hi Al,

thank you for your advice.


But I have to create a plugin not just for me, than i have to create a new course format.


sad

 
Average of ratings: -
Picture of Marcus Green
Re: new course format with automatic quiz creation
Core developersParticularly helpful MoodlersPlugin developersTesters

You might approach this by having a backup of a quiz and triggering the programmatic restore of that quiz.

 
Average of ratings: -
Picture of Francesco Pisano
Re: new course format with automatic quiz creation
 

Hi Marcus,

thank you for your advice.


But I have to create a plugin not just for me, than i have to create a new course format.

sad


 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: new course format with automatic quiz creation
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

There are two ways we handle this sort of requirement at the Open University:

  1. We have an admin tool to create courses, from a given template. In the plugin, when you press the button, it uses various Moodle APIs to create the course, set some settings, and add some activities, blocks etc.
  2. For some of our course formats, whenever the admin visits the course page (any user with moodle/site:config capability) it checks some settings and other things, and if they are not set the way we want, sets the back to that way.

 
Average of ratings: -
Picture of Francesco Pisano
Re: new course format with automatic quiz creation
 

Hi Tim,

thank you for your answar.


can you advice some Api for solve my promblem?


I have already cloned the "topics format" but I don't know where i have to write code (and which code) to add an activity automatically.


For the moment my new course plugin is the same of "topics format" but with a different name. And it works.


Have you got some advice?


Thank you again,

 Francesco

 
Average of ratings: -