Integrated one single report

Integrated one single report

by Mohd Ehtesham -
Number of replies: 1
Can any one body tell me how we can have one single integrated report with all the activities along with the grades achieved by the users in moodle.
I am looking to enable this feature desperately.
Any help can be appreciated a lot, I am planning to write a stored procedure for this if it is not possible through the GUI.

Thanks and Regards,
In reply to Mohd Ehtesham

Re: Integrated one single report

by Larry Mahony -
Looking to do something similar here, where the results of all grades in all courses can be viewed from one page (at the root level) without having to go into each individual course.

I've seen various options, including an "allmygrades" hack in the downloads section and the new gradebook features in Moodle 9 but none of them really do enough.

It would seem from looking at the existing grades code that this can be done, you get all courses for that student > Loop through each course > For each course get all the gradable items > for each gradable item get the actual grade ...

Does this make sense to anyone ?

$courses = get_my_courses($USER->id);

foreach ($courses as $course) {
// get the grade items for this course
$gradeitems = grade_get_grade_items($course->id);
 
if ($gradeitems) {
foreach ($gradeitems as $gi) {
if ($gi->hidden != 1 && $gi->visible == 1) {
// get the lib file for the module that this grade item refers to
$libfile = $CFG->dirroot . "/mod/" . $gi->modname . "/lib.php";
if (file_exists($libfile)) {
require_once($libfile);
// get the function in the lib that returns the grades
$gradefunction = $gi->modname . "_grades";
// this function returns an array of grades(indexed by user id) and a max grade
$modgrades = $gradefunction($gi->cminstance);
// get the specific name of this mod item
$giname = get_field_select($gi->modname,"name","id=$gi->cminstance");
// get the grade indexed by this user and calculate it as a percentage
$percentage = round(($modgrades->grades[$USER->id] / $modgrades->maxgrade) * 100);
 

echo "<td>" . $gi->modname . "</td><td>" . $giname . "</td><td>" . $percentage . "</td>";
 
}
}
}
}