Quiz Feedback

This forum post has been removed

Number of replies: 16
The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

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

You would need to follow https://docs.moodle.org/dev/Overriding_a_renderer, and use that technique to override qtype_multichoice_multi_renderer::correct_response, defined in question/type/multichoice/renderer.php

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

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

The only problem with editing the Moodle code is: what happens when you want to upgrade to a newer version of Moodle?

You will have to rememeber to make the same change again, or you will lose that customisation.

That is why there is an alternative way to do it (overriding the renderer) but you don't have to do it that way.

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

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

Here is a example of a theme, picked pretty much at random: https://github.com/CTANZ/moodle-theme_decaf

Note the file renderers.php. In there, you can override any renderers you like.

In that theme they do

class theme_decaf_core_renderer extends core_renderer {

https://github.com/CTANZ/moodle-theme_decaf/blob/master/renderers.php#L3

but you will need to do

class theme_mytheme_qtype_multichoice_multi_renderer
        extendsqtype_multichoice_multi_renderer{

When extending a class, you only need to put the methods you are changing, so copy and paste the original correct_response method with your changes.

This, of course, assumes you are using your own theme.

That is a very brief outline. Ask again if you need more help.

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

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

If you are doing any development, you need to turn on Debugging - set it to DEVELOPER level. Then when something blows up like this you are more likely to get clues.

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

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

Until you can get proper debugging messages, you won't get anywhere. Make a file test.php containing

<?php
require_once(dirname(__FILE__) . '/config.php');
echo 1/0;

save that in the top level of you Moodle site, then go to the URL http://my.test.moodle/test.php (or whatever it needs to be). That should show you the error

Warning: Division by zero in /fs1/www_root/tjh238/vle/test.php on line 3

Don't do anything else until you can get it to show you that error.

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

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

Ah, so question/type/multichoice/renderer.php should probably say

require_once($CFG->dirroot . '/question/type/rendererbase.php');

at the start. If you add that line to your file (before the 

include_once($CFG->dirroot.'/question/type/multichoice/renderer.php');

line) then it should work.

By the way, generally you should use require_once, not include_once.

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Quiz Feedback

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

I'm sure I've had this discussion (with Tim) before. The problem is that the list of MCQ choices can consist of short items (one word or a few words) OR longer items (a whole sentence or several short sentences).

In the case of short items, it makes them for the Correct answers list to be displayed as a comma-separated list of items. But in the case of longer items, especially sentences, I agree with Rolf that those longer items should be displayed as separate lines (maybe formatted as "list").

Joseph