mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-9137 Changed course names to links to the user reports for each course, and changed grade to rounded percentage.
This commit is contained in:
parent
92df185d85
commit
7d7029f57d
@ -81,10 +81,10 @@ class grade_report_overview extends grade_report {
|
|||||||
if ($courses = get_courses('all', null, 'c.id, c.shortname')) {
|
if ($courses = get_courses('all', null, 'c.id, c.shortname')) {
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
// Get course grade_item
|
// Get course grade_item
|
||||||
$grade_item_id = get_field('grade_items', 'id', 'itemtype', 'course', 'courseid', $course->id);
|
$grade_item = grade_item::fetch(array('itemtype' => 'course', 'courseid' => $course->id));
|
||||||
|
|
||||||
// Get the grade
|
// Get the grade
|
||||||
$finalgrade = get_field('grade_grades', 'finalgrade', 'itemid', $grade_item_id, 'userid', $this->user->id);
|
$finalgrade = get_field('grade_grades', 'finalgrade', 'itemid', $grade_item->id, 'userid', $this->user->id);
|
||||||
|
|
||||||
/// prints rank
|
/// prints rank
|
||||||
if ($finalgrade) {
|
if ($finalgrade) {
|
||||||
@ -92,7 +92,7 @@ class grade_report_overview extends grade_report {
|
|||||||
$sql = "SELECT COUNT(DISTINCT(userid))
|
$sql = "SELECT COUNT(DISTINCT(userid))
|
||||||
FROM {$CFG->prefix}grade_grades
|
FROM {$CFG->prefix}grade_grades
|
||||||
WHERE finalgrade > $finalgrade
|
WHERE finalgrade > $finalgrade
|
||||||
AND itemid = $grade_item_id";
|
AND itemid = $grade_item->id";
|
||||||
$rank = count_records_sql($sql) + 1;
|
$rank = count_records_sql($sql) + 1;
|
||||||
|
|
||||||
$rankdata = "$rank/$numusers";
|
$rankdata = "$rank/$numusers";
|
||||||
@ -101,7 +101,11 @@ class grade_report_overview extends grade_report {
|
|||||||
$rankdata = "-";
|
$rankdata = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->table->add_data(array($course->shortname, $finalgrade, $rankdata));
|
$courselink = '<a href="' . $CFG->wwwroot . '/grade/report/user/index.php?id=' . $course->id . '">' . $course->shortname . '</a>';
|
||||||
|
|
||||||
|
$this->table->add_data(array($courselink,
|
||||||
|
round(grade_to_percentage($finalgrade, $grade_item->grademin, $grade_item->grademax), 1) . '%',
|
||||||
|
$rankdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user