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