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

Improve rendering of correct answers in qtype_multichoice questions.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.5.3
    • Fix Version/s: FRONTEND
    • Component/s: Questions
    • Labels:
    • Affected Branches:
      MOODLE_25_STABLE

      Description

      We believe that the rendering of the correct answers of multichoice questions in student reviews is sub-optimal.
      We wrote an improvement in our theme which I herewith submit as a possible improvement to
      question/type/multichoice/renderer.php

      --------------------------------------
      require_once($CFG->dirroot . '/question/type/rendererbase.php');
      require_once($CFG->dirroot . '/question/type/multichoice/renderer.php');

      class theme_university_qtype_multichoice_multi_renderer extends qtype_multichoice_multi_renderer {

      public function correct_response(question_attempt $qa) {
      $question = $qa->get_question();
      $order = $question->get_order($qa); // Order of the answers.

      $right = array();
      foreach ($order as $key => $answerid) {
      $ans = $question->answers[$answerid];
      if ($ans->fraction > 0)

      { $right[] = $this->number_in_style($key, $question->answernumbering) . $question->make_html_inline($question->format_text($ans->answer, $ans->answerformat, $qa, 'question', 'answer', $answerid)); }

      }

      if (!empty($right))

      { $output = get_string('correctansweris', 'qtype_multichoice', ''); $output .= '<ul style="list-style-type: none;"><li>'; $output .= implode('</li><li>', $right); $output .= '</li></ul>'; return $output; }

      return '';
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jzimmer Juergen Zimmer
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: