MDL-32188 quiz/question: behaviours can add to the review summary.

At the top of the quiz reivew page, there is a table that summarises
infomration about the quiz attempt as a whole. For some question
behaviours, we would like to be able to add additional information to
that summary.

This commit introduces a generic method for the behaviour to provide
summary information about an entire question usage.
This commit is contained in:
Tim Hunt
2013-10-04 17:52:16 +01:00
parent f3460297a9
commit 474aa125ca
5 changed files with 74 additions and 1 deletions
+23
View File
@@ -326,6 +326,29 @@ class question_usage_by_activity {
return $mark;
}
/**
* Get summary information about this usage.
*
* Some behaviours may be able to provide interesting summary information
* about the attempt as a whole, and this method provides access to that data.
* To see how this works, try setting a quiz to one of the CBM behaviours,
* and then look at the extra information displayed at the top of the quiz
* review page once you have sumitted an attempt.
*
* In the return value, the array keys are identifiers of the form
* qbehaviour_behaviourname_meaningfullkey. For qbehaviour_deferredcbm_highsummary.
* The values are arrays with two items, title and content. Each of these
* will be either a string, or a renderable.
*
* @param question_display_options $options display options. Indicates what types
* of information should, or should not, be returned.
* @return array as described above.
*/
public function get_summary_information(question_display_options $options) {
return question_engine::get_behaviour_type($this->preferredbehaviour)
->summarise_usage($this, $options);
}
/**
* @return string a simple textual summary of the question that was asked.
*/