Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 314 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Format:: (9 methods):
  DOLLAR()
  FIXEDFORMAT()
  TEXTFORMAT()
  convertValue()
  VALUE()
  valueToText()
  getDecimalSeparator()
  getGroupSeparator()
  NUMBERVALUE()


Class: Format  - X-Ref

DOLLAR($value = 0, $decimals = 2)   X-Ref
DOLLAR.

This function converts a number to text using currency format, with the decimals rounded to the specified place.
The format used is $#,##0.00_);($#,##0.00)..

param: mixed $value The value to format
param: mixed $decimals The number of digits to display to the right of the decimal point (as an integer).
return: array|string

FIXEDFORMAT($value, $decimals = 2, $noCommas = false)   X-Ref
FIXED.

param: mixed $value The value to format
param: mixed $decimals Integer value for the number of decimal places that should be formatted
param: mixed $noCommas Boolean value indicating whether the value should have thousands separators or not
return: array|string

TEXTFORMAT($value, $format)   X-Ref
TEXT.

param: mixed $value The value to format
param: mixed $format A string with the Format mask that should be used
return: array|string

convertValue($value)   X-Ref

param: mixed $value Value to check
return: mixed

VALUE($value = '')   X-Ref
VALUE.

param: mixed $value Value to check
return: array|DateTimeInterface|float|int|string A string if arguments are invalid

valueToText($value, $format = false)   X-Ref
No description

getDecimalSeparator($decimalSeparator)   X-Ref

param: mixed $decimalSeparator

getGroupSeparator($groupSeparator)   X-Ref

param: mixed $groupSeparator

NUMBERVALUE($value = '', $decimalSeparator = null, $groupSeparator = null)   X-Ref
NUMBERVALUE.

param: mixed $value The value to format
param: mixed $decimalSeparator A string with the decimal separator to use, defaults to locale defined value
param: mixed $groupSeparator A string with the group/thousands separator to use, defaults to locale defined value
return: array|float|string