General developer forum

 
 
Picture of Itamar Tzadok
Question behavior with setting and ui
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Trying to add review options on quiz score to a quiz without hacking the standard quiz. A specialized question behavior could be a possible approach. It could have its own database table to store the related settings per quiz. I'm wondering about pushing the qb ui into the quiz settings page. Any suggestions, or other approaches to the same effect would be greatly appreciated. smile

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Question behavior with setting and ui
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

I can't work out what you are trying to do, so it is hard to advise.

Adding qbehaviour settings to the quiz settings from sounds nonsensical to me.

 
Average of ratings: -
Picture of Itamar Tzadok
Re: Question behavior with setting and ui
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

I'm trying to add review options without hacking or extending the quiz module. As far as I can tell, a specialized question behavior could allow me to control the content of quiz review. The criterion could be quiz score, to the effect that correct answer would be displayed only when quiz score is above a passing grade. This might be possible by overriding the question behavior method that returns the correct answer. I suppose it shouldn't be difficult to add a database table to the question behavior plugin to store the criterion per quiz. But I need to add ui to set the criterion per quiz and I don't want to touch the quiz form or any part of the core module code. If the question behavior is instantiated by the quiz settings form I could probably add an action link to the settings block to open a form for the extra settings. But it is probably not instantiated. I could also use a designated block for that. And again, there may be a better way to do that without hacking the standard quiz module or creating a specialiazed quiz module. smile

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Question behavior with setting and ui
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

It sounds like http://docs.moodle.org/dev/Quiz_access_rules can do most of what you want.

The one bit that you cannot do without a small core change is to allow your access rule to change the review options based on the current attempt. What you would need to do is to find an appropriate place (search for mod_quiz_display_options::make_from_quiz and back-track) and then add a call like

$options = $quizaccessmanager->udpate_display_options($attempt, $options);

(You would also need to write the udpate_display_options method, which will require a new method on the access rule base class.)

If you do that, create a MDL bug, and submit your core changes as a patch. If adding this extra hook is helpful to you, it may help others in future too.

 
Average of ratings: -
Picture of Itamar Tzadok
Re: Question behavior with setting and ui
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Thanks Tim! I'll look into that and assign myself a tracker issue for the hook. smile

 
Average of ratings: -