/** * Generate the display of a question in a particular state, and with certain * display options. Normally you do not call this method directly. Intsead * you call {@link question_usage_by_activity::render_question()} which will * call this method with appropriate arguments. * * @param question_attempt $qa the question attempt to display. * @param qbehaviour_renderer $behaviouroutput the renderer to output the behaviour * specific parts. * @param qtype_renderer $qtoutput the renderer to output the question type * specific parts. * @param question_display_options $options controls what should and should not be displayed. * @param string|null $number The question number to display. 'i' is a special * value that gets displayed as Information. Null means no number is displayed. * @return string HTML representation of the question. */ public function question(question_attempt $qa, qbehaviour_renderer $behaviouroutput, qtype_renderer $qtoutput, question_display_options $options, $number) { $output = ''; $output .= html_writer::start_tag('div', array('id' => 'q' . $qa->get_slot(), 'class' => implode(' ', array('que', $qa->get_question()->qtype->name(), $qa->get_behaviour_name(), $qa->get_state_class($options->correctness && $qa->has_marks()))))); $output .= html_writer::tag('div', $this->info($qa, $behaviouroutput, $qtoutput, $options, $number), array('class' => 'info')); $output .= html_writer::start_tag('div', array('class' => 'content')); $output .= html_writer::tag('div', $this->add_part_heading($qtoutput->formulation_heading(), $this->formulation($qa, $behaviouroutput, $qtoutput, $options)), array('class' => 'formulation clearfix')); $output .= html_writer::nonempty_tag('div', $this->add_part_heading(get_string('feedback', 'question'), $this->outcome($qa, $behaviouroutput, $qtoutput, $options)), array('class' => 'outcome clearfix')); $output .= html_writer::nonempty_tag('div', $this->add_part_heading(get_string('comments', 'question'), $this->manual_comment($qa, $behaviouroutput, $qtoutput, $options)), array('class' => 'comment clearfix')); $output .= html_writer::nonempty_tag('div', $this->response_history($qa, $behaviouroutput, $qtoutput, $options), array('class' => 'history clearfix')); $output .= html_writer::end_tag('div'); $output .= html_writer::end_tag('div'); return $output; }