Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-62

Rendered match questions don't restore when you try to restore a backup file.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.2
    • 1.9
    • None
    • ALL.
    • Any
    • MOODLE_16_STABLE
    • MOODLE_19_STABLE

    Description

      The rendered match question type isn't restored. I have renderedmatch installed on moodle 1.6.2 but they wouldn't restore.

      here is a fix.
      open question/restorelib.php

      go to function restore_questions

      after this ..
      //If the question exists, only record its id
      if ($question_exists)

      { $newid = $question_exists->id; $creatingnewquestion = false; //Else, create a new question }

      else

      { //The structure is equal to the db, so insert the question $newid = insert_record ("question",$question); $creatingnewquestion = true; }

      ADD THIS...

      /new stuff/

      if($question->qtype=='renderedmatch'||$question->qtype=="13")
      {
      $x=0;
      $test=1;
      $question_renderedmatch_sub->question=$newid;
      $question_renderedmatch->question=$newid;

      while($test!=2)
      {
      if(!empty($que_info'#'['RENDEREDS']['0']'#'['RENDERED'][$x]))

      { $question_renderedmatch_sub->questiontext= backup_todb($que_info['#']['RENDEREDS']['0']['#']['RENDERED'][$x]['#']['QUESTIONTEXT']['0']['#']); $question_renderedmatch_sub->answertext= backup_todb($que_info['#']['RENDEREDS']['0']['#']['RENDERED'][$x]['#']['ANSWERTEXT']['0']['#']); $subid=insert_record ("question_renderedmatch_sub",$question_renderedmatch_sub); $subquest[$x]=$subid; }

      else

      { $test=2; }

      $x=$x+1;

      }
      $question_renderedmatch->subquestions=implode(",",$subquest);
      insert_record("question_renderedmatch",$question_renderedmatch);

      }
      /new stuff ends/

      not pretty but it works...

      Attachments

        Issue Links

          Activity

            People

              jmvedrine Jean-Michel Vedrine
              tomtrueluk Tom Trueluk
              Tim Hunt
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3/Mar/08