General developer forum

(local)plugin who determines next question based on CUSTOM RULES?

 
Picture of Michel Schilder
(local)plugin who determines next question based on CUSTOM RULES?
 

Is it possible to create a (local) plugin that determines the next question in a test, based on custom rules?

Those rules are like 'after wrong answer in question from category 1,  loads a next question from that category, with a label 'controle question' and other rules we want to define in the plugin.

Who can send me in the right direction?  (I'm working with PHP for more then 10years, but plugin/moodle development is new to me)

Thanks in advance!

 
Average of ratings: -
Picture of AL Rachels
Re: (local)plugin who determines next question based on CUSTOM RULES?
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Michel,

So far as I know, what you want is not currently possible with a quiz, but can be done with a Lesson activity. In a lesson, each answer can be set take you to another specific page tailored to the selected answer.

 
Average of ratings: Useful (1)
Picture of Marcus Green
Re: (local)plugin who determines next question based on CUSTOM RULES?
 
Average of ratings: Useful (1)
Tim at Lone Pine Koala Sanctuary
Re: (local)plugin who determines next question based on CUSTOM RULES?
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

As Marcus cryptically hints, you would need to develop a whole new activity module for this - one that uses the question system: https://docs.moodle.org/dev/Using_the_question_engine_from_module.

 
Average of ratings: Useful (1)
Picture of Michel Schilder
Re: (local)plugin who determines next question based on CUSTOM RULES?
 

I found that plugin before, but was asking myself if there where other ways to go. 

The combination of this plugin and the documentation 'Using_the_question_engine_from_module' is opening some doors.

I think it's best to re-use most of the code of this plugin because my needs are simulair, which of course also saves me a lot of time. 

Thanks!

 
Average of ratings: -
Picture of Marcus Green
Re: (local)plugin who determines next question based on CUSTOM RULES?
Core developersParticularly helpful MoodlersPlugin developersTesters

You might also look at the Simple Lesson Module from Richard Jones

https://www.elearningworld.org/author/rjones/

That doesn't implement question based branching at the moment but the author seems to have been thinking about it because there is a branch that refers to question branching.

https://github.com/richardjonesnz/moodle_mod_simplelesson/tree/question_branching

For me one of the issues with this is to make the selection of the next question and the interface to setting it up easy enough for normal people to understand. The problem is that if you have the knowledge to build something like this and are reading this thread then you are probably not in my definition of normal (grins)


 
Average of ratings: -
Picture of Michel Schilder
Re: (local)plugin who determines next question based on CUSTOM RULES?
 

I will definately take a look at that!
Seems also promising to me, and perhaps another great starting point.


Thanks!

 
Average of ratings: -
Picture of Marcus Green
Re: (local)plugin who determines next question based on CUSTOM RULES?
Core developersParticularly helpful MoodlersPlugin developersTesters

I have been meaning to ask Richard about his thoughts on branching, heloooooo Richard!

 
Average of ratings: -