Skip to content
Snippets Groups Projects
Commit 9e628616 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Add direct link to edit question on testing page.

parent 630e8e2e
No related branches found
No related tags found
No related merge requests found
......@@ -535,6 +535,7 @@ $string['runquestiontests'] = 'Question tests & deployed variants';
$string['runquestiontests_help'] = 'The question tests unit-test the questions to ensure the behaviour matches expectations expressed by the teacher, and deployed variants ensure random versions seen by a student are pre-tested against the question tests. These are tools to help you create and test reliable questions and should be used in all cases a question will be used by students.';
$string['runquestiontests_alert'] = 'Question is missing tests or variants.';
$string['seethisquestioninthequestionbank'] = 'See this question in the question bank';
$string['editquestioninthequestionbank'] = 'Edit this question';
$string['showingundeployedvariant'] = 'Showing undeployed variant: {$a}';
$string['switchtovariant'] = 'Switch to arbitrary variant';
$string['testcasexresult'] = 'Test case {$a->no} {$a->result}';
......
......@@ -70,12 +70,15 @@ require_login();
$qbankparams = $urlparams;
unset($qbankparams['questionid']);
unset($qbankparams['seed']);
$editparams = $qbankparams;
$editparams['id'] = $question->id;
$qbankparams['qperpage'] = 1000; // Should match MAXIMUM_QUESTIONS_PER_PAGE but that constant is not easily accessible.
$qbankparams['category'] = $questiondata->category . ',' . $question->contextid;
$qbankparams['lastchanged'] = $question->id;
if ($questiondata->hidden) {
$qbankparams['showhidden'] = 1;
}
$questionbanklinkedit = new moodle_url('/question/question.php', $editparams);
$questionbanklink = new moodle_url('/question/edit.php', $qbankparams);
$exportquestionlink = new moodle_url('/question/type/stack/exportone.php', $urlparams);
$exportquestionlink->param('sesskey', sesskey());
......@@ -496,23 +499,21 @@ foreach ($testresults as $key => $result) {
}
}
// Display the question.
echo $OUTPUT->heading(stack_string('questionpreview'), 3);
echo html_writer::tag('p', html_writer::link($questionbanklink,
stack_string('seethisquestioninthequestionbank')));
$links = array();
$links[] = html_writer::link($questionbanklink, stack_string('seethisquestioninthequestionbank'));
if ($canedit) {
echo html_writer::tag('p',
html_writer::link($exportquestionlink, stack_string('exportthisquestion')) .
$OUTPUT->help_icon('exportthisquestion', 'qtype_stack'));
$links[] = html_writer::link($questionbanklinkedit, stack_string('editquestioninthequestionbank'));
$links[] = html_writer::link($exportquestionlink, stack_string('exportthisquestion')) .
$OUTPUT->help_icon('exportthisquestion', 'qtype_stack');
}
echo html_writer::tag('p', implode(' | ', $links));
echo html_writer::tag('p',
html_writer::link(new moodle_url('/question/type/stack/questiontestreport.php', $urlparams),
stack_string('basicquestionreport')) . $OUTPUT->help_icon('basicquestionreport', 'qtype_stack'));
// Display the question.
echo $OUTPUT->heading(stack_string('questionpreview'), 3);
echo $renderquestion;
// Display the question note.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment