[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/question/type/calculated/db/ -> upgradelib.php (summary)

Upgrade library code for the calculated question type.

Copyright: 2011 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 302 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

qtype_calculated_qe2_attempt_updater:: (15 methods):
  question_summary()
  right_answer()
  parse_response()
  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_calculated_qe2_attempt_updater  - X-Ref

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.

question_summary()   X-Ref


right_answer()   X-Ref
No description

parse_response($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.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1