Skip to content
Snippets Groups Projects
Commit 4b3d0cc5 authored by Tim Hunt's avatar Tim Hunt
Browse files

Must initialise $PAGE before creating a form object.

Otherwise it broke in Bootstrap-based themes.
parent ed7d39d5
No related branches found
No related tags found
No related merge requests found
......@@ -46,13 +46,7 @@ list($context, $seed, $urlparams) = qtype_stack_setup_question_test_page($questi
// Check permissions.
question_require_capability_on($questiondata, 'edit');
// Initialise $PAGE.
$backurl = new moodle_url('/question/type/stack/questiontestrun.php', $urlparams);
if (!is_null($testcase)) {
$urlparams['testcase'] = $testcase;
}
$PAGE->set_url('/question/type/stack/questiontestedit.php', $urlparams);
// Work out whether we are adding or editing.
if (!is_null($testcase)) {
$title = stack_string('editingtestcase',
array('no' => $testcase, 'question' => format_string($question->name)));
......@@ -62,6 +56,16 @@ if (!is_null($testcase)) {
$submitlabel = stack_string('createtestcase');
}
// Initialise $PAGE.
$backurl = new moodle_url('/question/type/stack/questiontestrun.php', $urlparams);
if (!is_null($testcase)) {
$urlparams['testcase'] = $testcase;
}
$PAGE->set_url('/question/type/stack/questiontestedit.php', $urlparams);
$PAGE->set_title($title);
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_pagelayout('admin');
// Create the question usage we will use.
$quba = question_engine::make_questions_usage_by_activity('qtype_stack', $context);
$quba->set_preferred_behaviour('adaptive');
......@@ -132,9 +136,6 @@ $options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;
// Display the page.
$PAGE->set_title($title);
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_pagelayout('admin');
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment