Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Contains the import_processor class.

Copyright: 2020 Jake Dallimore <jrhdallimore@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 206 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

import_processor:: (5 methods):
  __construct()
  process()
  update_module_description()
  create_course_module()
  finish_setup_course_module()


Class: import_processor  - X-Ref

The import_processor class.

The import_processor objects provide a means to import a remote resource into a course section, delegating the handling of
content to the relevant module, via its dndupload_handler callback.

__construct(\stdClass $course, int $section, remote_resource $remoteresource, import_handler_info $handlerinfo,import_handler_registry $handlerregistry)   X-Ref
The import_processor constructor.

param: \stdClass $course the course object.
param: int $section the section number in the course, starting at 0.
param: remote_resource $remoteresource the remote resource to import.
param: import_handler_info $handlerinfo information about which module is handling the import.
param: import_handler_registry $handlerregistry A registry of import handlers, to use for validation.

process()   X-Ref
Run the import process, including file download, module creation and cleanup (cache purge, etc).


update_module_description(int $instanceid)   X-Ref
Update the module's description (intro), if that feature is supported.

param: int $instanceid the instance id of the module to update.

create_course_module(\stdClass $course, int $section, string $modname)   X-Ref
Create the course module to hold the file/content that has been uploaded.

param: \stdClass $course the course object.
param: int $section the section.
param: string $modname the name of the module, e.g. 'label'.
return: \stdClass the course module data.

finish_setup_course_module($instanceid, int $cmid)   X-Ref
Finish off any course module setup, such as adding to the course section and firing events.

param: int $instanceid id returned by the mod when it was created.
param: int $cmid the course module record id, for removal if something went wrong.