Question behavior with setting and ui

Question behavior with setting and ui

by Itamar Tzadok -
Number of replies: 4

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: -
In reply to Itamar Tzadok

Re: Question behavior with setting and ui

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

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.

In reply to Tim Hunt

Re: Question behavior with setting and ui

by Itamar Tzadok -

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

In reply to Itamar Tzadok

Re: Question behavior with setting and ui

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

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.

In reply to Tim Hunt

Re: Question behavior with setting and ui

by Itamar Tzadok -

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