Error on Gift Question Import

Error on Gift Question Import

de Evan Donovan -
Número de respuestas: 4

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?

Promedio de valoraciones: -
En respuesta a Evan Donovan

Re: Error on Gift Question Import

de Joseph Rézeau -
Imagen de Core developers Imagen de Particularly helpful Moodlers Imagen de Plugin developers Imagen de Testers Imagen de Translators

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

En respuesta a Joseph Rézeau

Re: Error on Gift Question Import

de Jean-Michel Védrine -

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.