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

Quiz renderer using wrong tag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.4.6, 2.5.2
    • 2.5
    • Quiz
    • MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • 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.

      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.

            timhunt Tim Hunt
            fzillner Florian Zillner
            Frédéric Massart Frédéric Massart
            Sam Hemelryk Sam Hemelryk
            Adrian Greeve Adrian Greeve
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.