set_url('/blocks/gradelevel/view-results.php', array('courseid' => $courseid));
$PAGE->set_pagelayout('standard');
$PAGE->requires->js_call_amd('block_gradelevel/renderbadge', 'init');
print $OUTPUT->header();
print $OUTPUT->heading(get_string('results_heading', 'block_gradelevel') . " " . $skill->getName());
print "
".get_string('course', 'core')." " . $COURSE->fullname."
";
//retrieve groups
$course_groups = groups_get_all_groups($COURSE->id);
// retrieve users
$remaining_users = get_enrolled_users($coursecontext);
print "";
if(count($course_groups > 0))
{
// loop through all groups first
foreach($course_groups as $grp)
{
// Get members
$members = get_enrolled_users($coursecontext,'mod/assignment:submit',$grp->id);
$count_members = count($members);
// show group name
print $OUTPUT->heading($grp->name." ({$count_members})",4,array('groupname'));
// Sort on last name
usort( $members, function( $a, $b) {
return ( $a->lastname < $b->lastname ) ? -1 : 1;
} );
print "
";
}
$count_members = count($remaining_users);
print $OUTPUT->heading(get_string('results_ungrouped','block_gradelevel')." ({$count_members})" ,4,array('groupname'));
}
usort( $remaining_users, function( $a, $b) {
return ( $a->lastname < $b->lastname ) ? -1 : 1;
} );
print "
";
print "
";
print $OUTPUT->footer();