moodle 2.1 :: Make the multianswer questiontype aware of other sub-question types

moodle 2.1 :: Make the multianswer questiontype aware of other sub-question types

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

I'm sure this has been discussed already in this Quiz forum or the tracker but cannot find references, so here we go...

I was expecting that the new question engine (moodle 2.1) would have made provision in the multianswer question type for any question type to choose to be "embedded".

At the moment, only those three "legacy" question types are recognized by question/multianswer/questiontype.php:

public function requires_qtypes() {
        return array('shortanswer', 'numerical', 'multichoice');
    }

... which means that my REGEXP question type, based on shortanswer, is not recognized by and cannot be embedded in a Cloze/multianswer question. I have to resort to providing a question/multianswer/questiontype.php replacement file, which of course I would like to avoid.

What I would like instead is for each question type to kind of declare itself "multianswer compatible". Something like:

    public function is_usable_by_multianswer() {
        return false/true;
    }

Tim, any thoughts about this?

Joseph

Average of ratings: -
In reply to Joseph Rézeau

Re: moodle 2.1 :: Make the multianswer questiontype aware of other sub-question types

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

Well, yes. This is the one remaining bit of MDL-2727, so it has been an issue for a very long time.

The problem is not having a is_usable_by_multianswer or something like that.

The real issue is the code that takes the questiontext and parses it into subquestions. How do we make that plug-in-able?

In reply to Tim Hunt

Re: moodle 2.1 :: Make the multianswer questiontype aware of other sub-question types

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

Thanks for the reference to that 6 year-old wink entry in the tracker, Tim.

In Moodle versions prior to 2.1, hacking the multianswer question to make it "accept" the REGEXP question type was really easy : it only meant modifying or adding about a dozen lines in question/type/multianswer/questiontype.php. Mostly following upon the SHORTANSWER bits.

However, in the new question engine, the changes I have to make are spread over several files (about 5 files...) which makes things more difficult.

I can only repeat the request that was made 6 years ago : please make 3rd-party question types more "pluggable", especially into the multianswer question.

Joseph