* @param bool $withlink Whether or not this header has a link
* @param bool $icon Whether or not to display an icon with this header
* @param bool $spacerifnone return spacer if no icon found
+ * @param bool $withdescription Show description if defined by this item.
*
* @return string header
*/
- public function get_element_header(&$element, $withlink=false, $icon=true, $spacerifnone=false) {
+ public function get_element_header(&$element, $withlink=false, $icon=true, $spacerifnone=false, $withdescription=false) {
$header = '';
if ($icon) {
}
}
+ if ($withdescription) {
+ $desc = $element['object']->get_description();
+ if (!empty($desc)) {
+ $header .= '<div class="gradeitemdescription">' . s($desc) . '</div><div class="gradeitemdescriptionfiller"></div>';
+ }
+ }
+
return $header;
}
$grade_object = $element['object'];
$eid = $grade_object->id;
$element['userid'] = $this->user->id;
- $fullname = $this->gtree->get_element_header($element, true, true, true);
+ $fullname = $this->gtree->get_element_header($element, true, true, true, true);
$data = array();
$hidden = '';
$excluded = '';
table.user-grade td.feedbacktext {text-align:left;width: 40%;font-size: 0.8em;white-space:normal;}
table.user-grade td.itemcenter {text-align:center;}
+.user-grade .gradeitemdescription { font-weight: normal; position: absolute; }
+.user-grade .gradeitemdescriptionfiller { clear: left; height: 1em; }
+.user-grade .gradeitemdescription { font-weight: normal; position: absolute;}
$string['aggregatemedian'] = 'Median of grades';
$string['aggregatemin'] = 'Lowest grade';
$string['aggregatemode'] = 'Mode of grades';
+$string['aggregatenotonlygraded'] = 'Include empty grades';
$string['aggregateonlygraded'] = 'Exclude empty grades';
$string['aggregateonlygraded_help'] = 'An empty grade is a grade which is missing from the gradebook. It may be from an assignment submission which has not yet been graded or from a quiz which has not yet been attempted etc.
$string['aggregateoutcomes_help'] = 'If enabled, outcomes are included in the aggregation. This may result in an unexpected category total.';
$string['aggregatesonly'] = 'Aggregates only';
$string['aggregatesubcats'] = 'Aggregate including subcategories';
+$string['aggregatesubcatsshort'] = 'Include subcategories';
$string['aggregatesubcats_help'] = 'This setting determines whether grades in subcategories are included in the aggregation.';
$string['aggregatesum'] = 'Sum of grades';
$string['aggregateweightedmean'] = 'Weighted mean of grades';
$string['droplow_help'] = 'This setting enables a specified number of the lowest grades to be excluded from the aggregation.';
$string['droplowestvalue'] = 'Set drop lowest grade value';
$string['dropped'] = 'Dropped';
+$string['droplowestvalues'] = 'Drop {$a} lowest values';
$string['dropxlowest'] = 'Drop X lowest';
$string['dropxlowestwarning'] = 'Note: If you use drop x lowest the grading assumes that all items in the category have the same point value. If point values differ results will be unpredictable';
$string['duplicatescale'] = 'Duplicate scale';
$string['items'] = 'Items';
$string['itemsedit'] = 'Edit grade item';
$string['keephigh'] = 'Keep the highest';
+$string['keephighestvalues'] = 'Keep the {$a} highest values';
$string['keephigh_help'] = 'If set, this option will only keep the X highest grades, X being the selected value for this option.';
$string['keymanager'] = 'Key manager';
$string['lessthanmin'] = 'The grade entered for {$a->itemname} for {$a->username} is less than the minimum allowed';
}
}
+ /**
+ * Describe the aggregation settings for this category so the reports make more sense.
+ *
+ * @return string description
+ */
+ public function get_description() {
+ $allhelp = array();
+ $aggrstrings = grade_helper::get_aggregation_strings();
+ $allhelp[] = $aggrstrings[$this->aggregation];
+
+ if ($this->droplow) {
+ $allhelp[] = get_string('droplowestvalues', 'grades', $this->droplow);
+ }
+ if ($this->keephigh) {
+ $allhelp[] = get_string('keephighestvalues', 'grades', $this->keephigh);
+ }
+ if (!$this->aggregateonlygraded) {
+ $allhelp[] = get_string('aggregatenotonlygraded', 'grades');
+ }
+ if ($this->aggregatesubcats) {
+ $allhelp[] = get_string('aggregatesubcatsshort', 'grades');
+ }
+ return implode('. ', $allhelp) . '.';
+ }
+
/**
* Sets this category's parent id
*
}
}
+ /**
+ * A grade item can return a more detailed description which will be added to the header of the column/row in some reports.
+ *
+ * @return string description
+ */
+ public function get_description() {
+ if ($this->is_course_item() || $this->is_category_item()) {
+ $categoryitem = $this->load_item_category();
+ return $categoryitem->get_description();
+ }
+ return '';
+ }
+
/**
* Sets this item's categoryid. A generic method shared by objects that have a parent id of some kind.
*