$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
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')));
+ }
}
}
$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')));
+ }
}
}
}
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 !!
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')));
+ }
}
}
}
$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';