~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to mod/quiz/questiontypes/calculated/modifiednumericalqtype.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?PHP  // $Id: modifiednumericalqtype.php,v 1.1 2004/07/30 14:50:57 kaipe Exp $
 
2
 
 
3
///////////////////////////////
 
4
/// CALCULATED HELPER CLASS ///
 
5
///////////////////////////////
 
6
 
 
7
/// OVERRIDDEN EDITION OF THE CLASS FOR QUESTION TYPE NUMERICAL ///
 
8
 
 
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.
 
17
 
 
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.
 
22
 
 
23
    // This solution assumes a single-threaded environment
 
24
    // for each instance...
 
25
 
 
26
    var $answers = false;
 
27
 
 
28
    function get_answers($question, $addedcondition='') {
 
29
        return $this->answers;
 
30
    }
 
31
 
 
32
    function set_answers($calculatedanswers) {
 
33
        $this->answers = $calculatedanswers;
 
34
    }
 
35
}
 
36
//// END OF CLASS ////
 
37
 
 
38
?>