Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

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

Defines 1 class


Class: CellValueFormatter  - X-Ref


__construct(bool $shouldFormatDates, ODS $escaper)   X-Ref

param: bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
param: ODS  $escaper           Used to unescape XML data

extractAndFormatNodeValue(DOMElement $node)   X-Ref
Returns the (unescaped) correctly marshalled, cell value associated to the given XML node.

return: bool|DateInterval|DateTimeImmutable|float|int|string The value associated with the cell, empty string if cell's type is void/undefined

formatStringCellValue(DOMElement $node)   X-Ref
Returns the cell String value.

return: string The value associated with the cell

formatFloatCellValue(DOMElement $node)   X-Ref
Returns the cell Numeric value from the given node.

return: float|int The value associated with the cell

formatBooleanCellValue(DOMElement $node)   X-Ref
Returns the cell Boolean value from the given node.

return: bool The value associated with the cell

formatDateCellValue(DOMElement $node)   X-Ref
Returns the cell Date value from the given node.


formatTimeCellValue(DOMElement $node)   X-Ref
Returns the cell Time value from the given node.

return: DateInterval|string The value associated with the cell

formatCurrencyCellValue(DOMElement $node)   X-Ref
Returns the cell Currency value from the given node.

return: string The value associated with the cell (e.g. "100 USD" or "9.99 EUR")

formatPercentageCellValue(DOMElement $node)   X-Ref
Returns the cell Percentage value from the given node.

return: float|int The value associated with the cell

extractTextValueFromNode(DOMNode $pNode)   X-Ref
No description

isWhitespaceNode(string $nodeName)   X-Ref
Returns whether the given node is a whitespace node. It must be one of these:
- <text:s />
- <text:tab />
- <text:line-break />.


transformWhitespaceNode(DOMElement $node)   X-Ref
The "<text:p>" node can contain the string value directly
or contain child elements. In this case, whitespaces contain in
the child elements should be replaced by their XML equivalent:
- space => <text:s />
- tab => <text:tab />
- line break => <text:line-break />.

param: DOMElement $node The XML node representing a whitespace
return: string The corresponding whitespace value