mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-46662 grader: Improve course header and aggregation accessibility
Deprecated unused grader collapse icon function.
This commit is contained in:
parent
4c27f52d91
commit
2350b3f453
@ -793,8 +793,7 @@ class grade_report_grader extends grade_report {
|
||||
$categorycell = new html_table_cell();
|
||||
$categorycell->attributes['class'] = 'category ' . $catlevel;
|
||||
$categorycell->colspan = $colspan;
|
||||
$categorycell->text = shorten_text($element['object']->get_name());
|
||||
$categorycell->text .= $this->get_collapsing_icon($element);
|
||||
$categorycell->text = $this->get_course_header($element);
|
||||
$categorycell->header = true;
|
||||
$categorycell->scope = 'col';
|
||||
|
||||
@ -832,8 +831,10 @@ class grade_report_grader extends grade_report {
|
||||
'id' => $this->course->id,
|
||||
'item' => 'grade',
|
||||
'itemid' => $element['object']->id));
|
||||
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades',
|
||||
$element['object']->get_name())));
|
||||
$singleview = $OUTPUT->action_icon(
|
||||
$url,
|
||||
new pix_icon('t/editstring', get_string('singleview', 'grades', $element['object']->itemname))
|
||||
);
|
||||
}
|
||||
|
||||
$itemcell->colspan = $colspan;
|
||||
@ -1495,6 +1496,49 @@ class grade_report_grader extends grade_report {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given element category, create a collapsible icon and
|
||||
* course header.
|
||||
*
|
||||
* @param object $element
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function get_course_header($element) {
|
||||
global $OUTPUT;
|
||||
|
||||
$icon = '';
|
||||
// If object is a category, display expand/contract icon.
|
||||
if ($element['type'] == 'category') {
|
||||
// Load language strings.
|
||||
$strswitchminus = $this->get_lang_string('aggregatesonly', 'grades');
|
||||
$strswitchplus = $this->get_lang_string('gradesonly', 'grades');
|
||||
$strswitchwhole = $this->get_lang_string('fullmode', 'grades');
|
||||
|
||||
$url = new moodle_url($this->gpr->get_return_url(null, array('target' => $element['eid'], 'sesskey' => sesskey())));
|
||||
|
||||
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
|
||||
$url->param('action', 'switch_plus');
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', $strswitchplus), null, null);
|
||||
$showing = get_string('showingaggregatesonly', 'grades');
|
||||
} else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
|
||||
$url->param('action', 'switch_whole');
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', $strswitchwhole), null, null);
|
||||
$showing = get_string('showinggradesonly', 'grades');
|
||||
} else {
|
||||
$url->param('action', 'switch_minus');
|
||||
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', $strswitchminus), null, null);
|
||||
$showing = get_string('showingfullmode', 'grades');
|
||||
}
|
||||
}
|
||||
|
||||
$name = shorten_text($element['object']->get_name());
|
||||
$courseheader = html_writer::tag('span', $name, array('id' => 'courseheader'));
|
||||
$courseheader .= html_writer::label($showing, 'courseheader', false, array('class' => 'accesshide'));
|
||||
$courseheader .= $icon;
|
||||
|
||||
return $courseheader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a grade_category, grade_item or grade_grade, this function
|
||||
* figures out the state of the object and builds then returns a div
|
||||
@ -1555,11 +1599,16 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
/**
|
||||
* Given a category element returns collapsing +/- icon if available
|
||||
*
|
||||
* @deprecated since Moodle 2.9 MDL-46662 - please do not use this function any more.
|
||||
* @todo MDL-49021 This will be deleted in Moodle 3.1
|
||||
* @see grade_report_grader::get_course_header()
|
||||
* @param object $element
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function get_collapsing_icon($element) {
|
||||
global $OUTPUT;
|
||||
debugging('get_collapsing_icon is deprecated, please use get_course_header instead.', DEBUG_DEVELOPER);
|
||||
|
||||
$icon = '';
|
||||
// If object is a category, display expand/contract icon
|
||||
|
@ -1,5 +1,7 @@
|
||||
This files describes API changes in /grade/report/*,
|
||||
information provided here is intended especially for developers.
|
||||
=== 2.9 ===
|
||||
* Deprecating grade_report_grader:get_collapsing_icon.
|
||||
|
||||
=== 2.8.2 ===
|
||||
* gradereport_singleview::__construct doesn't need groupid parameter anymore, so it was renamed to $unused.
|
||||
|
@ -47,7 +47,7 @@ $string['aggregateonlygraded_help'] = 'An empty grade is a grade which is missin
|
||||
This setting determines whether empty grades are not included in the aggregation or are counted as minimal grades, for example 0 for an assignment graded between 0 and 100.';
|
||||
$string['aggregateoutcomes'] = 'Include outcomes in aggregation';
|
||||
$string['aggregateoutcomes_help'] = 'If enabled, outcomes are included in the aggregation. This may result in an unexpected category total.';
|
||||
$string['aggregatesonly'] = 'Aggregates only';
|
||||
$string['aggregatesonly'] = 'Change to aggregates only';
|
||||
$string['aggregatesum'] = 'Natural';
|
||||
$string['aggregateweightedmean'] = 'Weighted mean of grades';
|
||||
$string['aggregateweightedmean2'] = 'Simple weighted mean of grades';
|
||||
@ -227,7 +227,7 @@ $string['forceon'] = 'Force: On';
|
||||
$string['forelementtypes'] = 'for the selected {$a}';
|
||||
$string['forstudents'] = 'For students';
|
||||
$string['full'] = 'Full';
|
||||
$string['fullmode'] = 'Full view';
|
||||
$string['fullmode'] = 'Change to full view';
|
||||
$string['generalsettings'] = 'General settings';
|
||||
$string['grade'] = 'Grade';
|
||||
$string['gradeadministration'] = 'Grade administration';
|
||||
@ -311,7 +311,7 @@ $string['graderreport'] = 'Grader report';
|
||||
$string['grades'] = 'Grades';
|
||||
$string['gradesforuser'] = 'Grades for {$a->user}';
|
||||
$string['singleview'] = 'Single view for {$a}';
|
||||
$string['gradesonly'] = 'Grades only';
|
||||
$string['gradesonly'] = 'Change to grades only';
|
||||
$string['gradessettings'] = 'Grade settings';
|
||||
$string['gradetype'] = 'Grade type';
|
||||
$string['gradetype_help'] = 'There are 4 grade types:
|
||||
@ -614,6 +614,9 @@ $string['showfeedback'] = 'Show feedback';
|
||||
$string['showfeedback_help'] = 'Show the feedback column?';
|
||||
$string['showgrade'] = 'Show grades';
|
||||
$string['showgrade_help'] = 'Show the grade column?';
|
||||
$string['showingaggregatesonly'] = 'Showing aggregates only';
|
||||
$string['showingfullmode'] = 'Showing full view';
|
||||
$string['showinggradesonly'] = 'Showing grades only';
|
||||
$string['showlettergrade'] = 'Show letter grades';
|
||||
$string['showlettergrade_help'] = 'Show the letter grade column?';
|
||||
$string['showrange'] = 'Show ranges';
|
||||
|
Loading…
x
Reference in New Issue
Block a user