Detecting blank user reports

Detecting blank user reports

by Mike Worth -
Number of replies: 1
I have created a couple of pages for personal tutors to use to get an overview of their tutees progress, this includes one that displays a user report for each of their classes and courses (our classes are moodle courses and our courses are moodle metacourses). The problem is that there a quite a few blank reports being presented (for example EC clube have been given courses but will not be marking any work). Is there a way to detect empty gradebook reports such that they can be not displayed.

What I've got at the moment is:

require_once $CFG->libdir.'/gradelib.php';
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->dirroot.'/grade/report/'.$CFG->grade_profilereport.'/lib.php';



if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
foreach ($mycourses as $mycourse) {

$course = get_record('course', 'id', $mycourse->id);
$functionname = 'grade_report_'.$CFG->grade_profilereport.'_profilereport';
if (function_exists($functionname)) {
$functionname($course, $user);
}

}
}


Thanks,
Mike