Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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: 331 lines (13 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

assignfeedback_file_zip_importer:: (6 methods):
  is_valid_filename_for_import()
  is_file_modified()
  delete_import_files()
  extract_files_from_zip()
  get_import_files()
  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, & $user, & $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
param: stdClass $user - Set to the user 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: true If the participant Id can be extracted and this is a valid user

is_file_modified($assignment, $user, $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: stdClass $user 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

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