Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is 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.