The import_strategy_file class.
More...
|
| get_handlers (array $registrydata, remote_resource $resource) |
| Get an array of import_handler_info objects representing modules supporting import of this file type.
|
|
| import (remote_resource $resource, stdClass $user, stdClass $course, int $section) |
| Import the remote resource according to the rules of this strategy.
|
|
|
| create_user_draft_stored_file (\stdClass $user, string $filename, string $path) |
| Create a file in the user drafts ready for use by plugins implementing dndupload_handle().
|
|
| get_user_upload_limit (\stdClass $user, stdClass $course) |
| Get the max file size limit for the user in the course.
|
|
| prepare_module_data (\stdClass $course, remote_resource $resource, int $draftitemid) |
| Creates the data to pass to the dndupload_handle() hooks.
|
|
| size_exceeds_upload_limit (int $sizeinbytes, int $useruploadlimit) |
| Does the size exceed the upload limit for the current import, taking into account user and core settings.
|
|
The import_strategy_file class.
The import_strategy_file objects contains the setup steps needed to prepare a resource for import as a file into Moodle. This ensures the remote_resource is first downloaded and put in a draft file area, ready for use as a file by the handling module.
- Copyright
- 2020 Jake Dallimore jrhda.nosp@m.llim.nosp@m.ore@g.nosp@m.mail.nosp@m..com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ create_user_draft_stored_file()
tool_moodlenet\local\import_strategy_file::create_user_draft_stored_file |
( |
\stdClass | $user, |
|
|
string | $filename, |
|
|
string | $path ) |
|
protected |
Create a file in the user drafts ready for use by plugins implementing dndupload_handle().
- Parameters
-
stdClass | $user | the user object. |
string | $filename | the name of the file on disk |
string | $path | the path where the file is stored on disk |
- Return values
-
◆ get_handlers()
tool_moodlenet\local\import_strategy_file::get_handlers |
( |
array | $registrydata, |
|
|
remote_resource | $resource ) |
Get an array of import_handler_info objects representing modules supporting import of this file type.
- Parameters
-
array | $registrydata | the fully populated registry. |
remote_resource | $resource | the remote resource. |
- Return values
-
import_handler_info[] | the array of import_handler_info objects. |
Implements tool_moodlenet\local\import_strategy.
◆ get_user_upload_limit()
tool_moodlenet\local\import_strategy_file::get_user_upload_limit |
( |
\stdClass | $user, |
|
|
stdClass | $course ) |
|
protected |
Get the max file size limit for the user in the course.
- Parameters
-
stdClass | $user | the user to check. |
stdClass | $course | the course to check in. |
- Return values
-
int | the file size limit, in bytes. |
◆ import()
tool_moodlenet\local\import_strategy_file::import |
( |
remote_resource | $resource, |
|
|
stdClass | $user, |
|
|
stdClass | $course, |
|
|
int | $section ) |
Import the remote resource according to the rules of this strategy.
- Parameters
-
remote_resource | $resource | the resource to import. |
stdClass | $user | the user to import on behalf of. |
stdClass | $course | the course into which the remote_resource is being imported. |
int | $section | the section into which the remote_resource is being imported. |
- Return values
-
- Exceptions
-
moodle_exception | if the file size means the upload limit is exceeded for the user. |
Implements tool_moodlenet\local\import_strategy.
◆ prepare_module_data()
tool_moodlenet\local\import_strategy_file::prepare_module_data |
( |
\stdClass | $course, |
|
|
remote_resource | $resource, |
|
|
int | $draftitemid ) |
|
protected |
Creates the data to pass to the dndupload_handle() hooks.
- Parameters
-
stdClass | $course | the course record. |
remote_resource | $resource | the resource being imported as a file. |
int | $draftitemid | the itemid of the draft file. |
- Return values
-
◆ size_exceeds_upload_limit()
tool_moodlenet\local\import_strategy_file::size_exceeds_upload_limit |
( |
int | $sizeinbytes, |
|
|
int | $useruploadlimit ) |
|
protected |
Does the size exceed the upload limit for the current import, taking into account user and core settings.
- Parameters
-
int | $sizeinbytes | the size, in bytes. |
int | $useruploadlimit | the upload limit, in bytes. |
- Return values
-
bool | true if exceeded, false otherwise. |
- Exceptions
-
The documentation for this class was generated from the following file:
- admin/tool/moodlenet/classes/local/import_strategy_file.php