Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | List of all members
assignfeedback_offline_grade_importer Class Reference

CSV Grade importer. More...

Public Member Functions

 __construct ($importid, assign $assignment, $encoding='utf-8', $separator='comma')
 Constructor. More...
 
 close ($delete)
 Close the grade importer file and optionally delete any temp files. More...
 
 get_encoding ()
 Return the encoding for this csv import. More...
 
 get_separator ()
 Return the separator for this csv import. More...
 
 init ()
 Initialise the import reader and locate the column indexes. More...
 
 next ()
 Get the next row of data from the csv file (only the columns we care about) More...
 
 parsecsv ($csvdata)
 Parse a csv file and save the content to a temp file Should be called before init() More...
 

Public Attributes

string $importid
 $importid - unique id for this import operation - must be passed between requests
 

Detailed Description

CSV Grade importer.

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

Constructor & Destructor Documentation

◆ __construct()

assignfeedback_offline_grade_importer::__construct (   $importid,
assign  $assignment,
  $encoding = 'utf-8',
  $separator = 'comma' 
)

Constructor.

Parameters
string$importidA unique id for this import
assign$assignmentThe current assignment

Member Function Documentation

◆ close()

assignfeedback_offline_grade_importer::close (   $delete)

Close the grade importer file and optionally delete any temp files.

Parameters
bool$delete

◆ get_encoding()

assignfeedback_offline_grade_importer::get_encoding ( )

Return the encoding for this csv import.

Return values
stringThe encoding for this csv import.

◆ get_separator()

assignfeedback_offline_grade_importer::get_separator ( )

Return the separator for this csv import.

Return values
stringThe separator for this csv import.

◆ init()

assignfeedback_offline_grade_importer::init ( )

Initialise the import reader and locate the column indexes.

Return values
boolfalse is a failed import

◆ next()

assignfeedback_offline_grade_importer::next ( )

Get the next row of data from the csv file (only the columns we care about)

Return values
stdClassor false The stdClass is an object containing user, grade and lastmodified

◆ parsecsv()

assignfeedback_offline_grade_importer::parsecsv (   $csvdata)

Parse a csv file and save the content to a temp file Should be called before init()

Parameters
string$csvdataThe csv data
Return values
boolfalse is a failed import

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