MDL-27649 support question variants as a first-class concept in the question engine.

This commit is contained in:
Tim Hunt
2011-05-26 21:23:56 +01:00
parent f55192bf08
commit 1da821bbde
46 changed files with 283 additions and 98 deletions
+18 -1
View File
@@ -157,8 +157,10 @@ abstract class question_definition {
*
* @param question_attempt_step The first step of the {@link question_attempt}
* being started. Can be used to store state.
* @param int $varant which variant of this question to start. Will be between
* 1 and {@link get_num_variants()} inclusive.
*/
public function start_attempt(question_attempt_step $step) {
public function start_attempt(question_attempt_step $step, $variant) {
}
/**
@@ -190,6 +192,21 @@ abstract class question_definition {
return $this->html_to_text($this->questiontext, $this->questiontextformat);
}
/**
* @return int the number of vaiants that this question has.
*/
public function get_num_variants() {
return 1;
}
/**
* @return string that can be used to seed the pseudo-random selection of a
* variant.
*/
public function get_variants_selection_seed() {
return $this->stamp;
}
/**
* Some questions can return a negative mark if the student gets it wrong.
*