See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
(no description)
File Size: | 323 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
qtype_calculatedmulti_qe2_attempt_updater:: (15 methods):
question_summary()
right_answer()
explode_answer()
response_summary()
was_answered()
set_first_step_data_elements()
supply_missing_first_step_data()
set_data_elements_for_step()
load_dataset()
format_float()
calculate()
calculate_raw()
substitute_values_for_eval()
substitute_values_pretty()
replace_expressions_in_text()
Class: qtype_calculatedmulti_qe2_attempt_updater - X-Ref
Class for converting attempt data for calculated multiple-choice questionsquestion_summary() X-Ref |
right_answer() X-Ref |
No description |
explode_answer($state) X-Ref |
No description |
response_summary($state) X-Ref |
No description |
was_answered($state) X-Ref |
No description |
set_first_step_data_elements($state, &$data) X-Ref |
No description |
supply_missing_first_step_data(&$data) X-Ref |
No description |
set_data_elements_for_step($state, &$data) X-Ref |
No description |
load_dataset($selecteditem) X-Ref |
No description |
format_float($x, $length = null, $format = null) X-Ref |
This function should be identical to {@link 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. param: number $x the number to format param: int $length restrict to this many decimal places or significant param: int format 1 => decimalformat, 2 => significantfigures. return: string formtted number. |
calculate($expression) X-Ref |
Evaluate an expression using the variable values. param: string $expression the expression. A PHP expression with placeholders return: float the computed result. |
calculate_raw($expression) X-Ref |
Evaluate an expression after the variable values have been substituted. param: string $expression the expression. A PHP expression with placeholders return: float the computed result. |
substitute_values_for_eval($expression) X-Ref |
Substitute variable placehodlers like {a} with their value wrapped in (). param: string $expression the expression. A PHP expression with placeholders return: string the expression with each placeholder replaced by the |
substitute_values_pretty($text) X-Ref |
Substitute variable placehodlers like {a} with their value without wrapping the value in anything. param: string $text some content with placeholders return: string the expression with each placeholder replaced by the |
replace_expressions_in_text($text, $length = null, $format = null) X-Ref |
Replace any embedded variables (like {a}) or formulae (like {={a} + {b}}) in some text with the corresponding values. param: string $text the text to process. return: string the text with values substituted. |