Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | List of all members
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. More...
 
 extract_files_from_zip ($zipfile, $contextid)
 Extract the uploaded zip to a temporary import area for this user. More...
 
 get_import_files ($contextid)
 Get the list of files extracted from the uploaded zip. More...
 
 import_zip_files ($assignment, $fileplugin)
 Process an uploaded zip file. More...
 
 is_file_modified ($assignment, $user, $plugin, $filename, $fileinfo)
 Does this file exist in any of the current files supported by this plugin for this user? More...
 
 is_valid_filename_for_import ($assignment, $fileinfo, $participants, & $user, & $plugin, & $filename)
 Is this filename valid (contains a unique participant ID) for import? More...
 

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

◆ 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,
  $user,
  $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
stdClass$userThe user 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,
$user,
$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
stdClass$user- Set to the user 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
trueIf the participant Id can be extracted and this is a valid user

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