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

Quiz renderer using wrong tag

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.4.6, 2.5.2
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      1. Create a quiz with some overall feedback.

      2. Attempt it as a student.

      3. After you sumit the attempt, finish review to get back to the view.php page.

      4. Under the attempts table, inspect the HTML around where it shows Overall feedback. Ensure that tags are properly nested.

      Show
      1. Create a quiz with some overall feedback. 2. Attempt it as a student. 3. After you sumit the attempt, finish review to get back to the view.php page. 4. Under the attempts table, inspect the HTML around where it shows Overall feedback. Ensure that tags are properly nested.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      In mod/quiz/renderer.php starting at around line 1086, there is this code:

      if ($viewobj->feedbackcolumn) {
       $resultinfo .= $this->heading(get_string('overallfeedback', 'quiz'), 3, 'main');
       $resultinfo .= html_writer::tag('p',
       quiz_feedback_for_grade($viewobj->mygrade, $quiz, $context), array('class' => 'quizgradefeedback'))."\n";
      }
      

      which generates the feedback for the actual quiz. In my case, the feedback entered by the teacher is something like <p>foo bar barfu</p>, whilst the text itself doesn't matter, it's the surrounding <p>-tags, generated by TinyMCE. The code above with the entered feedback populates to the following HTML:

      <div id="feedback" class="box generalbox">
      <h2 class="main">Bester Versuch: 5,00 / 10,00.</h2>
      <h3 class="main">Gesamt-Feedback</h3>
      <p class="quizgradefeedback"></p>
      <p>Sie haben das Modul abgeschlossen.</p>
      <p></p>
      </div>
      

      As one can see, the feedback isn't in the right spot, which should be the paragraph with the class I suppose. I didn't dig deeper in the html_writer class, but I'm guessing it's not nesting the paragraphs, hence the "wrong" HTML code above. I suggest changing the shown php code from html_writer::tag('p' to html_writer::tag('div' as it behaves as expected.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Sep/13