]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9076 - Move the 'Add 3 more overall feedbacks' button inside that group of elemen...
authortjhunt <tjhunt>
Tue, 9 Oct 2007 15:44:06 +0000 (15:44 +0000)
committertjhunt <tjhunt>
Tue, 9 Oct 2007 15:44:06 +0000 (15:44 +0000)
To make this possible, I added an extra argument to the repeat_elements method, which other people may find helpful on other forms.

lang/en_utf8/quiz.php
lib/formslib.php
mod/quiz/mod_form.php

index d86002802a136dd3bde40827283a73d1f827c423..c9b76e09e96cd16b581f7618ac9f3db94bdfaace 100644 (file)
@@ -22,6 +22,7 @@ $string['addingrandom'] = 'Adding a Random Question';
 $string['addingrandomsamatch'] = 'Adding a Random Short-Answer Matching question';
 $string['addingshortanswer'] = 'Adding a Short-Answer question';
 $string['addingtruefalse'] = 'Adding a True/False question';
+$string['addmoreoverallfeedbacks'] = 'Add {no} more feedback fields';
 $string['addquestions'] = 'Add questions';
 $string['addquestionstoquiz'] = 'Add questions to current quiz';
 $string['addrandom'] = 'Add $a random questions';
index b12392b03abe31acd9f58f483587835bcacc9e6f..e8a447c69588a71ab838186c8640ef87682475dd 100644 (file)
@@ -524,9 +524,11 @@ class moodleform {
      * @param string $addfieldsname name for button to add more fields
      * @param int $addfieldsno how many fields to add at a time
      * @param string $addstring name of button, {no} is replaced by no of blanks that will be added.
+     * @param boolean $addbuttoninside if true, don't call closeHeaderBefore($addfieldsname). Default false.
      * @return int no of repeats of element in this page
      */
-    function repeat_elements($elementobjs, $repeats, $options, $repeathiddenname, $addfieldsname, $addfieldsno=5, $addstring=null){
+    function repeat_elements($elementobjs, $repeats, $options, $repeathiddenname,
+            $addfieldsname, $addfieldsno=5, $addstring=null, $addbuttoninside=false){
         if ($addstring===null){
             $addstring = get_string('addfields', 'form', $addfieldsno);
         } else {
@@ -598,7 +600,9 @@ class moodleform {
         }
         $mform->addElement('submit', $addfieldsname, $addstring);
 
-        $mform->closeHeaderBefore($addfieldsname);
+        if (!$addbuttoninside) {
+            $mform->closeHeaderBefore($addfieldsname);
+        }
 
         return $repeats;
     }
index 002e69009d0d95fe9b991f193f58b99814c5cca8..fdccacd21831ec9045c664b49f59351b8d7c361c 100644 (file)
@@ -237,7 +237,8 @@ class mod_quiz_mod_form extends moodleform_mod {
         $mform->setType('feedbackboundaries', PARAM_NOTAGS);
 
         $nextel=$this->repeat_elements($repeatarray, $numfeedbacks-1,
-                    array(), 'boundary_repeats', 'boundary_add_fields', 3);
+                array(), 'boundary_repeats', 'boundary_add_fields', 3,
+                get_string('addmoreoverallfeedbacks', 'quiz'), true);
 
         //put some extra elements in before the button
         $insertEl = &MoodleQuickForm::createElement('text', "feedbacktext[$nextel]", get_string('feedback', 'quiz'), array('size' => 50));