Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-6480

Import of multichoice questions in Moodle XML format doesn't use shuffle option. Fix included

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.1
    • 1.6.3
    • Questions
    • None
    • MOODLE_16_STABLE
    • MOODLE_16_STABLE

    Description

      The Moodle XML import (1.6.1+) for multichoice questions does not take into account if
      <shuffleanswers>1</shuffleanswers>
      exists in XML file. The problem is in function import_multichoice in format/xml/format.php.
      I took the code from import_matching function in that file. The diff is shown below and resolves the problem.

      — format.php 2006-09-07 14:12:24.124627200 +0200
      +++ format.php.2 2006-08-27 14:15:39.515446400 +0200
      @@ -120,15 +120,10 @@

      // 'header' parts particular to multichoice
      $qo->qtype = MULTICHOICE;
      $single = $question'#'['single'][0]'#';
      $qo->single = $this->trans_single( $single );

      • if (!empty($question'#'['shuffleanswers'])) { - $qo->shuffleanswers = $question['#']['shuffleanswers'][0]['#']; - }

        else

        { - $qo->shuffleanswers = false; - }

      // run through the answers
      $answers = $question'#'['answer'];
      $a_count = 0;
      foreach ($answers as $answer) {

      Attachments

        Activity

          People

            timhunt Tim Hunt
            fikar Miroslav Fikar
            Nobody Nobody
            Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Oct/06