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 310 and 400] [Versions 311 and 400] [Versions 39 and 400]

This file contains the datetime profile field class.

Copyright: 2010 Mark Nelson <markn@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 146 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

profile_field_datetime:: (6 methods):
  edit_field_add()
  edit_save_data_preprocess()
  display_data()
  is_empty()
  get_field_properties()
  is_transform_supported()


Class: profile_field_datetime  - X-Ref

Handles displaying and editing the datetime field.

edit_field_add($mform)   X-Ref
Handles editing datetime fields.

param: moodleform $mform

edit_save_data_preprocess($datetime, $datarecord)   X-Ref
If timestamp is in YYYY-MM-DD or YYYY-MM-DD-HH-MM-SS format, then convert it to timestamp.

return: int timestamp
param: string|int $datetime datetime to be converted.
param: stdClass $datarecord The object that will be used to save the record

display_data()   X-Ref
Display the data for this field.


is_empty()   X-Ref
Check if the field data is considered empty

return: boolean

get_field_properties()   X-Ref
Return the field type and null properties.
This will be used for validating the data submitted by a user.

return: array the param type and null property

is_transform_supported()   X-Ref
Check if the field should convert the raw data into user-friendly data when exporting

return: bool