Skip to content

Commit

Permalink
[#157] Fix quiz compatibility in newer versions of Moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhilton committed Apr 4, 2024
1 parent 1b9dd43 commit b06f9b5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/form/quiz_override_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@

namespace local_assessfreq\form;

use mod_quiz\form\edit_override_form;

defined('MOODLE_INTERNAL') || die();

require_once("$CFG->libdir/formslib.php");
require_once($CFG->dirroot . '/mod/quiz/override_form.php');

/**
* Form to add override for quiz.
Expand All @@ -36,7 +37,7 @@
* @copyright 2020 Matt Porritt <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class quiz_override_form extends \quiz_override_form {
class quiz_override_form extends edit_override_form {
/**
* Constructor.
* @param object $cm course module object.
Expand All @@ -54,6 +55,11 @@ public function __construct($cm, $quiz, $context, $override, $submitteddata = nu
$this->groupid = 0;
$this->userid = empty($override->userid) ? 0 : $override->userid;

// Added in Moodle 4.4+ by MDL-80300.
if (property_exists(edit_override_form::class, 'overrideid')) {
$this->overrideid = $override->id ?? 0;
}

\moodleform::__construct(null, null, 'post', '', ['class' => 'ignoredirty'], true, $submitteddata);
}

Expand Down

0 comments on commit b06f9b5

Please sign in to comment.