]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11835 proper labels for aggregation coef - weight and extra credit
authorskodak <skodak>
Sat, 20 Oct 2007 19:12:33 +0000 (19:12 +0000)
committerskodak <skodak>
Sat, 20 Oct 2007 19:12:33 +0000 (19:12 +0000)
grade/edit/tree/item_form.php
grade/edit/tree/outcomeitem_form.php
lang/en_utf8/grades.php

index d0298f2efffd15f4d570cf9c2f3973ac6d226b0f..9251cfd9a1cb6e1035ec9af7dff443f5500307c8 100644 (file)
@@ -101,8 +101,6 @@ class edit_item_form extends moodleform {
         $mform->disabledIf('plusfactor', 'gradetype', 'eq', GRADE_TYPE_TEXT);
 
         $mform->addElement('text', 'aggregationcoef', get_string('aggregationcoef', 'grades'));
-        $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoef', 'grades'),
-                false, true, false, get_string('aggregationcoefhelp', 'grades')));
 
         /// grade display prefs
 
@@ -203,17 +201,29 @@ class edit_item_form extends moodleform {
             if ($grade_item->is_course_item()) {
                 $mform->removeElement('aggregationcoef');
 
-            } else if ($grade_item->is_category_item()) {
-                $category = $grade_item->get_item_category();
-                $parent_category = $category->get_parent_category();
-                if (!$parent_category->is_aggregationcoef_used()) {
-                    $mform->removeElement('aggregationcoef');
+            } else {
+                if ($grade_item->is_category_item()) {
+                    $category = $grade_item->get_item_category();
+                    $parent_category = $category->get_parent_category();
+                } else {
+                    $parent_category = $grade_item->get_parent_category();
                 }
 
-            } else {
-                $parent_category = $grade_item->get_parent_category();
+                $parent_category->apply_forced_settings();
+
                 if (!$parent_category->is_aggregationcoef_used()) {
                     $mform->removeElement('aggregationcoef');
+                } else {
+                    $agg_el =& $mform->getElement('aggregationcoef');
+                    if ($parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
+                        $agg_el->setLabel(get_string('aggregationcoefweight', 'grades'));
+                        $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefweight', 'grades'),
+                                false, true, false, get_string('aggregationcoefweighthelp', 'grades')));
+                    } else if ($parent_category->aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN) {
+                        $agg_el->setLabel(get_string('aggregationcoefextra', 'grades'));
+                        $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefextra', 'grades'),
+                                false, true, false, get_string('aggregationcoefextrahelp', 'grades')));
+                    }
                 }
             }
 
@@ -222,9 +232,20 @@ class edit_item_form extends moodleform {
             $mform->removeElement('plusfactor');
             $mform->removeElement('multfactor');
 
-            $course_category = grade_category::fetch_course_category($COURSE->id);
-            if (!$course_category->is_aggregationcoef_used()) {
+            $parent_category = grade_category::fetch_course_category($COURSE->id);
+            if (!$parent_category->is_aggregationcoef_used()) {
                 $mform->removeElement('aggregationcoef');
+            } else {
+                $agg_el =& $mform->getElement('aggregationcoef');
+                if ($parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
+                    $agg_el->setLabel(get_string('aggregationcoefweight', 'grades'));
+                    $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefweight', 'grades'),
+                            false, true, false, get_string('aggregationcoefweighthelp', 'grades')));
+                } else if ($parent_category->aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN) {
+                    $agg_el->setLabel(get_string('aggregationcoefextra', 'grades'));
+                    $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefextra', 'grades'),
+                            false, true, false, get_string('aggregationcoefextrahelp', 'grades')));
+                }
             }
         }
     }
index e03893969dc51af4c6316405310d09ade345e83b..3f1623c484035ae62799d17e021d67c0562433a4 100644 (file)
@@ -76,8 +76,6 @@ class edit_outcomeitem_form extends moodleform {
                 false, true, false, get_string('gradepasshelp', 'grades')));*/
 
         $mform->addElement('text', 'aggregationcoef', get_string('aggregationcoef', 'grades'));
-        $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoef', 'grades'),
-                false, true, false, get_string('aggregationcoefhelp', 'grades')));
 
         /// hiding
         /// advcheckbox is not compatible with disabledIf !!
@@ -123,24 +121,47 @@ class edit_outcomeitem_form extends moodleform {
             if ($grade_item->is_course_item()) {
                 $mform->removeElement('aggregationcoef');
 
-            } else if ($grade_item->is_category_item()) {
-                $category = $grade_item->get_item_category();
-                $parent_category = $category->get_parent_category();
-                if (!$parent_category->is_aggregationcoef_used()) {
-                    $mform->removeElement('aggregationcoef');
+            } else {
+                if ($grade_item->is_category_item()) {
+                    $category = $grade_item->get_item_category();
+                    $parent_category = $category->get_parent_category();
+                } else {
+                    $parent_category = $grade_item->get_parent_category();
                 }
 
-            } else {
-                $parent_category = $grade_item->get_parent_category();
-                if (!$parent_category->is_aggregationcoef_used()) {
+                $parent_category->apply_forced_settings();
+
+                if (!$parent_category->is_aggregationcoef_used() or !$parent_category->aggregateoutcomes) {
                     $mform->removeElement('aggregationcoef');
+                } else {
+                    $agg_el =& $mform->getElement('aggregationcoef');
+                    if ($parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
+                        $agg_el->setLabel(get_string('aggregationcoefweight', 'grades'));
+                        $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefweight', 'grades'),
+                                false, true, false, get_string('aggregationcoefweighthelp', 'grades')));
+                    } else if ($parent_category->aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN) {
+                        $agg_el->setLabel(get_string('aggregationcoefextra', 'grades'));
+                        $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefextra', 'grades'),
+                                false, true, false, get_string('aggregationcoefextrahelp', 'grades')));
+                    }
                 }
             }
 
         } else {
-            $course_category = grade_category::fetch_course_category($COURSE->id);
-            if (!$course_category->is_aggregationcoef_used()) {
+            $parent_category = grade_category::fetch_course_category($COURSE->id);
+            if (!$parent_category->is_aggregationcoef_used() or !$parent_category->aggregateoutcomes) {
                 $mform->removeElement('aggregationcoef');
+            } else {
+                $agg_el =& $mform->getElement('aggregationcoef');
+                if ($parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) {
+                    $agg_el->setLabel(get_string('aggregationcoefweight', 'grades'));
+                    $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefweight', 'grades'),
+                            false, true, false, get_string('aggregationcoefweighthelp', 'grades')));
+                } else if ($parent_category->aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN) {
+                    $agg_el->setLabel(get_string('aggregationcoefextra', 'grades'));
+                    $mform->setHelpButton('aggregationcoef', array(false, get_string('aggregationcoefextra', 'grades'),
+                            false, true, false, get_string('aggregationcoefextrahelp', 'grades')));
+                }
             }
         }
     }
index 6d7cefe68080894582d106c34b9b136b19def663..8217f91cbc633dbf7396850141197ce8598686bf 100644 (file)
@@ -27,7 +27,10 @@ $string['aggregatesonly'] = 'Aggregates only';
 $string['aggregateweightedmean'] = 'Weighted mean of grades';
 $string['aggregation'] = 'Aggregation';
 $string['aggregationcoef'] = 'Aggregation coefficient';
-$string['aggregationcoefhelp'] = 'Weight applied to all grades in this grade item during aggregation with other grade items.';
+$string['aggregationcoefextra'] = 'Extra credit';
+$string['aggregationcoefextrahelp'] = 'Extra credit for this grade item during aggregation.';
+$string['aggregationcoefweight'] = 'Item weight';
+$string['aggregationcoefweighthelp'] = 'Weight applied to all grades in this grade item during aggregation with other grade items.';
 $string['aggregationhelp'] = 'Strategy used to aggregate grades across all students in a course.';
 $string['aggregationposition'] = 'Aggregation position';
 $string['aggregationview'] = 'Aggregation view';