|
array | $fieldstocreate |
| fields to create.
|
|
array | $fieldstoremove |
| fields to remove.
|
|
array | $fieldstoupdate |
| fields to update.
|
|
array | $settings |
| settings to be imported.
|
|
|
string | $directory |
| directory where to find the preset.
|
|
◆ __construct()
mod_data\local\importer\preset_importer::__construct |
( |
manager | $manager, |
|
|
string | $directory ) |
◆ cleanup()
mod_data\local\importer\preset_importer::cleanup |
( |
| ) |
|
◆ create_from_parameters()
static mod_data\local\importer\preset_importer::create_from_parameters |
( |
manager | $manager | ) |
|
|
static |
Get the right importer instance from the provided parameters (POST or GET)
- Parameters
-
manager | $manager | the current database manager |
- Return values
-
preset_importer | the relevant preset_importer instance |
- Exceptions
-
moodle_exception | when the file provided as parameter (POST or GET) does not exist |
◆ create_from_plugin_or_directory()
static mod_data\local\importer\preset_importer::create_from_plugin_or_directory |
( |
manager | $manager, |
|
|
string | $pluginordirectory ) |
|
static |
Get the right importer instance from the provided parameters (POST or GET)
- Parameters
-
manager | $manager | the current database manager |
string | $pluginordirectory | The plugin name or directory to create the importer from. |
- Return values
-
preset_importer | the relevant preset_importer instance |
◆ finish_import_process()
mod_data\local\importer\preset_importer::finish_import_process |
( |
bool | $overwritesettings, |
|
|
stdClass | $instance ) |
Helper function to finish up the import routine.
Called from fields and presets pages.
- Parameters
-
bool | $overwritesettings | Whether to overwrite activity settings or not. |
stdClass | $instance | database instance object |
- Return values
-
◆ get_directory()
mod_data\local\importer\preset_importer::get_directory |
( |
| ) |
|
Returns the name of the directory the preset is located in.
- Return values
-
◆ get_field_names()
mod_data\local\importer\preset_importer::get_field_names |
( |
array | $fields | ) |
|
Returns a list of the fields.
- Parameters
-
array | $fields | Array of fields to get name from. |
- Return values
-
string | A string listing the names of the fields. |
◆ get_file_contents()
mod_data\local\importer\preset_importer::get_file_contents |
( |
?\file_storage & | $filestorage, |
|
|
?\stored_file & | $fileobj, |
|
|
?string | $dir, |
|
|
string | $filename ) |
Retreive the contents of a file.
That file may either be in a conventional directory of the Moodle file storage
- Parameters
-
file_storage | null | $filestorage | . Should be null if using a conventional directory |
stored_file | null | $fileobj | the directory to look in. null if using a conventional directory |
string | null | $dir | the directory to look in. null if using the Moodle file storage |
string | $filename | the name of the file we want |
- Return values
-
string|null | the contents of the file or null if the file doesn't exist. |
◆ get_mapping_information()
mod_data\local\importer\preset_importer::get_mapping_information |
( |
| ) |
|
Get the information needed to decide the modal.
- Return values
-
array | An array with all the information to decide the mapping |
◆ get_preset_selector()
mod_data\local\importer\preset_importer::get_preset_selector |
( |
| ) |
|
◆ get_preset_settings()
mod_data\local\importer\preset_importer::get_preset_settings |
( |
| ) |
|
Gets the preset settings.
- Return values
-
stdClass | Settings to be imported. |
◆ import()
mod_data\local\importer\preset_importer::import |
( |
bool | $overwritesettings | ) |
|
Import the preset into the given database module.
- Parameters
-
bool | $overwritesettings | Whether to overwrite activity settings or not. |
- Return values
-
bool | Wether the importing has been successful. |
◆ needs_mapping()
mod_data\local\importer\preset_importer::needs_mapping |
( |
| ) |
|
Check if the importing process needs fields mapping.
- Return values
-
bool | True if the current database needs to map the fields imported. |
◆ set_affected_fields()
mod_data\local\importer\preset_importer::set_affected_fields |
( |
array | $newfields = [], |
|
|
array | $currentfields = [] ) |
Returns information about the fields needs to be removed, updated or created.
- Parameters
-
array | $newfields | Array of new fields to be applied. |
array | $currentfields | Array of current fields on database activity. |
- Return values
-
The documentation for this class was generated from the following file:
- mod/data/classes/local/importer/preset_importer.php