|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| question_summary () | |
| right_answer () | |
| response_summary ($state) | |
| was_answered ($state) | |
| set_first_step_data_elements ($state, &$data) | |
| supply_missing_first_step_data (&$data) | |
| set_data_elements_for_step ($state, &$data) | |
| load_dataset ($selecteditem) | |
| format_float ($x, $length=null, $format=null) | |
| calculate ($expression) | |
| replace_expressions_in_text ($text, $length=null, $format=null) | |
Protected Member Functions | |
| parse_response ($state) | |
| calculate_raw ($expression) | |
| substitute_values_for_eval ($expression) | |
| substitute_values_pretty ($text) | |
Protected Attributes | |
| $selecteditem = null | |
| $values | |
| $search | |
| $safevalue | |
| $prettyvalue | |
Class for converting attempt data for calculated questions when upgrading attempts to the new question engine.
This class is used by the code in question/engine/upgrade/upgradelib.php.
Definition at line 39 of file upgradelib.php.
| calculate | ( | $ | expression | ) |
Evaluate an expression using the variable values.
| string | $expression | the expression. A PHP expression with placeholders like {a} for where the variables need to go. |
Definition at line 240 of file upgradelib.php.


| calculate_raw | ( | $ | expression | ) | [protected] |
Evaluate an expression after the variable values have been substituted.
| string | $expression | the expression. A PHP expression with placeholders like {a} for where the variables need to go. |
Definition at line 250 of file upgradelib.php.

| format_float | ( | $ | x, |
| $ | length = null, |
||
| $ | format = null |
||
| ) |
This function should be identical to qtype_calculated_variable_substituter::format_float(). Except that we do not try to do locale-aware replacement of the decimal point.
Having to copy it here is a pain, but it is the standard rule about not using library code (which may change in future) in upgrade code, which exists at a point in time.
Display a float properly formatted with a certain number of decimal places.
| number | $x | the number to format |
| int | $length | restrict to this many decimal places or significant figures. If null, the number is not rounded. |
| int | format 1 => decimalformat, 2 => significantfigures. |
Definition at line 221 of file upgradelib.php.

| load_dataset | ( | $ | selecteditem | ) |
Definition at line 181 of file upgradelib.php.


| parse_response | ( | $ | state | ) | [protected] |
Definition at line 83 of file upgradelib.php.


| question_summary | ( | ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 59 of file upgradelib.php.
| replace_expressions_in_text | ( | $ | text, |
| $ | length = null, |
||
| $ | format = null |
||
| ) |
Replace any embedded variables (like {a}) or formulae (like {={a} + {b}}) in some text with the corresponding values.
| string | $text | the text to process. |
Definition at line 287 of file upgradelib.php.


| response_summary | ( | $ | state | ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 114 of file upgradelib.php.

| right_answer | ( | ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 63 of file upgradelib.php.


| set_data_elements_for_step | ( | $ | state, |
| &$ | data | ||
| ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 155 of file upgradelib.php.

| set_first_step_data_elements | ( | $ | state, |
| &$ | data | ||
| ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 138 of file upgradelib.php.

| substitute_values_for_eval | ( | $ | expression | ) | [protected] |
Substitute variable placehodlers like {a} with their value wrapped in ().
| string | $expression | the expression. A PHP expression with placeholders like {a} for where the variables need to go. |
Definition at line 265 of file upgradelib.php.

| substitute_values_pretty | ( | $ | text | ) | [protected] |
Substitute variable placehodlers like {a} with their value without wrapping the value in anything.
| string | $text | some content with placeholders like {a} for where the variables need to go. |
Definition at line 277 of file upgradelib.php.

| supply_missing_first_step_data | ( | &$ | data | ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 151 of file upgradelib.php.
| was_answered | ( | $ | state | ) |
Reimplemented from question_qtype_attempt_updater.
Definition at line 134 of file upgradelib.php.
$prettyvalue [protected] |
Definition at line 57 of file upgradelib.php.
$safevalue [protected] |
Definition at line 51 of file upgradelib.php.
$search [protected] |
Definition at line 45 of file upgradelib.php.
$selecteditem = null [protected] |
Definition at line 40 of file upgradelib.php.
$values [protected] |
Definition at line 42 of file upgradelib.php.