Lesson

Error on Gift Question Import

 
Picture of Evan Donovan
Error on Gift Question Import
 

I tried importing the attached file of questions into the Lesson module, which should be in the GIFT format (it was automatically generated), and I got the following error:

"Fatal error: Call to undefined method qformat_gift::error() in/document-root/moodle/question/format/gift/format.php on line 228

Should there be an error method defined in the qformat_gift class?

 
Average of ratings: -
Picture of Joseph Rézeau
Re: Error on Gift Question Import
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Which version of Moodle?

 
Average of ratings: -
Picture of Evan Donovan
Re: Error on Gift Question Import
 
Average of ratings: -
Picture of Joseph Rézeau
Re: Error on Gift Question Import
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Evan "(it was automatically generated"

How was this gift file generated? did you export a set of questions previously created in the Moodle question bank? Which type of questions are they?

That gift file cannot be imported into the question bank nor in the Lesson activity.

Joseph

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: Error on Gift Question Import
Core developersPlugin developers

Hello Joseph,

You are right, this file can't be imported as it doesn't contains questions in a valid GIFT syntax. There is something wrong in the way it has been generated.

But as the same time as lesson is "stealing" question imports formats from the question component, it should define a proper error method so that errors are correctly reported to users, don't you think so ?

The problem is not in gift format it is in mod/lesson/format.php in the qformat_default  class where something like:

    /**
     * Handle parsing error
     */
    protected function error($message, $text='', $questionname='') {
        $importerrorquestion = get_string('importerrorquestion', 'question');

        echo "<div class=\"importerror\">\n";
        echo "<strong>$importerrorquestion $questionname</strong>";
        if (!empty($text)) {
            $text = s($text);
            echo "<blockquote>$text</blockquote>\n";
        }
        echo "<strong>$message</strong>\n";
        echo "</div>";
    }

should be added.

 
Average of ratings: -