|
@@ -23,7 +23,7 @@ class Matching extends Question
|
|
{
|
|
{
|
|
parent::__construct();
|
|
parent::__construct();
|
|
$this->type = MATCHING;
|
|
$this->type = MATCHING;
|
|
- $this->isContent = $this-> getIsContent();
|
|
|
|
|
|
+ $this->isContent = $this->getIsContent();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -37,13 +37,13 @@ class Matching extends Question
|
|
$matches = array();
|
|
$matches = array();
|
|
|
|
|
|
$answer = null;
|
|
$answer = null;
|
|
|
|
+ $counter = 1;
|
|
|
|
|
|
if (isset($this->id)) {
|
|
if (isset($this->id)) {
|
|
$answer = new Answer($this->id);
|
|
$answer = new Answer($this->id);
|
|
$answer->read();
|
|
$answer->read();
|
|
|
|
|
|
if (count($answer->nbrAnswers) > 0) {
|
|
if (count($answer->nbrAnswers) > 0) {
|
|
- $counter = 1;
|
|
|
|
for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
|
|
for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
|
|
$correct = $answer->isCorrect($i);
|
|
$correct = $answer->isCorrect($i);
|
|
if (empty($correct)) {
|
|
if (empty($correct)) {
|
|
@@ -97,6 +97,11 @@ class Matching extends Question
|
|
// fill the array with A, B, C.....
|
|
// fill the array with A, B, C.....
|
|
$matches[$i] = chr(64 + $i);
|
|
$matches[$i] = chr(64 + $i);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ for ($i = $counter; $i <= $nb_options; ++$i) {
|
|
|
|
+ // fill the array with A, B, C.....
|
|
|
|
+ $matches[$i] = chr(64 + $i);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
$form->addElement('hidden', 'nb_matches', $nb_matches);
|
|
$form->addElement('hidden', 'nb_matches', $nb_matches);
|
|
@@ -129,10 +134,12 @@ class Matching extends Question
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
|
|
"answer[$i]"
|
|
"answer[$i]"
|
|
);
|
|
);
|
|
|
|
+
|
|
$renderer->setElementTemplate(
|
|
$renderer->setElementTemplate(
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
|
|
"matches[$i]"
|
|
"matches[$i]"
|
|
);
|
|
);
|
|
|
|
+
|
|
$renderer->setElementTemplate(
|
|
$renderer->setElementTemplate(
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
|
|
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
|
|
"weighting[$i]"
|
|
"weighting[$i]"
|
|
@@ -258,7 +265,6 @@ class Matching extends Question
|
|
|
|
|
|
$objAnswer->save();
|
|
$objAnswer->save();
|
|
$this->save();
|
|
$this->save();
|
|
- exit;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|