See Release Notes
Long Term Support Release
(no description)
File Size: | 506 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
preset_importer:: (14 methods):
__construct()
get_directory()
get_file_contents()
get_preset_settings()
import()
set_affected_fields()
cleanup()
needs_mapping()
get_preset_selector()
finish_import_process()
create_from_parameters()
create_from_plugin_or_directory()
get_mapping_information()
get_field_names()
Class: preset_importer - X-Ref
Abstract class used for data preset importers__construct(manager $manager, string $directory) X-Ref |
Constructor param: manager $manager param: string $directory |
get_directory() X-Ref |
Returns the name of the directory the preset is located in return: string |
get_file_contents(?\file_storage &$filestorage,?\stored_file &$fileobj,?string $dir,string $filename) X-Ref |
Retreive the contents of a file. That file may either be in a conventional directory of the Moodle file storage param: \file_storage|null $filestorage . Should be null if using a conventional directory param: \stored_file|null $fileobj the directory to look in. null if using a conventional directory param: string|null $dir the directory to look in. null if using the Moodle file storage param: string $filename the name of the file we want return: string|null the contents of the file or null if the file doesn't exist. |
get_preset_settings() X-Ref |
Gets the preset settings return: stdClass Settings to be imported. |
import(bool $overwritesettings) X-Ref |
Import the preset into the given database module param: bool $overwritesettings Whether to overwrite activity settings or not. return: bool Wether the importing has been successful. |
set_affected_fields(array $newfields = [], array $currentfields = []) X-Ref |
Returns information about the fields needs to be removed, updated or created. param: array $newfields Array of new fields to be applied. param: array $currentfields Array of current fields on database activity. return: void |
cleanup() X-Ref |
Any clean up routines should go here return: bool Wether the preset has been successfully cleaned up. |
needs_mapping() X-Ref |
Check if the importing process needs fields mapping. return: bool True if the current database needs to map the fields imported. |
get_preset_selector() X-Ref |
Returns the information we need to build the importer selector. return: array Value and name for the preset importer selector |
finish_import_process(bool $overwritesettings, stdClass $instance) X-Ref |
Helper function to finish up the import routine. Called from fields and presets pages. param: bool $overwritesettings Whether to overwrite activity settings or not. param: stdClass $instance database instance object return: void |
create_from_parameters(manager $manager) X-Ref |
Get the right importer instance from the provided parameters (POST or GET) param: manager $manager the current database manager return: preset_importer the relevant preset_importer instance |
create_from_plugin_or_directory(manager $manager, string $pluginordirectory) X-Ref |
Get the right importer instance from the provided parameters (POST or GET) param: manager $manager the current database manager param: string $pluginordirectory The plugin name or directory to create the importer from. return: preset_importer the relevant preset_importer instance |
get_mapping_information() X-Ref |
Get the information needed to decide the modal return: array An array with all the information to decide the mapping |
get_field_names(array $fields) X-Ref |
Returns a list of the fields param: array $fields Array of fields to get name from. return: string A string listing the names of the fields. |