MDL-47585 stats: fixed incorrect user dropdown

This commit is contained in:
Marina Glancy 2014-10-09 14:35:15 +08:00 committed by Sam Hemelryk
parent b5780fbd18
commit 960bb64a2e

View File

@ -111,7 +111,8 @@ function report_stats_report($course, $report, $mode, $user, $roleid, $time) {
list($sort, $moreparams) = users_order_by_sql('u');
$moreparams['courseid'] = $course->id;
$sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.idnumber
$fields = user_picture::fields('u', array('idnumber'));
$sql = "SELECT DISTINCT $fields
FROM {stats_user_{$param->table}} s
JOIN {user} u ON u.id = s.userid
WHERE courseid = :courseid";
@ -128,9 +129,8 @@ function report_stats_report($course, $report, $mode, $user, $roleid, $time) {
if (!$us = $DB->get_records_sql($sql, array_merge($param->params, $moreparams))) {
print_error('nousers');
}
foreach ($us as $u) {
$users[$u->userid] = fullname($u, true);
$users[$u->id] = fullname($u, true);
}
$table->align = array('left','left','left','left','left','left','left','left');