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

Change "Clear all choices" to "Clear my choice" to match Moodle MCQ.

parent 6b35727f
No related branches found
No related tags found
No related merge requests found
...@@ -117,7 +117,7 @@ To enable a student to indicate "none of the others", the teacher must add this ...@@ -117,7 +117,7 @@ To enable a student to indicate "none of the others", the teacher must add this
The radio and dropdown types always add a "not answered" option as the first option. This allows a student to retract their choice, otherwise they will be unable to "uncheck" a radio button, which will be stored, validated and possibly assessed (to their potential detriment). If you want to remove this then use the extra option `nonotanswered`, but keep in mind the possible effect when using the penalty scheme. The radio and dropdown types always add a "not answered" option as the first option. This allows a student to retract their choice, otherwise they will be unable to "uncheck" a radio button, which will be stored, validated and possibly assessed (to their potential detriment). If you want to remove this then use the extra option `nonotanswered`, but keep in mind the possible effect when using the penalty scheme.
If one of the items in the teacher's answer list is is the special variable name `notanswered`, and then default mesage `(No answer given)` will be replaced by the `display` value. If no `display` value is given (and it is optional) then the original message will remain. `notanswered` will not appear in the list of valid choices for a user and `value` for this input is ingored. If one of the items in the teacher's answer list is is the special variable name `notanswered`, and then default mesage `(Clear my choice)` will be replaced by the `display` value. If no `display` value is given (and it is optional) then the original message will remain. `notanswered` will not appear in the list of valid choices for a user and `value` for this input is ingored.
## Extra options ## ## Extra options ##
......
...@@ -398,7 +398,7 @@ $string['singlechargotmorethanone'] = 'You can only enter a single character her ...@@ -398,7 +398,7 @@ $string['singlechargotmorethanone'] = 'You can only enter a single character her
$string['true'] = 'True'; $string['true'] = 'True';
$string['false'] = 'False'; $string['false'] = 'False';
$string['notanswered'] = '(Clear all choices)'; $string['notanswered'] = '(Clear my choice)';
$string['ddl_runtime'] = 'The input has generated the following runtime error which prevents you from answering. Please contact your teacher.'; $string['ddl_runtime'] = 'The input has generated the following runtime error which prevents you from answering. Please contact your teacher.';
$string['ddl_empty'] = 'No choices were provided for this drop-down.'; $string['ddl_empty'] = 'No choices were provided for this drop-down.';
$string['ddl_nocorrectanswersupplied'] = 'The teacher did not indicate at least one correct answer. '; $string['ddl_nocorrectanswersupplied'] = 'The teacher did not indicate at least one correct answer. ';
......
...@@ -72,7 +72,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -72,7 +72,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
$el = stack_input_factory::make('dropdown', 'ans1', '[[1+x,true],[2+y,false]]', null, array()); $el = stack_input_factory::make('dropdown', 'ans1', '[[1+x,true],[2+y,false]]', null, array());
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">'
.'<option value="">(No answer given)</option><option value="1"><code>1+x</code></option>' .'<option value="">(Clear my choice)</option><option value="1"><code>1+x</code></option>'
.'<option selected="selected" value="2"><code>2+y</code></option></select>'; .'<option selected="selected" value="2"><code>2+y</code></option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
stack_input::SCORE, array('2'), '', '', '', '', ''), 'stack1__ans1', false, null)); stack_input::SCORE, array('2'), '', '', '', '', ''), 'stack1__ans1', false, null));
...@@ -127,7 +127,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -127,7 +127,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
$el->adapt_to_model_answer('[[1,true],[2,false,1]]'); $el->adapt_to_model_answer('[[1,true],[2,false,1]]');
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">'
. '<option value="">(No answer given)</option><option value="1"><code>1</code></option>' . '<option value="">(Clear my choice)</option><option value="1"><code>1</code></option>'
. '<option selected="selected" value="2"><code>1</code></option></select>'; . '<option selected="selected" value="2"><code>1</code></option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
stack_input::SCORE, array('2'), '', '', '', '', ''), 'stack1__ans1', false, null)); stack_input::SCORE, array('2'), '', '', '', '', ''), 'stack1__ans1', false, null));
...@@ -153,7 +153,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -153,7 +153,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
$el = $this->make_dropdown(); $el = $this->make_dropdown();
$el->adapt_to_model_answer($this->make_ta()); $el->adapt_to_model_answer($this->make_ta());
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">'
.'<option value="">(No answer given)</option>' .'<option value="">(Clear my choice)</option>'
.'<option value="1"><code>x+1</code></option><option value="2"><code>x+2</code></option>' .'<option value="1"><code>x+1</code></option><option value="2"><code>x+2</code></option>'
.'<option selected="selected" value="3"><code>sin(pi*n)</code></option></select>'; .'<option selected="selected" value="3"><code>sin(pi*n)</code></option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
...@@ -173,7 +173,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -173,7 +173,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
public function test_render_latex() { public function test_render_latex() {
$el = $this->make_dropdown(array('options' => 'LaTeX')); $el = $this->make_dropdown(array('options' => 'LaTeX'));
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">'
.'<option value="">(No answer given)</option><option value="1">\(x+1\)</option>' .'<option value="">(Clear my choice)</option><option value="1">\(x+1\)</option>'
.'<option value="2">\(x+2\)</option>' .'<option value="2">\(x+2\)</option>'
.'<option selected="selected" value="3">\(\sin \left( \pi\cdot n \right)\)</option></select>'; .'<option selected="selected" value="3">\(\sin \left( \pi\cdot n \right)\)</option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
...@@ -183,7 +183,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -183,7 +183,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
public function test_render_latexdisplay() { public function test_render_latexdisplay() {
$el = $this->make_dropdown(array('options' => 'LaTeXdisplay')); $el = $this->make_dropdown(array('options' => 'LaTeXdisplay'));
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">'
.'<option value="">(No answer given)</option><option value="1">\[x+1\]</option>' .'<option value="">(Clear my choice)</option><option value="1">\[x+1\]</option>'
.'<option value="2">\[x+2\]</option>' .'<option value="2">\[x+2\]</option>'
.'<option selected="selected" value="3">\[\sin \left( \pi\cdot n \right)\]</option></select>'; .'<option selected="selected" value="3">\[\sin \left( \pi\cdot n \right)\]</option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
...@@ -232,7 +232,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -232,7 +232,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
$el = stack_input_factory::make('dropdown', 'ans1', '[[1+x,false],[2+x^2,false],[{},true,"None of these"]]', null, array()); $el = stack_input_factory::make('dropdown', 'ans1', '[[1+x,false],[2+x^2,false],[{},true,"None of these"]]', null, array());
$el->adapt_to_model_answer('[[1+x,true],[2+x^2,false],[{},false,"None of these"]]'); $el->adapt_to_model_answer('[[1+x,true],[2+x^2,false],[{},false,"None of these"]]');
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">'
. '<option value="">(No answer given)</option><option value="1"><code>1+x</code></option>' . '<option value="">(Clear my choice)</option><option value="1"><code>1+x</code></option>'
. '<option selected="selected" value="2"><code>2+x^2</code></option>' . '<option selected="selected" value="2"><code>2+x^2</code></option>'
. '<option value="3">None of these</option></select>'; . '<option value="3">None of these</option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
...@@ -288,7 +288,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base { ...@@ -288,7 +288,7 @@ class input_dropdown_test extends qtype_stack_walkthrough_test_base {
$el->adapt_to_model_answer($ta); $el->adapt_to_model_answer($ta);
$expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' . $expected = '<select id="menustack1__ans1" class="select menustack1__ans1" name="stack1__ans1">' .
'<option value="">(No answer given)</option><option selected="selected" value="1">n/a</option>' . '<option value="">(Clear my choice)</option><option selected="selected" value="1">n/a</option>' .
'<option value="2">&ge;</option><option value="3">&le;</option><option value="4">=</option>' . '<option value="2">&ge;</option><option value="3">&le;</option><option value="4">=</option>' .
'<option value="5">?</option></select>'; '<option value="5">?</option></select>';
$this->assert_same_select_html($expected, $el->render(new stack_input_state( $this->assert_same_select_html($expected, $el->render(new stack_input_state(
......
...@@ -72,7 +72,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -72,7 +72,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
$el = stack_input_factory::make('radio', 'ans1', '[[1+x,true],[2+y,false]]', null, array()); $el = stack_input_factory::make('radio', 'ans1', '[[1+x,true],[2+y,false]]', null, array());
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div><div class="option">' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div><div class="option">' .
'<br /></div><div class="option"><input type="radio" name="stack1__ans1" value="1" ' . '<br /></div><div class="option"><input type="radio" name="stack1__ans1" value="1" ' .
'id="stack1__ans1_1" /><label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . 'id="stack1__ans1_1" /><label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
'<span class="nolink">\(1+x\)</span></span></label></div><div class="option">' . '<span class="nolink">\(1+x\)</span></span></label></div><div class="option">' .
...@@ -93,7 +93,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -93,7 +93,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
$expected = '<div class="answer">' $expected = '<div class="answer">'
. '<div class="option"><input type="radio" name="stack1__ans1" value="" id="stack1__ans1_" />' . '<div class="option"><input type="radio" name="stack1__ans1" value="" id="stack1__ans1_" />'
. '<label for="stack1__ans1_">(No answer given)</label></div>' . '<label for="stack1__ans1_">(Clear my choice)</label></div>'
. '<div class="option"><br /></div><div class="option">' . '<div class="option"><br /></div><div class="option">'
. '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />'
. '<label for="stack1__ans1_1"><code>1+x</code></label></div>' . '<label for="stack1__ans1_1"><code>1+x</code></label></div>'
...@@ -154,7 +154,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -154,7 +154,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
$el->adapt_to_model_answer('[[1,true],[2,false,1]]'); $el->adapt_to_model_answer('[[1,true],[2,false,1]]');
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div><div class="option">' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div><div class="option">' .
'<br /></div><div class="option">' . '<br /></div><div class="option">' .
'<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
...@@ -169,7 +169,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -169,7 +169,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
public function test_render_not_answered() { public function test_render_not_answered() {
$el = $this->make_radio(); $el = $this->make_radio();
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div><div class="option">' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div><div class="option">' .
'<br /></div><div class="option">' . '<br /></div><div class="option">' .
'<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
...@@ -188,7 +188,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -188,7 +188,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
public function test_render_default() { public function test_render_default() {
$el = $this->make_radio(); $el = $this->make_radio();
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div>' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div>' .
'<div class="option"><br /></div><div class="option">' . '<div class="option"><br /></div><div class="option">' .
'<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
...@@ -210,7 +210,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -210,7 +210,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
$el = $this->make_radio(array('options' => 'casstring')); $el = $this->make_radio(array('options' => 'casstring'));
$el->adapt_to_model_answer($this->make_ta()); $el->adapt_to_model_answer($this->make_ta());
$expected = '<div class="answer">' $expected = '<div class="answer">'
. '<div class="option"><input type="radio" name="stack1__ans1" value="" id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div>' . '<div class="option"><input type="radio" name="stack1__ans1" value="" id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div>'
. '<div class="option"><br /></div><div class="option"><input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<div class="option"><br /></div><div class="option"><input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />'
. '<label for="stack1__ans1_1"><code>x+1</code></label></div>' . '<label for="stack1__ans1_1"><code>x+1</code></label></div>'
. '<div class="option"><input type="radio" name="stack1__ans1" value="2" id="stack1__ans1_2" /><label for="stack1__ans1_2"><code>x+2</code></label></div>' . '<div class="option"><input type="radio" name="stack1__ans1" value="2" id="stack1__ans1_2" /><label for="stack1__ans1_2"><code>x+2</code></label></div>'
...@@ -226,7 +226,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -226,7 +226,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
public function test_render_latex() { public function test_render_latex() {
$el = $this->make_radio(array('options' => 'LaTeX')); $el = $this->make_radio(array('options' => 'LaTeX'));
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div>' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div>' .
'<div class="option"><br /></div><div class="option">' . '<div class="option"><br /></div><div class="option">' .
'<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
...@@ -247,7 +247,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -247,7 +247,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
public function test_render_latexdisplay() { public function test_render_latexdisplay() {
$el = $this->make_radio(array('options' => 'LaTeXdisplay')); $el = $this->make_radio(array('options' => 'LaTeXdisplay'));
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div><div class="option">' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div><div class="option">' .
'<br /></div><div class="option">' . '<br /></div><div class="option">' .
'<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
...@@ -268,7 +268,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -268,7 +268,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
public function test_render_latexdisplaystyle() { public function test_render_latexdisplaystyle() {
$el = $this->make_radio(array('options' => 'LaTeXdisplaystyle')); $el = $this->make_radio(array('options' => 'LaTeXdisplaystyle'));
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div>' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div>' .
'<div class="option"><br /></div><div class="option">' . '<div class="option"><br /></div><div class="option">' .
'<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
...@@ -334,7 +334,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base { ...@@ -334,7 +334,7 @@ class input_radio_test extends qtype_stack_walkthrough_test_base {
$el->adapt_to_model_answer('[[1+2,true],[2*x,false]]'); $el->adapt_to_model_answer('[[1+2,true],[2*x,false]]');
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
$expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' . $expected = '<div class="answer"><div class="option"><input type="radio" name="stack1__ans1" value="" ' .
'id="stack1__ans1_" /><label for="stack1__ans1_">(No answer given)</label></div><div class="option">' . 'id="stack1__ans1_" /><label for="stack1__ans1_">(Clear my choice)</label></div><div class="option">' .
'<br /></div><div class="option"><input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' . '<br /></div><div class="option"><input type="radio" name="stack1__ans1" value="1" id="stack1__ans1_1" />' .
'<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' . '<label for="stack1__ans1_1"><span class="filter_mathjaxloader_equation">' .
'<span class="nolink">\(1+2\)</span></span></label></div><div class="option">' . '<span class="nolink">\(1+2\)</span></span></label></div><div class="option">' .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment