Moodle  2.2.1
http://www.collinsharper.com
calc_formula Class Reference

Public Member Functions

 calc_formula ($formula, $params=false)
 set_params ($params)
 evaluate ()
 get_error ()
 localize ($formula)
 unlocalize ($formula)

Data Fields

 $_em
 $_nfx = false
 $_error = false

Detailed Description

Definition at line 38 of file mathslib.php.


Member Function Documentation

calc_formula ( formula,
params = false 
)

Constructor for spreadsheet formula with optional parameters

Parameters:
string$formulawith leading =
array$paramsassociative array of parameters used in formula. All parameter names must be lowercase!

Definition at line 51 of file mathslib.php.

Here is the call graph for this function:

evaluate ( )

Evaluate formula

Returns:
mixed number if ok, false if error

Definition at line 88 of file mathslib.php.

get_error ( )

Get last error. TODO: localize the strings from contructor and EvalMath library

Returns:
mixed string with last error description or false if ok

Definition at line 108 of file mathslib.php.

localize ( formula)

Similar to format_float, formats the numbers and list separators according to locale specifics.

Parameters:
string$formula
Returns:
string localised formula

Definition at line 118 of file mathslib.php.

set_params ( params)

Raplace parameters used in existing formula, parameter names must contain only lowercase [a-z] letters, no other characters are allowed!

Parameters:
array$paramsassociative array of parameters used in formula

Definition at line 79 of file mathslib.php.

Here is the caller graph for this function:

unlocalize ( formula)

Similar to unformat_float, converts floats and lists to PHP standards.

Parameters:
string$formulalocalised formula
Returns:
string

Definition at line 130 of file mathslib.php.

Here is the caller graph for this function:


Field Documentation

$_em

Definition at line 41 of file mathslib.php.

$_error = false

Definition at line 43 of file mathslib.php.

$_nfx = false

Definition at line 42 of file mathslib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations