Need help in creating new course format (new plugin)

Need help in creating new course format (new plugin)

by Francesco Pisano -
Number of replies: 4

Hi!

I've to create a new course format based on "topics format".

For the moment I'd like to keep the basic structure of "topics format" with the addition of an empty quiz (that is created automatically).

I made a clone of "topics format" but I can not find where I need to modify the source code (and which one) to add the quiz.

I'm using Moodle 3.4

thanks to everyone.

Average of ratings: -
In reply to Francesco Pisano

Re: Need help in creating new course format (new plugin)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Copy the directory course/format/topics to a new one called whatever you like. 

Change every reference to topics to your new name so you have a clone that does the same but is named differently

Make code changes to do what you need. 

This, by the way, is a vast oversimplification. Give us a shout if you get stuck but you're going to have to have a go. At the moment you are basically asking us to do it for you. 

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Need help in creating new course format (new plugin)

by Francesco Pisano -

thank you very much, 

I have already created the clone of topics format but I do not understand in which source file should add the code for the automatic creation of a quiz. In "format.php"?


In reply to Francesco Pisano

Re: Need help in creating new course format (new plugin)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Is this really a course format thing? I would trap the course creation event and add a new activity then. 

In reply to Howard Miller

Re: Need help in creating new course format (new plugin)

by Francesco Pisano -

Hi!

Yes. I've to create a new plugin. I try to explain step by step.


STEP 1:
I have cloned the "topics format" and replaced all occurrences of "topics". I zipped and loaded it, and moodle recognizes it.

At the moment in the format selection menu I have one more option (which is actually identical to "Topics format" but wwith a different name).

STEP 2:
Now I'd like to modify the sourse code for creating a quiz automatically on crourse creation (like "Announcements" activity). But I do not know how to do it.

Others step when I will complete the step 2 smile

Thank you