The import_strategy_file class.
More...
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_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 |
|
) |
| |
◆ 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: