Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
customfield_date\data_controller Class Reference

Class data. More...

Inheritance diagram for customfield_date\data_controller:
core_customfield\data_controller

Public Member Functions

 datafield ()
 Return the name of the field where the information is stored. More...
 
 delete ()
 Delete data. More...
 
 display ()
 Used by handlers to display data on various places. More...
 
 export_value ()
 Returns value in a human-readable format. More...
 
 get ($property)
 Persistent getter parser. More...
 
 get_context ()
 Return the context of the field. More...
 
 get_default_value ()
 Returns the default value as it would be stored in the database (not in human-readable format). More...
 
 get_field ()
 Field associated with this data. More...
 
 get_value ()
 Returns the value as it is stored in the database or default value if data record is not present. More...
 
 instance_form_before_set_data (\stdClass $instance)
 Prepares the custom field data related to the object to pass to mform->set_data() and adds them to it. More...
 
 instance_form_definition (\MoodleQuickForm $mform)
 Add fields for editing data of a date field on a context. More...
 
 instance_form_definition_after_data (\MoodleQuickForm $mform)
 Called from instance edit form in definition_after_data() More...
 
 instance_form_save (\stdClass $datanew)
 Saves the data coming from form. More...
 
 instance_form_validation (array $data, array $files)
 Validates data for this field. More...
 
 save ()
 Persistent save parser. More...
 
 set ($property, $value)
 Persistent setter parser. More...
 
 to_record ()
 Persistent to_record parser. More...
 

Static Public Member Functions

static create (int $id, stdClass $record=null, field_controller $field=null)
 Creates an instance of data_controller. More...
 

Protected Member Functions

 get_form_element_name ()
 Returns the name of the field to be used on HTML forms. More...
 
 is_empty ($value)
 Checks if the value is empty. More...
 
 is_unique ($value)
 Checks if the value is unique. More...
 

Protected Attributes

data $data
 Data persistent.
 
field_controller $field
 Field that this data belongs to.
 

Detailed Description

Class data.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create()

static core_customfield\data_controller::create ( int  $id,
stdClass  $record = null,
field_controller  $field = null 
)
staticinherited

Creates an instance of data_controller.

Parameters $id, $record and $field can complement each other but not conflict. If $id is not specified, fieldid must be present either in $record or in $field. If $id is not specified, instanceid must be present in $record

No DB queries are performed if both $record and $field are specified.

Parameters
int$id
stdClass | null$record
field_controller | null$field
Return values
data_controller
Exceptions
coding_exception
moodle_exception

◆ datafield()

customfield_date\data_controller::datafield ( )

Return the name of the field where the information is stored.

Return values
string

Reimplemented from core_customfield\data_controller.

◆ delete()

core_customfield\data_controller::delete ( )
inherited

Delete data.

Element can override it if related information needs to be deleted as well (such as files)

Return values
bool

Reimplemented in customfield_textarea\data_controller.

◆ display()

core_customfield\data_controller::display ( )
inherited

Used by handlers to display data on various places.

Return values
string

◆ export_value()

customfield_date\data_controller::export_value ( )

Returns value in a human-readable format.

Return values
mixed|nullvalue or null if empty

Reimplemented from core_customfield\data_controller.

◆ get()

core_customfield\data_controller::get (   $property)
finalinherited

Persistent getter parser.

Parameters
string$property
Return values
mixed

◆ get_context()

core_customfield\data_controller::get_context ( )
inherited

Return the context of the field.

Return values
context

◆ get_default_value()

customfield_date\data_controller::get_default_value ( )

Returns the default value as it would be stored in the database (not in human-readable format).

Return values
mixed

Reimplemented from core_customfield\data_controller.

◆ get_field()

core_customfield\data_controller::get_field ( )
inherited

Field associated with this data.

Return values
field_controller

◆ get_form_element_name()

core_customfield\data_controller::get_form_element_name ( )
protectedinherited

Returns the name of the field to be used on HTML forms.

Return values
string

Reimplemented in customfield_textarea\data_controller.

◆ get_value()

core_customfield\data_controller::get_value ( )
inherited

Returns the value as it is stored in the database or default value if data record is not present.

Return values
mixed

◆ instance_form_before_set_data()

core_customfield\data_controller::instance_form_before_set_data ( \stdClass  $instance)
inherited

Prepares the custom field data related to the object to pass to mform->set_data() and adds them to it.

This function must be called before calling $form->set_data($object);

Parameters
stdClass$instancethe instance that has custom fields, if 'id' attribute is present the custom fields for this instance will be added, otherwise the default values will be added.

Reimplemented in customfield_textarea\data_controller.

◆ instance_form_definition()

customfield_date\data_controller::instance_form_definition ( \MoodleQuickForm  $mform)

Add fields for editing data of a date field on a context.

Parameters
MoodleQuickForm$mform

Reimplemented from core_customfield\data_controller.

◆ instance_form_definition_after_data()

core_customfield\data_controller::instance_form_definition_after_data ( \MoodleQuickForm  $mform)
inherited

Called from instance edit form in definition_after_data()

Parameters
MoodleQuickForm$mform

◆ instance_form_save()

core_customfield\data_controller::instance_form_save ( \stdClass  $datanew)
inherited

Saves the data coming from form.

Parameters
stdClass$datanewdata coming from the form

Reimplemented in customfield_textarea\data_controller.

◆ instance_form_validation()

customfield_date\data_controller::instance_form_validation ( array  $data,
array  $files 
)

Validates data for this field.

Parameters
array$data
array$files
Return values
array

Reimplemented from core_customfield\data_controller.

◆ is_empty()

core_customfield\data_controller::is_empty (   $value)
protectedinherited

Checks if the value is empty.

Parameters
mixed$value
Return values
bool

◆ is_unique()

core_customfield\data_controller::is_unique (   $value)
protectedinherited

Checks if the value is unique.

Parameters
mixed$value
Return values
bool

◆ save()

core_customfield\data_controller::save ( )
inherited

Persistent save parser.

Return values
void

◆ set()

core_customfield\data_controller::set (   $property,
  $value 
)
finalinherited

Persistent setter parser.

Parameters
string$property
mixed$value
Return values
data

◆ to_record()

core_customfield\data_controller::to_record ( )
finalinherited

Persistent to_record parser.

Return values
stdClass

The documentation for this class was generated from the following file: