MDL-18987 fixed broken item editing when only one category present; merged from MOODL...
authorskodak <skodak>
Mon, 27 Apr 2009 14:27:13 +0000 (14:27 +0000)
committerskodak <skodak>
Mon, 27 Apr 2009 14:27:13 +0000 (14:27 +0000)
grade/edit/tree/item_form.php

index a2c0623..4b689dc 100644 (file)
@@ -267,7 +267,11 @@ class edit_item_form extends moodleform {
                         } else {
                             $element =& $mform->createElement('text', 'aggregationcoef', get_string($coefstring, 'grades'));
                         }
-                        $mform->insertElementBefore($element, 'parentcategory');
+                        if ($mform->elementExists('parentcategory')) {
+                            $mform->insertElementBefore($element, 'parentcategory');
+                        } else {
+                            $mform->insertElementBefore($element, 'id');
+                        }
                         $mform->setHelpButton('aggregationcoef', array($coefstring, get_string($coefstring, 'grades'), 'grade'), true);
                     }