Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

This file contains the core_privacy\local\request helper.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 97 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

transform:: (5 methods):
  user()
  datetime()
  date()
  yesno()
  percentage()


Class: transform  - X-Ref

A class containing a set of data transformations for core data types.

user(int $userid)   X-Ref
Translate a userid into the standard user format for exports.

We have not determined if we will do this or not, but we provide the functionality and encourgae people to use
it so that it can be retrospectively fitted if required.

param: int         $userid the userid to translate
return: mixed

datetime($datetime)   X-Ref
Translate a unix timestamp into a datetime string.

param: int         $datetime the unixtimestamp to translate.
return: string      The translated string.

date($date)   X-Ref
Translate a unix timestamp into a date string.

param: int         $date the unixtimestamp to translate.
return: string      The translated string.

yesno($value)   X-Ref
Translate a bool or int (0/1) value into a translated yes/no string.

param: bool        $value The value to translate
return: string

percentage(float $value)   X-Ref
Translate a float value which should be between 0.0 and 1.0 into percentage.

param: float $value The value between 0.0 and 1.0.
return: float|string