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

Improve the logic in deploying variants when a question randomization is dropped.

parent af66f6a8
No related branches found
No related tags found
No related merge requests found
......@@ -135,10 +135,14 @@ if (!$question->has_random_variants()) {
' ' . $OUTPUT->action_icon(question_preview_url($questionid, null, null, null, null, $context),
new pix_icon('t/preview', get_string('preview'))));
$variantmatched = true;
} else if (empty($question->deployedseeds)) {
}
if (empty($question->deployedseeds)) {
if ($question->has_random_variants()) {
echo html_writer::tag('p', stack_string('questionnotdeployedyet').' '.
$OUTPUT->action_icon(question_preview_url($questionid, null, null, null, null, $context),
new pix_icon('t/preview', get_string('preview'))));
}
} else {
$notestable = new html_table();
......@@ -221,6 +225,7 @@ if (!$variantmatched) {
array('class' => 'undeployedvariant'));
}
// Add in some logic for a case where the author removes randomization after variants have been deployed.
if ($question->has_random_variants()) {
echo html_writer::start_tag('p');
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'switchtovariant',
......@@ -253,7 +258,11 @@ if ($question->has_random_variants()) {
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
echo ' ' . stack_string('deploymanynotes');
echo html_writer::end_tag('form');
}
echo html_writer::end_tag('p');
}
if (!(empty($question->deployedseeds)) && $canedit) {
// Undeploy all the variants.
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'deploymany',
'action' => new moodle_url('/question/type/stack/deploy.php', $urlparams)));
......@@ -263,8 +272,6 @@ if ($question->has_random_variants()) {
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
echo html_writer::end_tag('form');
}
echo html_writer::end_tag('p');
}
// Display the controls to add another question test.
echo $OUTPUT->heading(stack_string('questiontests'), 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment