mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-75423 gradereport_singleview: Move show all grades into a menu
This commit is contained in:
parent
56a454149b
commit
809781c0cc
@ -215,7 +215,6 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
|
||||
$item->imagealt = $fullname;
|
||||
$url = new moodle_url("/user/view.php", ['id' => $item->id, 'course' => $this->courseid]);
|
||||
$iconstring = get_string('filtergrades', 'gradereport_singleview', $fullname);
|
||||
$grade->label = $fullname;
|
||||
$userpic = $OUTPUT->user_picture($item, ['link' => false, 'visibletoscreenreaders' => false]);
|
||||
|
||||
@ -223,8 +222,7 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
|
||||
$line = [
|
||||
html_writer::link($url, $userpic . $fullname),
|
||||
$OUTPUT->action_icon($this->format_link('user', $item->id), new pix_icon('t/editstring', ''), null,
|
||||
['title' => $iconstring, 'aria-label' => $iconstring]),
|
||||
$this->get_user_action_menu($item),
|
||||
$formatteddefinition['finalgrade'],
|
||||
$this->item_range(),
|
||||
$formatteddefinition['feedback'],
|
||||
@ -382,4 +380,25 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
}
|
||||
return parent::process($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the action menu HTML for the user item.
|
||||
*
|
||||
* @param \stdClass $user
|
||||
* @return mixed
|
||||
*/
|
||||
private function get_user_action_menu(\stdClass $user) {
|
||||
global $OUTPUT;
|
||||
|
||||
$menuitems = [];
|
||||
$url = new moodle_url($this->format_link('user', $user->id));
|
||||
$title = get_string('showallgrades', 'core_grades');
|
||||
$menuitems[] = new \action_menu_link_secondary($url, null, $title);
|
||||
$menu = new \action_menu($menuitems);
|
||||
$icon = $OUTPUT->pix_icon('i/moremenu', get_string('actions'));
|
||||
$menu->set_menu_trigger($icon);
|
||||
$menu->set_menu_left();
|
||||
|
||||
return $OUTPUT->render($menu);
|
||||
}
|
||||
}
|
||||
|
@ -170,8 +170,6 @@ class user extends tablelike implements selectable_items {
|
||||
$lockicon = $OUTPUT->pix_icon('t/locked', 'grade is locked');
|
||||
}
|
||||
|
||||
$iconstring = get_string('filtergrades', 'gradereport_singleview', $item->get_name());
|
||||
|
||||
// Create a fake gradetreeitem so we can call get_element_header().
|
||||
// The type logic below is from grade_category->_get_children_recursion().
|
||||
$gradetreeitem = [];
|
||||
@ -190,8 +188,7 @@ class user extends tablelike implements selectable_items {
|
||||
|
||||
$line = [
|
||||
$this->format_icon($item) . $lockicon . $itemlabel,
|
||||
$OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', ''), null,
|
||||
['title' => $iconstring, 'aria-label' => $iconstring]),
|
||||
$this->get_item_action_menu($item),
|
||||
$this->category($item),
|
||||
$formatteddefinition['finalgrade'],
|
||||
new range($item),
|
||||
@ -236,6 +233,27 @@ class user extends tablelike implements selectable_items {
|
||||
return $this->structure->get_element_icon($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the action menu HTML for the grade item.
|
||||
*
|
||||
* @param grade_item $item
|
||||
* @return mixed
|
||||
*/
|
||||
private function get_item_action_menu(grade_item $item) {
|
||||
global $OUTPUT;
|
||||
|
||||
$menuitems = [];
|
||||
$url = new moodle_url($this->format_link('grade', $item->id));
|
||||
$title = get_string('showallgrades', 'core_grades');
|
||||
$menuitems[] = new \action_menu_link_secondary($url, null, $title);
|
||||
$menu = new \action_menu($menuitems);
|
||||
$icon = $OUTPUT->pix_icon('i/moremenu', get_string('actions'));
|
||||
$menu->set_menu_trigger($icon);
|
||||
$menu->set_menu_left();
|
||||
|
||||
return $OUTPUT->render($menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get the category for an item.
|
||||
*
|
||||
|
1
grade/report/singleview/lang/en/deprecated.txt
Normal file
1
grade/report/singleview/lang/en/deprecated.txt
Normal file
@ -0,0 +1 @@
|
||||
filtergrades,gradereport_singleview
|
@ -40,7 +40,6 @@ $string['excludefor'] = 'Exclude for {$a}';
|
||||
$string['excludenone'] = 'Do not exclude any grades';
|
||||
$string['eventgradereportviewed'] = 'Grade single view report viewed.';
|
||||
$string['feedbackfor'] = 'Feedback for {$a}';
|
||||
$string['filtergrades'] = 'Show grades for {$a}.';
|
||||
$string['gradefor'] = 'Grade for {$a}';
|
||||
$string['gradeitem'] = 'Grade item: {$a}';
|
||||
$string['gradeuser'] = 'Grade user: {$a}';
|
||||
@ -74,3 +73,6 @@ $string['selectgradeinstructions'] = 'Select items to grade...';
|
||||
$string['selectgradeitemlink'] = 'Click to select a grade item';
|
||||
$string['whattoview'] = 'What would you like to view';
|
||||
$string['whattoviewselect'] = 'Select to view by users or grade items';
|
||||
|
||||
// Deprecated since Moodle 4.1.
|
||||
$string['filtergrades'] = 'Show grades for {$a}.';
|
||||
|
@ -774,6 +774,7 @@ $string['rangedecimals'] = 'Range decimal places';
|
||||
$string['rangedecimals_help'] = 'The number of decimal places to display for the range.';
|
||||
$string['showactivityicons'] = 'Show activity icons';
|
||||
$string['showactivityicons_help'] = 'If enabled, activity icons are shown next to activity names.';
|
||||
$string['showallgrades'] = 'Show all grades';
|
||||
$string['showallhidden'] = 'Show hidden';
|
||||
$string['showallstudents'] = 'Show all Students';
|
||||
$string['showaverages'] = 'Show column averages';
|
||||
|
Loading…
x
Reference in New Issue
Block a user