Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
assignfeedback_file_zip_importer Class Reference

library class for importing feedback files from a zip More...

Public Member Functions

 delete_import_files ($contextid)
 Delete all temp files used when importing a zip.
 
 extract_files_from_zip ($zipfile, $contextid)
 Extract the uploaded zip to a temporary import area for this user.
 
 get_import_files ($contextid)
 Get the list of files extracted from the uploaded zip.
 
 get_participant_mapping (assign $assignment)
 Returns a mapping from unique user / group ids in folder names to array of moodle users.
 
 import_zip_files ($assignment, $fileplugin)
 Process an uploaded zip file.
 
 is_file_modified ($assignment, $users, $plugin, $filename, $fileinfo)
 Does this file exist in any of the current files supported by this plugin for this user?
 
 is_valid_filename_for_import ($assignment, $fileinfo, $participants, & $users, & $plugin, & $filename)
 Is this filename valid (contains a unique participant ID) for import?
 

Detailed Description

library class for importing feedback files from a zip

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

Member Function Documentation

◆ delete_import_files()

assignfeedback_file_zip_importer::delete_import_files ( $contextid)

Delete all temp files used when importing a zip.

Parameters
int$contextid- The context id of this assignment instance
Return values
booltrue if all files were deleted

◆ extract_files_from_zip()

assignfeedback_file_zip_importer::extract_files_from_zip ( $zipfile,
$contextid )

Extract the uploaded zip to a temporary import area for this user.

Parameters
stored_file$zipfileThe uploaded file
int$contextidThe context for this assignment
Return values
bool- True if the files were unpacked

◆ get_import_files()

assignfeedback_file_zip_importer::get_import_files ( $contextid)

Get the list of files extracted from the uploaded zip.

Parameters
int$contextid
Return values
arrayof stored_files

◆ get_participant_mapping()

assignfeedback_file_zip_importer::get_participant_mapping ( assign $assignment)

Returns a mapping from unique user / group ids in folder names to array of moodle users.

Parameters
assign$assignment- The assignment instance
Return values
arraythe mapping.

◆ import_zip_files()

assignfeedback_file_zip_importer::import_zip_files ( $assignment,
$fileplugin )

Process an uploaded zip file.

Parameters
assign$assignment- The assignment instance
assign_feedback_file$fileplugin- The file feedback plugin
Return values
string- The html response

◆ is_file_modified()

assignfeedback_file_zip_importer::is_file_modified ( $assignment,
$users,
$plugin,
$filename,
$fileinfo )

Does this file exist in any of the current files supported by this plugin for this user?

Parameters
assign$assignment- The assignment instance
array | stdClass$usersThe user(s) matching this uploaded file
assign_plugin$pluginThe matching plugin from the filename
string$filenameThe parsed filename from the zip
stored_file$fileinfoThe info about the extracted file from the zip
Return values
bool- True if the file has been modified or is new

◆ is_valid_filename_for_import()

assignfeedback_file_zip_importer::is_valid_filename_for_import ( $assignment,
$fileinfo,
$participants,
& $users,
& $plugin,
& $filename )

Is this filename valid (contains a unique participant ID) for import?

Parameters
assign$assignment- The assignment instance
stored_file$fileinfo- The fileinfo
array$participants- A list of valid participants for this module indexed by unique_id or group id.
array$users- Set to array with the user(s) that matches by participant id
assign_plugin$plugin- Set to the plugin that exported the file
string$filename- Set to truncated filename (prefix stripped)
Return values
boolIf the participant Id can be extracted and this is a valid user

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