Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]

This file contains the definition for the library class for file feedback plugin

Copyright: 2012 NetSpot {@link http://www.netspot.com.au}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 369 lines (15 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

assignfeedback_file_zip_importer:: (7 methods):
  is_valid_filename_for_import()
  is_file_modified()
  delete_import_files()
  extract_files_from_zip()
  get_import_files()
  get_participant_mapping()
  import_zip_files()


Class: assignfeedback_file_zip_importer  - X-Ref

library class for importing feedback files from a zip

is_valid_filename_for_import($assignment, $fileinfo, $participants, & $users, & $plugin, & $filename)   X-Ref
Is this filename valid (contains a unique participant ID) for import?

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

is_file_modified($assignment, $users, $plugin, $filename, $fileinfo)   X-Ref
Does this file exist in any of the current files supported by this plugin for this user?

param: assign $assignment - The assignment instance
param: array $users The user matching this uploaded file
param: assign_plugin $plugin The matching plugin from the filename
param: string $filename The parsed filename from the zip
param: stored_file $fileinfo The info about the extracted file from the zip
return: bool - True if the file has been modified or is new

delete_import_files($contextid)   X-Ref
Delete all temp files used when importing a zip

param: int $contextid - The context id of this assignment instance
return: bool true if all files were deleted

extract_files_from_zip($zipfile, $contextid)   X-Ref
Extract the uploaded zip to a temporary import area for this user

param: stored_file $zipfile The uploaded file
param: int $contextid The context for this assignment
return: bool - True if the files were unpacked

get_import_files($contextid)   X-Ref
Get the list of files extracted from the uploaded zip

param: int $contextid
return: array of stored_files

get_participant_mapping(assign $assignment)   X-Ref
Returns a mapping from unique user / group ids in folder names to array of moodle users.

param: assign $assignment  - The assignment instance
return: array the mapping.

import_zip_files($assignment, $fileplugin)   X-Ref
Process an uploaded zip file

param: assign $assignment - The assignment instance
param: assign_feedback_file $fileplugin - The file feedback plugin
return: string - The html response