Hi,
I'm trying to develop a plugin and I need to get the student's grades for the activities.
I implemented the following code and it works as expected, but the problem happens when I logout then login again and try accessing the course containing the block plugin. I get this error " Exception - Call to undefined function grade_get_grades()"
$gradinginfo = grade_get_grades($courseid, 'mod', $activity['modulename'], $activity['instance'], $userid);
if (isset($gradinginfo->items[0]->grades[$userid]) &&
!$gradinginfo->items[0]->grades[$userid]->hidden ) {
$grade = $gradinginfo->items[0]->grades[$userid]->str_grade;
$cellcontent .=HTML_WRITER::tag('div',$grade, array('class'=> 'hi2'));
echo $grade ;
} else {
$grade = '-';
$cellcontent .=HTML_WRITER::tag('div',$grade, array('class'=> 'hi2'));
echo $grade ;
}
This is my first time developing with moodle and i don't know what I'm missing here, so any help would be so much appretiated.