1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
<?PHP // $Id: modifiednumericalqtype.php,v 1.1 2004/07/30 14:50:57 kaipe Exp $
///////////////////////////////
/// CALCULATED HELPER CLASS ///
///////////////////////////////
/// OVERRIDDEN EDITION OF THE CLASS FOR QUESTION TYPE NUMERICAL ///
class quiz_calculated_qtype_numerical_helper extends quiz_numerical_qtype {
/// A question with qtype=CALCULATED will appear as a NUMERICAL
/// question in a quiz and it is therefore desirable to reuse
/// most of the grading and printing framework.
/// However, the CALCULATED functions will be fed with data
/// that differs from what the NUMERICAL qtype can handle.
/// Therefore the CALCULATED qtype often act by modifying the data
/// it has been fed and then pass it on to the NUMERICAL equivalent.
/// The NUMERICAL equivalent are called through an instance of this class,
/// for which the method get_answers has been modified so that its
/// caller will be fed with data fed to the qtype CALCULATED and then
/// modified to fit qtype NUMERICAL.
// This solution assumes a single-threaded environment
// for each instance...
var $answers = false;
function get_answers($question, $addedcondition='') {
return $this->answers;
}
function set_answers($calculatedanswers) {
$this->answers = $calculatedanswers;
}
}
//// END OF CLASS ////
?>
|