/**
- * A subclass with a bit of additional funcitonality, for pending steps.
+ * A subclass of {@link question_attempt_step} used when processing a new submission.
+ *
+ * When we are processing some new submitted data, which may or may not lead to
+ * a new step being added to the {@link question_usage_by_activity} we create an
+ * instance of this class. which is then passed to the question behaviour and question
+ * type for processing. At the end of processing we then may, or may not, keep it.
*
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class question_attempt_pending_step extends question_attempt_step {
- /** @var string . */
+ /** @var string the new response summary, if there is one. */
protected $newresponsesummary = null;
+ /** @var int the new variant number, if there is one. */
+ protected $newvariant = null;
+
/**
* If as a result of processing this step, the response summary for the
* question attempt should changed, you should call this method to set the
$this->newresponsesummary = $responsesummary;
}
- /** @return string the new response summary, if any. */
+ /**
+ * Get the new response summary, if there is one.
+ * @return string the new response summary, or null if it has not changed.
+ */
public function get_new_response_summary() {
return $this->newresponsesummary;
}
- /** @return string whether this step changes the response summary. */
+ /**
+ * Whether this processing this step has changed the response summary.
+ * @return bool true if there is a new response summary.
+ */
public function response_summary_changed() {
return !is_null($this->newresponsesummary);
}
+
+ /**
+ * If as a result of processing this step, you identify that this variant of the
+ * question is acutally identical to the another one, you may change the
+ * variant number recorded, in order to give better statistics. For an example
+ * see qbehaviour_opaque.
+ * @param int $variant the new variant number.
+ */
+ public function set_new_variant_number($variant) {
+ $this->newvariant = $variant;
+ }
+
+ /**
+ * Get the new variant number, if there is one.
+ * @return int the new variant number, or null if it has not changed.
+ */
+ public function get_new_variant_number() {
+ return $this->newvariant;
+ }
+
+ /**
+ * Whether this processing this step has changed the variant number.
+ * @return bool true if there is a new variant number.
+ */
+ public function variant_number_changed() {
+ return !is_null($this->newvariant);
+ }
}