protected function insert_grade_record($record, $studentid) {
        global $DB, $USER, $CFG;
        $record->importcode = $this->importcode;
        $record->userid     = $studentid;
        $record->importer   = $USER->id;
        // By default the maximum grade is 100.
        $gradepointmaximum = 100;
        // If the grade limit has been increased then use the gradepointmax setting.
        if ($CFG->unlimitedgrades) {
            $gradepointmaximum = $CFG->gradepointmax;
        }
        // If the record final grade is set then check that the grade value isn't too high.
        // Final grade will not be set if we are inserting feedback.
        if (!isset($record->finalgrade) || $record->finalgrade <= $gradepointmaximum) {
            return $DB->insert_record('grade_import_values', $record);
        } else {
            $this->cleanup_import(get_string('gradevaluetoobig', 'grades', $gradepointmaximum));
            return null;
        }
    }
protected function insert_grade_record($record, $studentid) {
        global $DB, $USER, $CFG;
        $record->importcode = $this->importcode;
        $record->userid     = $studentid;
        $record->importer   = $USER->id;
        // By default the maximum grade is 100.
        $gradepointmaximum = 100;
        // If the grade limit has been increased then use the gradepointmax setting.
        if ($CFG->unlimitedgrades) {
            $gradepointmaximum = $CFG->gradepointmax;
        }
        // If the record final grade is set then check that the grade value isn't too high.
        // Final grade will not be set if we are inserting feedback.
        if (!isset($record->finalgrade) || $record->finalgrade <= $gradepointmaximum) {
            return $DB->insert_record('grade_import_values', $record);
        } else {
            $this->cleanup_import(get_string('gradevaluetoobig', 'grades', $gradepointmaximum));
            return null;
        }
    }
protected function insert_grade_record ( $ record , $ studentid ) { global $ DB , $ USER , $ CFG ; $ record -> importcode = $ this -> importcode ; $ record -> userid = $ studentid ; $ record -> importer = $ USER -> id ; // By default the maximum grade is 100. $ gradepointmaximum = 100 ; // If the grade limit has been increased then use the gradepointmax setting. if ( $ CFG -> unlimitedgrades ) { $ gradepointmaximum = $ CFG -> gradepointmax ; } // If the record final grade is set then check that the grade value isn't too high. // Final grade will not be set if we are inserting feedback. if ( ! isset ( $ record -> finalgrade ) || $ record -> finalgrade <= $ gradepointmaximum ) { return $ DB -> insert_record ( 'grade_import_values' , $ record ) ; } else { $ this -> cleanup_import ( get_string ( 'gradevaluetoobig' , 'grades' , $ gradepointmaximum ) ) ; return null ; } }
Inserts a record into the grade_import_values table. This also adds common record information.

@param object $record The grade record being inserted into the database.
@param int $studentid The student ID.
@return bool|int true or insert id on success. Null if the grade value is too high.
Inserts a record into the grade_import_values table . This also adds common record information .