]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14831 adding warning - excluded grades are not compatible with sum agg
authorskodak <skodak>
Fri, 8 May 2009 20:07:33 +0000 (20:07 +0000)
committerskodak <skodak>
Fri, 8 May 2009 20:07:33 +0000 (20:07 +0000)
grade/edit/tree/grade_form.php
lang/en_utf8/grades.php

index 4726ccc3c199102ae0b606b035e6c1b5f1a5a723..2b9fab70baece02d1b7884dcd950dfa64447fd7b 100755 (executable)
@@ -35,6 +35,15 @@ class edit_grade_form extends moodleform {
         $grade_item = $this->_customdata['grade_item'];
         $gpr        = $this->_customdata['gpr'];
 
+        if ($grade_item->is_course_item()) {
+            $grade_category = null;
+        } else if ($grade_item->is_category_item()) {
+            $grade_category = $grade_item->get_item_category();
+            $grade_category = $grade_category->get_parent_category();
+        } else {
+            $grade_category = $grade_item->get_parent_category();
+        }
+
         /// information fields
         $mform->addElement('static', 'user', get_string('user'));
         $mform->addElement('static', 'itemname', get_string('itemname', 'grades'));
@@ -72,7 +81,11 @@ class edit_grade_form extends moodleform {
             $mform->disabledIf('finalgrade', 'overridden', 'notchecked');
         }
 
-        $mform->addElement('advcheckbox', 'excluded', get_string('excluded', 'grades'));
+        if ($grade_category and $grade_category->aggregation == GRADE_AGGREGATE_SUM) {
+            $mform->addElement('advcheckbox', 'excluded', get_string('excluded', 'grades'), '<small>('.get_string('warningexcludedsum', 'grades').')</small>');
+        } else {
+            $mform->addElement('advcheckbox', 'excluded', get_string('excluded', 'grades'));
+        }
         $mform->setHelpButton('excluded', array('excluded', get_string('excluded', 'grades'), 'grade'));
 
         /// hiding
index 1167cadc73cfc795b947f802a5a9928f6cd6a027..1cbcde65afc8450a8a4f34e28506ec0da1945a6f 100644 (file)
@@ -562,6 +562,7 @@ $string['useweighted'] = 'Use weighted';
 $string['verbosescales'] = 'Verbose scales';
 $string['viewbygroup'] = 'Group';
 $string['viewgrades'] = 'View grades';
+$string['warningexcludedsum'] = 'Warning: excluding of grades is not compatible with sum aggregation.';
 $string['weight'] = 'weight';
 $string['weightuc'] = 'Weight';
 $string['weightcourse'] = 'Use weighted grades for course';