A class for loading and preparing grade data from import.
More...
|
| get_error () |
| Returns the error parameter for this class.
|
|
| get_gradebookerrors () |
| Returns the gradebookerrors parameter for this class.
|
|
| get_headers () |
| Returns the headers parameter for this class.
|
|
| get_iid () |
| Returns the iid parameter for this class.
|
|
| get_previewdata () |
| Returns the preview_data parameter for this class.
|
|
| load_csv_content ($text, $encoding, $separator, $previewrows) |
| Load CSV content for previewing.
|
|
| prepare_import_grade_data ($header, $formdata, $csvimport, $courseid, $separatemode, $currentgroup, $verbosescales) |
| Checks and prepares grade data for inserting into the gradebook.
|
|
|
| check_user_exists ($value, $userfields) |
| Check that the user is in the system.
|
|
| cleanup_import ($notification) |
| Clean up failed CSV grade import.
|
|
| create_feedback ($courseid, $itemid, $value) |
| Check to see if the feedback matches a grade item.
|
|
| import_new_grade_item ($header, $key, $value) |
| Insert the new grade into the grade item buffer table.
|
|
| insert_grade_record (stdClass $record, int $studentid, grade_item $gradeitem) |
| Inserts a record into the grade_import_values table.
|
|
| map_user_data_with_value ($mappingidentifier, $value, $header, $map, $key, $courseid, $feedbackgradeid, $verbosescales) |
| Check user mapping.
|
|
| raise_limits () |
| Raises the php execution time and memory limits for importing the CSV file.
|
|
| trim_headers () |
| Cleans the column headers from the CSV file.
|
|
| update_grade_item ($courseid, $map, $key, $verbosescales, $value) |
| This updates existing grade items.
|
|
|
string | $error |
| $error csv import error.
|
|
array | $gradebookerrors |
| $gradebookerrors An array of errors from trying to import into the gradebook.
|
|
array | $headers |
| $headers Column names for the data.
|
|
int | $iid |
| $iid Unique identifier for these csv records.
|
|
int | $importcode |
| $importcode The code for this batch insert.
|
|
array | $newfeedbacks |
| $newfeedbacks Feedback to be inserted into the gradebook.
|
|
array | $newgradeitems |
| $newgradeitems An array of new grade items to be inserted into the gradebook.
|
|
array | $newgrades |
| $newgrades Grades to be inserted into the gradebook.
|
|
array | $previewdata |
| $previewdata A subsection of the csv imported data.
|
|
bool | $status |
| $status The current status of the import.
|
|
int | $studentid |
| $studentid Student ID
|
|
A class for loading and preparing grade data from import.
- Copyright
- 2014 Adrian Greeve adria.nosp@m.n@mo.nosp@m.odle..nosp@m.com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ check_user_exists()
gradeimport_csv_load_data::check_user_exists |
( |
| $value, |
|
|
| $userfields ) |
|
protected |
Check that the user is in the system.
- Parameters
-
string | $value | The value, from the csv file, being mapped to identify the user. |
array | $userfields | Contains the field and label being mapped from. |
- Return values
-
int | Returns the user ID if it exists, otherwise null. |
◆ cleanup_import()
gradeimport_csv_load_data::cleanup_import |
( |
| $notification | ) |
|
|
protected |
Clean up failed CSV grade import.
Clears the temp table for inserting grades.
- Parameters
-
string | $notification | The error message to display from the unsuccessful grade import. |
◆ create_feedback()
gradeimport_csv_load_data::create_feedback |
( |
| $courseid, |
|
|
| $itemid, |
|
|
| $value ) |
|
protected |
Check to see if the feedback matches a grade item.
- Parameters
-
int | $courseid | The course ID. |
int | $itemid | The ID of the grade item that the feedback relates to. |
string | $value | The actual feedback being imported. |
- Return values
-
object | Creates a feedback object with the item ID and the feedback value. |
◆ fetch_grade_items()
static gradeimport_csv_load_data::fetch_grade_items |
( |
| $courseid | ) |
|
|
static |
Gets all of the grade items in this course.
- Parameters
-
- Return values
-
array | An array of grade items for the course. |
◆ get_error()
gradeimport_csv_load_data::get_error |
( |
| ) |
|
Returns the error parameter for this class.
- Return values
-
string | returns error parameter for this class. |
◆ get_gradebookerrors()
gradeimport_csv_load_data::get_gradebookerrors |
( |
| ) |
|
Returns the gradebookerrors parameter for this class.
- Return values
-
array | returns gradebookerrors parameter for this class. |
◆ get_headers()
gradeimport_csv_load_data::get_headers |
( |
| ) |
|
Returns the headers parameter for this class.
- Return values
-
array | returns headers parameter for this class. |
◆ get_iid()
gradeimport_csv_load_data::get_iid |
( |
| ) |
|
Returns the iid parameter for this class.
- Return values
-
int | returns iid parameter for this class. |
◆ get_previewdata()
gradeimport_csv_load_data::get_previewdata |
( |
| ) |
|
Returns the preview_data parameter for this class.
- Return values
-
array | returns previewdata parameter for this class. |
◆ import_new_grade_item()
gradeimport_csv_load_data::import_new_grade_item |
( |
| $header, |
|
|
| $key, |
|
|
| $value ) |
|
protected |
Insert the new grade into the grade item buffer table.
- Parameters
-
array | $header | The column headers from the CSV file. |
int | $key | Current row identifier. |
string | $value | The value for this row (final grade). |
- Return values
-
stdClass | new grade that is ready for commiting to the gradebook. |
◆ insert_grade_record()
gradeimport_csv_load_data::insert_grade_record |
( |
stdClass | $record, |
|
|
int | $studentid, |
|
|
grade_item | $gradeitem ) |
|
protected |
Inserts a record into the grade_import_values table.
This also adds common record information.
- Parameters
-
stdClass | $record | The grade record being inserted into the database. |
int | $studentid | The student ID. |
grade_item | $gradeitem | Grade item. |
- Return values
-
mixed | true or insert id on success. Null if the grade value is too high or too low or grade item not exist. |
◆ load_csv_content()
gradeimport_csv_load_data::load_csv_content |
( |
| $text, |
|
|
| $encoding, |
|
|
| $separator, |
|
|
| $previewrows ) |
Load CSV content for previewing.
- Parameters
-
string | $text | The grade data being imported. |
string | $encoding | The type of encoding the file uses. |
string | $separator | The separator being used to define each field. |
int | $previewrows | How many rows are being previewed. |
◆ map_user_data_with_value()
gradeimport_csv_load_data::map_user_data_with_value |
( |
| $mappingidentifier, |
|
|
| $value, |
|
|
| $header, |
|
|
| $map, |
|
|
| $key, |
|
|
| $courseid, |
|
|
| $feedbackgradeid, |
|
|
| $verbosescales ) |
|
protected |
Check user mapping.
- Parameters
-
string | $mappingidentifier | The user field that we are matching together. |
string | $value | The value we are checking / importing. |
array | $header | The column headers of the csv file. |
array | $map | Mapping information provided by the user. |
int | $key | Current row identifier. |
int | $courseid | The course ID. |
int | $feedbackgradeid | The ID of the grade item that the feedback relates to. |
bool | $verbosescales | Form setting for grading with scales. |
◆ prepare_import_grade_data()
gradeimport_csv_load_data::prepare_import_grade_data |
( |
| $header, |
|
|
| $formdata, |
|
|
| $csvimport, |
|
|
| $courseid, |
|
|
| $separatemode, |
|
|
| $currentgroup, |
|
|
| $verbosescales ) |
Checks and prepares grade data for inserting into the gradebook.
- Parameters
-
array | $header | Column headers of the CSV file. |
object | $formdata | Mapping information from the preview page. |
object | $csvimport | csv import reader object for iterating over the imported CSV file. |
int | $courseid | The course ID. |
bool | $separatemode | If we have groups are they separate? |
mixed | $currentgroup | current group information. |
bool | $verbosescales | Form setting for grading with scales. |
- Return values
-
bool | True if the status for importing is okay, false if there are errors. |
◆ update_grade_item()
gradeimport_csv_load_data::update_grade_item |
( |
| $courseid, |
|
|
| $map, |
|
|
| $key, |
|
|
| $verbosescales, |
|
|
| $value ) |
|
protected |
This updates existing grade items.
- Parameters
-
int | $courseid | The course ID. |
array | $map | Mapping information provided by the user. |
int | $key | The line that we are currently working on. |
bool | $verbosescales | Form setting for grading with scales. |
string | $value | The grade value. |
- Return values
-
array | grades to be updated. |
◆ $status
bool gradeimport_csv_load_data::$status |
|
protected |
$status The current status of the import.
True = okay, False = errors.
The documentation for this class was generated from the following file:
- grade/import/csv/classes/load_data.php