Contains the import_strategy_file class.
Copyright: | 2020 Jake Dallimore <jrhdallimore@gmail.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 170 lines (8 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
import_strategy_file:: (6 methods):
get_handlers()
import()
prepare_module_data()
get_user_upload_limit()
size_exceeds_upload_limit()
create_user_draft_stored_file()
Class: import_strategy_file - X-Ref
The import_strategy_file class.get_handlers(array $registrydata, remote_resource $resource) X-Ref |
Get an array of import_handler_info objects representing modules supporting import of this file type. param: array $registrydata the fully populated registry. param: remote_resource $resource the remote resource. return: import_handler_info[] the array of import_handler_info objects. |
import(remote_resource $resource, \stdClass $user, \stdClass $course, int $section) X-Ref |
Import the remote resource according to the rules of this strategy. param: remote_resource $resource the resource to import. param: \stdClass $user the user to import on behalf of. param: \stdClass $course the course into which the remote_resource is being imported. param: int $section the section into which the remote_resource is being imported. return: \stdClass the module data. |
prepare_module_data(\stdClass $course, remote_resource $resource, int $draftitemid) X-Ref |
Creates the data to pass to the dndupload_handle() hooks. param: \stdClass $course the course record. param: remote_resource $resource the resource being imported as a file. param: int $draftitemid the itemid of the draft file. return: \stdClass the data object. |
get_user_upload_limit(\stdClass $user, \stdClass $course) X-Ref |
Get the max file size limit for the user in the course. param: \stdClass $user the user to check. param: \stdClass $course the course to check in. return: int the file size limit, in bytes. |
size_exceeds_upload_limit(int $sizeinbytes, int $useruploadlimit) X-Ref |
Does the size exceed the upload limit for the current import, taking into account user and core settings. param: int $sizeinbytes the size, in bytes. param: int $useruploadlimit the upload limit, in bytes. return: bool true if exceeded, false otherwise. |
create_user_draft_stored_file(\stdClass $user, string $filename, string $path) X-Ref |
Create a file in the user drafts ready for use by plugins implementing dndupload_handle(). param: \stdClass $user the user object. param: string $filename the name of the file on disk param: string $path the path where the file is stored on disk return: \stored_file |