Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

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

Defines 1 class

format:: (3 methods):
  userdate()
  boolean_as_text()
  percent()


Class: format  - X-Ref

Class containing helper methods for formatting column data via callbacks

Note that type hints for each $value argument are avoided to allow for these callbacks to be executed when columns are
aggregated using one of the "Group concatenation" methods, where the value is typically stringified

userdate($value, stdClass $row, ?string $format = null)   X-Ref
Returns formatted date.

return: string
param: int|null $value Unix timestamp
param: stdClass $row
param: string|null $format Format string for strftime

boolean_as_text($value)   X-Ref
Returns yes/no string depending on the given value

return: string
param: bool|null $value

percent($value)   X-Ref
Returns float value as a percentage

return: string
param: float|null $value