Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
tool_moodlenet\local\import_handler_registry Class Reference

The import_handler_registry class. More...

Public Member Functions

 __construct (\stdClass $course, stdClass $user)
 The import_handler_registry constructor.
 
 get_resource_handler_for_mod_and_strategy (remote_resource $resource, string $modname, import_strategy $strategy)
 Get a specific handler for the resource, belonging to a specific module and for a specific strategy.
 
 get_resource_handlers_for_strategy (remote_resource $resource, import_strategy $strategy)
 Get all handlers for the remote resource, depending on the strategy being used to import the resource.
 

Protected Member Functions

 populate_handlers ()
 Build up a list of extension handlers by leveraging the dndupload_register callbacks.
 
 register_file_handler (string $extension, string $module, string $message)
 Adds a file extension handler to the list.
 
 register_type_handler (string $identifier, string $module, string $message)
 Adds a type handler to the list.
 

Protected Attributes

context_course $context
 the course context object.
 
stdClass $course
 a course object.
 
array $filehandlers = []
 array containing the names and messages of all modules handling import of resources as a 'file' type.
 
array $registry = []
 $registry the aggregate of all registrations made by plugins, indexed by 'file' and 'type'.
 
array $typehandlers = []
 $typehandlers the array of modules registering as handlers of other, non-file types, indexed by typename.
 
stdClass $user
 a user object.
 

Detailed Description

The import_handler_registry class.

The import_handler_registry objects represent a register of modules handling various file extensions for a given course and user. Only modules which are available to the user in the course are included in the register for that user.

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

Constructor & Destructor Documentation

◆ __construct()

tool_moodlenet\local\import_handler_registry::__construct ( \stdClass $course,
stdClass $user )

The import_handler_registry constructor.

Parameters
stdClass$coursethe course, which impacts available handlers.
stdClass$userthe user, which impacts available handlers.

Member Function Documentation

◆ get_resource_handler_for_mod_and_strategy()

tool_moodlenet\local\import_handler_registry::get_resource_handler_for_mod_and_strategy ( remote_resource $resource,
string $modname,
import_strategy $strategy )

Get a specific handler for the resource, belonging to a specific module and for a specific strategy.

Parameters
remote_resource$resourcethe remote resource.
string$modnamethe name of the module, e.g. 'label'.
import_strategy$strategya string representing how to treat the resource. e.g. 'file', 'link'.
Return values
import_handler_info|nullthe import_handler_info object, if found, otherwise null.

◆ get_resource_handlers_for_strategy()

tool_moodlenet\local\import_handler_registry::get_resource_handlers_for_strategy ( remote_resource $resource,
import_strategy $strategy )

Get all handlers for the remote resource, depending on the strategy being used to import the resource.

Parameters
remote_resource$resourcethe remote resource.
import_strategy$strategyan import_strategy instance.
Return values
import_handler_info[]the array of import_handler_info handlers.

◆ register_file_handler()

tool_moodlenet\local\import_handler_registry::register_file_handler ( string $extension,
string $module,
string $message )
protected

Adds a file extension handler to the list.

Parameters
string$extensionthe extension, e.g. 'png'.
string$modulethe name of the module handling this extension
string$messagethe message describing how the module handles the extension.

◆ register_type_handler()

tool_moodlenet\local\import_handler_registry::register_type_handler ( string $identifier,
string $module,
string $message )
protected

Adds a type handler to the list.

Parameters
string$identifierthe name of the type.
string$modulethe name of the module, e.g. 'label'.
string$messagethe message describing how the module handles the type.

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