From 5625d33d17c3c5fdc647f92d2777ba05927fd582 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 12 Dec 2011 15:57:04 +0800 Subject: [PATCH] MDL-25561 grade: made the student names clickable on the user report --- grade/lib.php | 9 ++++++++- grade/report/user/index.php | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/grade/lib.php b/grade/lib.php index 593a250a16f..ed655c5eec4 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -626,6 +626,7 @@ class grade_plugin_info { * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function * @param string $bodytags Additional attributes that will be added to the tag * @param string $buttons Additional buttons to display on the page + * @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown? * * @return string HTML code or nothing if $return == false */ @@ -673,7 +674,13 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null, if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) { $returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return); } - $returnval .= $OUTPUT->heading($heading); + + if ($return) { + $returnval .= $OUTPUT->heading($heading); + } else { + echo $OUTPUT->heading($heading); + } + if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) { $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return); } diff --git a/grade/report/user/index.php b/grade/report/user/index.php index 2802c9d59ca..1a8436e7d0f 100644 --- a/grade/report/user/index.php +++ b/grade/report/user/index.php @@ -109,7 +109,9 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all while ($userdata = $gui->next_user()) { $user = $userdata->user; $report = new grade_report_user($courseid, $gpr, $context, $user->id); - echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user'). ' - '.fullname($report->user)); + + $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user)); + echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink); if ($report->fill_table()) { echo '
'.$report->print_table(true); @@ -119,7 +121,9 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all $gui->close(); } else { // Only show one user's report $report = new grade_report_user($courseid, $gpr, $context, $userid); - print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user'). ' - '.fullname($report->user)); + + $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user)); + print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink); groups_print_course_menu($course, $gpr->get_return_url('index.php?id='.$courseid, array('userid'=>0))); if ($user_selector) {