|
| calculate_raw ($expression) |
| Evaluate an expression after the variable values have been substituted.
|
|
| explode_answer ($state) |
|
| substitute_values_for_eval ($expression) |
| Substitute variable placehodlers like {a} with their value wrapped in ().
|
|
| substitute_values_pretty ($text) |
| Substitute variable placehodlers like {a} with their value without wrapping the value in anything.
|
|
| to_text ($html) |
|
◆ calculate()
qtype_calculatedmulti_qe2_attempt_updater::calculate |
( |
| $expression | ) |
|
Evaluate an expression using the variable values.
- Parameters
-
string | $expression | the expression. A PHP expression with placeholders like {a} for where the variables need to go. |
- Return values
-
float | the computed result. |
◆ calculate_raw()
qtype_calculatedmulti_qe2_attempt_updater::calculate_raw |
( |
| $expression | ) |
|
|
protected |
Evaluate an expression after the variable values have been substituted.
- Parameters
-
string | $expression | the expression. A PHP expression with placeholders like {a} for where the variables need to go. |
- Return values
-
float | the computed result. |
◆ format_float()
qtype_calculatedmulti_qe2_attempt_updater::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.
- Parameters
-
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. |
- Return values
-
◆ question_summary()
qtype_calculatedmulti_qe2_attempt_updater::question_summary |
( |
| ) |
|
◆ replace_expressions_in_text()
qtype_calculatedmulti_qe2_attempt_updater::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.
- Parameters
-
string | $text | the text to process. |
- Return values
-
string | the text with values substituted. |
◆ response_summary()
qtype_calculatedmulti_qe2_attempt_updater::response_summary |
( |
| $state | ) |
|
◆ right_answer()
qtype_calculatedmulti_qe2_attempt_updater::right_answer |
( |
| ) |
|
◆ set_data_elements_for_step()
qtype_calculatedmulti_qe2_attempt_updater::set_data_elements_for_step |
( |
| $state, |
|
|
& | $data ) |
◆ set_first_step_data_elements()
qtype_calculatedmulti_qe2_attempt_updater::set_first_step_data_elements |
( |
| $state, |
|
|
& | $data ) |
◆ substitute_values_for_eval()
qtype_calculatedmulti_qe2_attempt_updater::substitute_values_for_eval |
( |
| $expression | ) |
|
|
protected |
Substitute variable placehodlers like {a} with their value wrapped in ().
- Parameters
-
string | $expression | the expression. A PHP expression with placeholders like {a} for where the variables need to go. |
- Return values
-
string | the expression with each placeholder replaced by the corresponding value. |
◆ substitute_values_pretty()
qtype_calculatedmulti_qe2_attempt_updater::substitute_values_pretty |
( |
| $text | ) |
|
|
protected |
Substitute variable placehodlers like {a} with their value without wrapping the value in anything.
- Parameters
-
string | $text | some content with placeholders like {a} for where the variables need to go. |
- Return values
-
string | the expression with each placeholder replaced by the corresponding value. |
◆ supply_missing_first_step_data()
qtype_calculatedmulti_qe2_attempt_updater::supply_missing_first_step_data |
( |
& | $data | ) |
|
◆ was_answered()
qtype_calculatedmulti_qe2_attempt_updater::was_answered |
( |
| $state | ) |
|
◆ $prettyvalue
array qtype_calculatedmulti_qe2_attempt_updater::$prettyvalue = [] |
|
protected |
◆ $safevalue
array qtype_calculatedmulti_qe2_attempt_updater::$safevalue = [] |
|
protected |
◆ $search
array qtype_calculatedmulti_qe2_attempt_updater::$search = [] |
|
protected |
The documentation for this class was generated from the following file:
- question/type/calculatedmulti/db/upgradelib.php