Skip to content

Commit

Permalink
MDL-83048 mod_quiz: Fixed use of grade_out_of and plugin renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktorwandachowicz committed Sep 10, 2024
1 parent 9ecb8de commit de2afee
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mod/quiz/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
$PAGE->navbar->add($strquizzes);
$PAGE->set_title($strquizzes);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($strquizzes, 2);
/** @var renderer $output */
$output = $PAGE->get_renderer('mod_quiz');
echo $output->header();
echo $output->heading($strquizzes, 2);

// Get all the appropriate data.
if (!$quizzes = get_all_instances_in_course("quiz", $course)) {
Expand Down Expand Up @@ -162,8 +164,8 @@
$feedback = '';
if ($quiz->grade && array_key_exists($quiz->id, $grades)) {
if ($alloptions->marks >= question_display_options::MARK_AND_MAX) {
$grade = $OUTPUT->render(new grade_out_of(
$grades[$quiz->id], $quiz->grade, $quiz->sumgrades, style: grade_out_of::SHORT));
$grade = $output->render(new grade_out_of(
$quiz, $grades[$quiz->id], $quiz->grade, $quiz->sumgrades, style: grade_out_of::SHORT));
}
if ($alloptions->overallfeedback) {
$feedback = quiz_feedback_for_grade($grades[$quiz->id], $quiz, $context);
Expand All @@ -182,4 +184,4 @@
echo html_writer::table($table);

// Finish the page.
echo $OUTPUT->footer();
echo $output->footer();

0 comments on commit de2afee

Please sign in to comment.