Skip to content

Commit

Permalink
GH-779 Get main scale from selected template
Browse files Browse the repository at this point in the history
  • Loading branch information
davidszkiba committed Dec 20, 2024
1 parent 257d78e commit e252818
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion classes/catquiz_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,19 @@ public static function instance_form_definition(MoodleQuickForm &$mform) {
// ... after this function has finished execution. submitted form.
// But the submitted via post, so we can access the variable via the superglobal $POST.

$selectedparentscale = optional_param('catquiz_catscales', 0, PARAM_INT);
if ($chosentemplate = optional_param('choosetemplate', 0, PARAM_INT)) {
// Get parent scale ID from template.
$cattest = (object)[
'id' => $chosentemplate,
'component' => 'mod_adaptivequiz',
];

// Pass on the values as stdClass.
$test = new testenvironment($cattest);
$selectedparentscale = $test->return_as_array()['catscaleid'];
} else {
$selectedparentscale = optional_param('catquiz_catscales', 0, PARAM_INT);
}

if (!empty($selectedparentscale)) {
$element = $mform->getElement('catquiz_catscales');
Expand Down

0 comments on commit e252818

Please sign in to comment.