This forum post has been removed
Number of replies: 16You 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
This forum post has been removed
This forum post has been removed
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.
This forum post has been removed
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.
This forum post has been removed
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.
This forum post has been removed
This forum post has been removed
This forum post has been removed
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.
This forum post has been removed
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.
This forum post has been removed
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