-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#157] Fix quiz compatibility in newer versions of Moodle
- Loading branch information
1 parent
1b9dd43
commit b06f9b5
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -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. | ||
|
@@ -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); | ||
} | ||
|
||
|