Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
assignfeedback_offline_grade_importer Class Reference

CSV Grade importer. More...

Public Member Functions

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

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: