Force to choose the same number of proposal than of answers - refs #7878

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 73a64d311e
commit 5321bdee71
  1. 14
      main/exercice/MatchingDraggable.php
  2. 14
      main/exercice/matching.class.php

@ -53,16 +53,12 @@ class MatchingDraggable extends Question
if ($form->isSubmitted()) {
$nb_matches = $form->getSubmitValue('nb_matches');
$nb_options = $form->getSubmitValue('nb_options');
if (isset($_POST['lessMatches'])) {
$nb_matches--;
}
if (isset($_POST['moreMatches'])) {
$nb_matches++;
}
if (isset($_POST['lessOptions'])) {
$nb_matches--;
$nb_options--;
}
if (isset($_POST['moreOptions'])) {
$nb_matches++;
$nb_options++;
}
} else if (!empty($this->id)) {
@ -152,12 +148,6 @@ class MatchingDraggable extends Question
$form->addHtml('</tbody></table>');
$group = array();
$renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessMatches');
$renderer->setElementTemplate('{element}</div></div>', 'moreMatches');
$group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true);
$group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true);
$form->addGroup($group);
// DISPLAY OPTIONS

@ -58,16 +58,12 @@ class Matching extends Question
if ($form->isSubmitted()) {
$nb_matches = $form->getSubmitValue('nb_matches');
$nb_options = $form->getSubmitValue('nb_options');
if (isset($_POST['lessMatches'])) {
$nb_matches--;
}
if (isset($_POST['moreMatches'])) {
$nb_matches++;
}
if (isset($_POST['lessOptions'])) {
$nb_matches--;
$nb_options--;
}
if (isset($_POST['moreOptions'])) {
$nb_matches++;
$nb_options++;
}
} else if (!empty($this->id)) {
@ -160,12 +156,6 @@ class Matching extends Question
$form->addHtml('</tbody></table>');
$group = array();
$renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessMatches');
$renderer->setElementTemplate('{element}</div></div>', 'moreMatches');
$group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true);
$group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true);
$form->addGroup($group);
// DISPLAY OPTIONS

Loading…
Cancel
Save