MDL-25561 grade: made the student names clickable on the user report

This commit is contained in:
Andrew Davis 2011-12-12 15:57:04 +08:00
parent f89a83b87b
commit 5625d33d17
2 changed files with 14 additions and 3 deletions

View File

@ -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 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 <body> tag * @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page * @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 * @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) { 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 .= 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) { if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return); $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
} }

View File

@ -109,7 +109,9 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
while ($userdata = $gui->next_user()) { while ($userdata = $gui->next_user()) {
$user = $userdata->user; $user = $userdata->user;
$report = new grade_report_user($courseid, $gpr, $context, $user->id); $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()) { if ($report->fill_table()) {
echo '<br />'.$report->print_table(true); echo '<br />'.$report->print_table(true);
@ -119,7 +121,9 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
$gui->close(); $gui->close();
} else { // Only show one user's report } else { // Only show one user's report
$report = new grade_report_user($courseid, $gpr, $context, $userid); $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))); groups_print_course_menu($course, $gpr->get_return_url('index.php?id='.$courseid, array('userid'=>0)));
if ($user_selector) { if ($user_selector) {