Skip to content

Commit

Permalink
resolved deprecation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenfinsveen committed Jul 28, 2023
1 parent b4e7da8 commit 1494058
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,20 @@ public function require_core(jazzquiz_session $session) {
*/
public function require_quiz(jazzquiz_session $session) {
$this->require_core($session);
$this->page->requires->js('/question/qengine.js');

// question/qengine.js is deprecated for Moodle versions after 401.
// Checks moodle version in order to determine which question engine
// to use, making the jazzquiz independent of the Moodle version.
global $CFG;
include $CFG->dirroot.'/version.php';
$branch = $CFG->branch;

if ( (int) $branch <= 401 ) {
$this->page->requires->js('/question/qengine.js');
} else {
$this->page->requires->js_call_amd('core_question/question_engine', 'initialize');
}

if ($session->jazzquiz->is_instructor()) {
$count = count($session->jazzquiz->questions);
$params = [$count, false, []];
Expand Down

0 comments on commit 1494058

Please sign in to comment.