|
|
|
@ -81,12 +81,12 @@ class MatchingDraggable extends Question |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($matches)) { |
|
|
|
|
for ($i = 1; $i <= $nb_options; ++$i) { |
|
|
|
|
for ($i = 1; $i <= $nb_options; $i++) { |
|
|
|
|
// fill the array with A, B, C..... |
|
|
|
|
$matches[$i] = chr(64 + $i); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for ($i = $counter; $i <= $nb_options; ++$i) { |
|
|
|
|
for ($i = $counter; $i <= $nb_options; $i++) { |
|
|
|
|
// fill the array with A, B, C..... |
|
|
|
|
$matches[$i] = chr(64 + $i); |
|
|
|
|
} |
|
|
|
@ -121,7 +121,7 @@ class MatchingDraggable extends Question |
|
|
|
|
'Height' => '125', |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
for ($i = 1; $i <= $nb_matches; ++$i) { |
|
|
|
|
for ($i = 1; $i <= $nb_matches; $i++) { |
|
|
|
|
$renderer = &$form->defaultRenderer(); |
|
|
|
|
$renderer->setElementTemplate( |
|
|
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', |
|
|
|
@ -174,7 +174,7 @@ class MatchingDraggable extends Question |
|
|
|
|
echo Display::return_message(get_lang('YouHaveToCreateAtLeastOneAnswer'), 'normal'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for ($i = 1; $i <= $nb_options; ++$i) { |
|
|
|
|
for ($i = 1; $i <= $nb_options; $i++) { |
|
|
|
|
$renderer = &$form->defaultRenderer(); |
|
|
|
|
|
|
|
|
|
$renderer->setElementTemplate( |
|
|
|
@ -232,14 +232,14 @@ class MatchingDraggable extends Question |
|
|
|
|
$objAnswer = new Answer($this->id); |
|
|
|
|
|
|
|
|
|
// Insert the options |
|
|
|
|
for ($i = 1; $i <= $nb_options; ++$i) { |
|
|
|
|
for ($i = 1; $i <= $nb_options; $i++) { |
|
|
|
|
$position++; |
|
|
|
|
$option = $form->getSubmitValue("option[$i]"); |
|
|
|
|
$objAnswer->createAnswer($option, 0, '', 0, $position); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Insert the answers |
|
|
|
|
for ($i = 1; $i <= $nb_matches; ++$i) { |
|
|
|
|
for ($i = 1; $i <= $nb_matches; $i++) { |
|
|
|
|
$position++; |
|
|
|
|
$answer = $form->getSubmitValue("answer[$i]"); |
|
|
|
|
$matches = $form->getSubmitValue("matches[$i]"); |
|
|
|
|