mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-79045 grade: Don't enclose grade user_heading in $OUTPUT->heading()
Do not enclose \core_grades_renderer::user_heading() in $OUTPUT->heading() and enclose the user's name in the user heading in <h2> tags instead. - Having <div> inside <h2> results in errors in HTML validation. - Enclosing the whole user heading in <h2> results in the other elements in the user heading (Message, Add to contacts) to be announced to screen readers which can result in confusion.
This commit is contained in:
parent
9bfcd77d51
commit
e3633dc719
@ -889,7 +889,7 @@ class grade_plugin_info {
|
|||||||
function print_grade_page_head(int $courseid, string $active_type, ?string $active_plugin = null, string|bool $heading = false,
|
function print_grade_page_head(int $courseid, string $active_type, ?string $active_plugin = null, string|bool $heading = false,
|
||||||
bool $return = false, $buttons = false, bool $shownavigation = true, ?string $headerhelpidentifier = null,
|
bool $return = false, $buttons = false, bool $shownavigation = true, ?string $headerhelpidentifier = null,
|
||||||
?string $headerhelpcomponent = null, ?stdClass $user = null, ?action_bar $actionbar = null, $unused = null) {
|
?string $headerhelpcomponent = null, ?stdClass $user = null, ?action_bar $actionbar = null, $unused = null) {
|
||||||
global $CFG, $OUTPUT, $PAGE;
|
global $CFG, $OUTPUT, $PAGE, $USER;
|
||||||
|
|
||||||
if ($unused !== null) {
|
if ($unused !== null) {
|
||||||
debugging('Deprecated argument passed to ' . __FUNCTION__, DEBUG_DEVELOPER);
|
debugging('Deprecated argument passed to ' . __FUNCTION__, DEBUG_DEVELOPER);
|
||||||
@ -960,7 +960,10 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti
|
|||||||
$output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
|
$output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
|
||||||
} else if (isset($user)) {
|
} else if (isset($user)) {
|
||||||
$renderer = $PAGE->get_renderer('core_grades');
|
$renderer = $PAGE->get_renderer('core_grades');
|
||||||
$output = $OUTPUT->heading($renderer->user_heading($user, $courseid));
|
// If the user is viewing their own grade report, no need to show the "Message"
|
||||||
|
// and "Add to contact" buttons in the user heading.
|
||||||
|
$showuserbuttons = $user->id != $USER->id;
|
||||||
|
$output = $renderer->user_heading($user, $courseid, $showuserbuttons);
|
||||||
} else if (!empty($heading)) {
|
} else if (!empty($heading)) {
|
||||||
$output = $OUTPUT->heading($heading);
|
$output = $OUTPUT->heading($heading);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ if (has_capability('moodle/grade:viewall', $context)) {
|
|||||||
$report = new gradereport_user\report\user($courseid, $gpr, $context, $user->id, $viewasuser);
|
$report = new gradereport_user\report\user($courseid, $gpr, $context, $user->id, $viewasuser);
|
||||||
$userheading = $gradesrenderer->user_heading($report->user, $courseid, false);
|
$userheading = $gradesrenderer->user_heading($report->user, $courseid, false);
|
||||||
|
|
||||||
echo $OUTPUT->heading($userheading);
|
echo $userheading;
|
||||||
|
|
||||||
if ($report->fill_table()) {
|
if ($report->fill_table()) {
|
||||||
echo $report->print_table(true);
|
echo $report->print_table(true);
|
||||||
@ -178,9 +178,7 @@ if (has_capability('moodle/grade:viewall', $context)) {
|
|||||||
$report = new gradereport_user\report\user($courseid, $gpr, $context, $userid, $viewasuser);
|
$report = new gradereport_user\report\user($courseid, $gpr, $context, $userid, $viewasuser);
|
||||||
$actionbar = new \gradereport_user\output\action_bar($context, $userview, $report->user->id, $currentgroup);
|
$actionbar = new \gradereport_user\output\action_bar($context, $userview, $report->user->id, $currentgroup);
|
||||||
|
|
||||||
print_grade_page_head($courseid, 'report', 'user',
|
print_grade_page_head($courseid, 'report', 'user', false, false, false, true, null, null, $report->user, $actionbar);
|
||||||
$gradesrenderer->user_heading($report->user, $courseid),
|
|
||||||
false, false, true, null, null, null, $actionbar);
|
|
||||||
|
|
||||||
if ($currentgroup && !groups_is_member($currentgroup, $userid)) {
|
if ($currentgroup && !groups_is_member($currentgroup, $userid)) {
|
||||||
echo $OUTPUT->notification(get_string('groupusernotmember', 'error'));
|
echo $OUTPUT->notification(get_string('groupusernotmember', 'error'));
|
||||||
@ -198,12 +196,9 @@ if (has_capability('moodle/grade:viewall', $context)) {
|
|||||||
// Students will see just their own report.
|
// Students will see just their own report.
|
||||||
// Create a report instance.
|
// Create a report instance.
|
||||||
$report = new gradereport_user\report\user($courseid, $gpr, $context, $userid ?? $USER->id);
|
$report = new gradereport_user\report\user($courseid, $gpr, $context, $userid ?? $USER->id);
|
||||||
$userheading = $gradesrenderer->user_heading($report->user, $courseid, false);
|
|
||||||
|
|
||||||
// Print the page.
|
// Print the page.
|
||||||
print_grade_page_head($courseid, 'report', 'user');
|
print_grade_page_head($courseid, 'report', 'user', false, false, false, true, null, null, $report->user);
|
||||||
|
|
||||||
echo $OUTPUT->heading($userheading);
|
|
||||||
|
|
||||||
if ($report->fill_table()) {
|
if ($report->fill_table()) {
|
||||||
echo $report->print_table(true);
|
echo $report->print_table(true);
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
{{{image}}}
|
{{{image}}}
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex ml-2">
|
<div class="d-flex ml-2">
|
||||||
<a class="h4 m-0" href="{{userprofileurl}}">{{name}}</a>
|
<h2><a class="h4 m-0" href="{{userprofileurl}}">{{name}}</a></h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-inline-flex ml-4">
|
<div class="d-inline-flex ml-4">
|
||||||
{{#buttons}}
|
{{#buttons}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user