Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_dataprivacy\form\purpose Class Reference

Data purpose form. More...

Inheritance diagram for tool_dataprivacy\form\purpose:

Public Member Functions

 definition ()
 Define the form - called by parent constructor.
 
 filter_data_for_persistent ($data)
 Converts fields.
 
 get_role_overrides_from_data (\stdClass $data)
 Fetch the role override data from the list of submitted data.
 
 set_data ($data)
 Load in existing data as form defaults.
 

Protected Member Functions

 add_field (\stdClass $data)
 Add a fieldset to the current form.
 
 add_override_fields ()
 Handle addition of relevant repeated element fields for role overrides.
 
 convert_existing_data_to_values (\stdClass $data)
 Normalise any values stored in existing data.
 
 extra_validation ($data, $files, array &$errors)
 Define extra validation mechanims.
 
 get_default_data ()
 Get the default data.
 
 get_lawful_base_field (string $prefix='')
 Get the mform field for lawful bases.
 
 get_protected_field (string $prefix='')
 Get the mform field for the protected flag.
 
 get_retention_period_fields (string $prefix='')
 Get the retention period fields.
 
 get_role_field (string $prefix='')
 Get the field for the role name.
 
 get_role_override_id (string $prefix='')
 Get the field for the role name.
 
 get_sensitive_base_field (string $prefix='')
 Get the mform field for sensitive bases.
 

Static Protected Member Functions

static convert_fields (\stdClass $data)
 Converts data to data suitable for storage.
 

Protected Attributes

array $existingoverrides = []
 The list of current overrides.
 

Static Protected Attributes

static string $persistentclass = 'tool_dataprivacy\\purpose'
 The persistent class.
 

Detailed Description

Data purpose form.

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

Member Function Documentation

◆ add_field()

tool_dataprivacy\form\purpose::add_field ( \stdClass $data)
protected

Add a fieldset to the current form.

Parameters
stdClass$data

◆ convert_existing_data_to_values()

tool_dataprivacy\form\purpose::convert_existing_data_to_values ( \stdClass $data)
protected

Normalise any values stored in existing data.

Parameters
stdClass$data
Return values
stdClass

◆ convert_fields()

static tool_dataprivacy\form\purpose::convert_fields ( \stdClass $data)
staticprotected

Converts data to data suitable for storage.

Parameters
stdClass$data
Return values
stdClass

◆ extra_validation()

tool_dataprivacy\form\purpose::extra_validation ( $data,
$files,
array & $errors )
protected

Define extra validation mechanims.

Parameters
stdClass$dataData to validate.
array$filesArray of files.
array$errorsCurrently reported errors.
Return values
arrayof additional errors, or overridden errors.

◆ filter_data_for_persistent()

tool_dataprivacy\form\purpose::filter_data_for_persistent ( $data)

Converts fields.

Parameters
stdClass$data
Return values
stdClass

◆ get_default_data()

tool_dataprivacy\form\purpose::get_default_data ( )
protected

Get the default data.

Return values
stdClass

◆ get_lawful_base_field()

tool_dataprivacy\form\purpose::get_lawful_base_field ( string $prefix = '')
protected

Get the mform field for lawful bases.

Parameters
string$prefixThe prefix to apply to the field
Return values
stdClass

◆ get_protected_field()

tool_dataprivacy\form\purpose::get_protected_field ( string $prefix = '')
protected

Get the mform field for the protected flag.

Parameters
string$prefixThe prefix to apply to the field
Return values
stdClass

◆ get_retention_period_fields()

tool_dataprivacy\form\purpose::get_retention_period_fields ( string $prefix = '')
protected

Get the retention period fields.

Parameters
string$prefixThe name of the main field, and prefix for the subfields.
Return values
stdClass

◆ get_role_field()

tool_dataprivacy\form\purpose::get_role_field ( string $prefix = '')
protected

Get the field for the role name.

Parameters
string$prefixThe prefix to apply to the field
Return values
stdClass

◆ get_role_override_id()

tool_dataprivacy\form\purpose::get_role_override_id ( string $prefix = '')
protected

Get the field for the role name.

Parameters
string$prefixThe prefix to apply to the field
Return values
stdClass

◆ get_role_overrides_from_data()

tool_dataprivacy\form\purpose::get_role_overrides_from_data ( \stdClass $data)

Fetch the role override data from the list of submitted data.

Parameters
stdClass$dataThe complete set of processed data
Return values
stdClass[]The list of overrides

◆ get_sensitive_base_field()

tool_dataprivacy\form\purpose::get_sensitive_base_field ( string $prefix = '')
protected

Get the mform field for sensitive bases.

Parameters
string$prefixThe prefix to apply to the field
Return values
stdClass

◆ set_data()

tool_dataprivacy\form\purpose::set_data ( $data)

Load in existing data as form defaults.

Usually new entry defaults are stored directly in form definition (new entry form); this function is used to load in data where values already exist and data is being edited (edit entry form).

Parameters
stdClass$data

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