Преглед изворни кода

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

Angel Fernando Quiroz Campos пре 9 година
родитељ
комит
5321bdee71
2 измењених фајлова са 4 додато и 24 уклоњено
  1. 2 12
      main/exercice/MatchingDraggable.php
  2. 2 12
      main/exercice/matching.class.php

+ 2 - 12
main/exercice/MatchingDraggable.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

+ 2 - 12
main/exercice/matching.class.php

@@ -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