public static function get_quiz_feedback_for_grade($quizid, $grade) {
        global $DB;

        $params = array(
            'quizid' => $quizid,
            'grade' => $grade,
        );
        $params = self::validate_parameters(self::get_quiz_feedback_for_grade_parameters(), $params);
        $warnings = array();

        list($quiz, $course, $cm, $context) = self::validate_quiz($params['quizid']);

        $result = array();
        $result['feedbacktext'] = '';
        $result['feedbacktextformat'] = FORMAT_MOODLE;

        $feedback = quiz_feedback_record_for_grade($params['grade'], $quiz);
        if (!empty($feedback->feedbacktext)) {
            list($text, $format) = external_format_text($feedback->feedbacktext, $feedback->feedbacktextformat, $context->id,
                                                        'mod_quiz', 'feedback', $feedback->id);
            $result['feedbacktext'] = $text;
            $result['feedbacktextformat'] = $format;
            $feedbackinlinefiles = external_util::get_area_files($context->id, 'mod_quiz', 'feedback', $feedback->id);
            if (!empty($feedbackinlinefiles)) {
                $result['feedbackinlinefiles'] = $feedbackinlinefiles;
            }
        }

        $result['warnings'] = $warnings;
        return $result;
    }
public static function get_quiz_feedback_for_grade($quizid, $grade) {
        global $DB;

        $params = array(
            'quizid' => $quizid,
            'grade' => $grade,
        );
        $params = self::validate_parameters(self::get_quiz_feedback_for_grade_parameters(), $params);
        $warnings = array();

        list($quiz, $course, $cm, $context) = self::validate_quiz($params['quizid']);

        $result = array();
        $result['feedbacktext'] = '';
        $result['feedbacktextformat'] = FORMAT_MOODLE;

        $feedback = quiz_feedback_record_for_grade($params['grade'], $quiz);
        if (!empty($feedback->feedbacktext)) {
            list($text, $format) = external_format_text($feedback->feedbacktext, $feedback->feedbacktextformat, $context->id,
                                                        'mod_quiz', 'feedback', $feedback->id);
            $result['feedbacktext'] = $text;
            $result['feedbacktextformat'] = $format;
            $feedbackinlinefiles = external_util::get_area_files($context->id, 'mod_quiz', 'feedback', $feedback->id);
            if (!empty($feedbackinlinefiles)) {
                $result['feedbackinlinefiles'] = $feedbackinlinefiles;
            }
        }

        $result['warnings'] = $warnings;
        return $result;
    }
public static function get_quiz_feedback_for_grade ( $ quizid , $ grade ) { global $ DB ; $ params = array ( 'quizid' => $ quizid , 'grade' => $ grade , ) ; $ params = self :: validate_parameters ( self :: get_quiz_feedback_for_grade_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ quiz , $ course , $ cm , $ context ) = self :: validate_quiz ( $ params [ 'quizid' ] ) ; $ result = array ( ) ; $ result [ 'feedbacktext' ] = '' ; $ result [ 'feedbacktextformat' ] = FORMAT_MOODLE ; $ feedback = quiz_feedback_record_for_grade ( $ params [ 'grade' ] , $ quiz ) ; if ( ! empty ( $ feedback -> feedbacktext ) ) { list ( $ text , $ format ) = external_format_text ( $ feedback -> feedbacktext , $ feedback -> feedbacktextformat , $ context -> id , 'mod_quiz' , 'feedback' , $ feedback -> id ) ; $ result [ 'feedbacktext' ] = $ text ; $ result [ 'feedbacktextformat' ] = $ format ; $ feedbackinlinefiles = external_util :: get_area_files ( $ context -> id , 'mod_quiz' , 'feedback' , $ feedback -> id ) ; if ( ! empty ( $ feedbackinlinefiles ) ) { $ result [ 'feedbackinlinefiles' ] = $ feedbackinlinefiles ; } } $ result [ 'warnings' ] = $ warnings ; return $ result ; }
Get the feedback text that should be show to a student who got the given grade in the given quiz.

@param int $quizid quiz instance id
@param float $grade the grade to check
@return array of warnings and status result
@since Moodle 3.1
@throws moodle_exception
Get the feedback text that should be show to a student who got the given grade in the given quiz .