global $COURSE, $DB, $OUTPUT;
$context = get_context_instance( CONTEXT_COURSE, $COURSE->id );
$query = 'select u.id as id, firstname, lastname, picture, imagealt, email from mdl_role_assignments as a, mdl_user as u where contextid=' . $context->id . ' and roleid=5 and a.userid=u.id;';
$rs = $DB->get_recordset_sql( $query );
foreach( $rs as $r ) {
echo $OUTPUT->user_picture($r, array('size' => 50, 'courseid'=>$COURSE->id));
echo $r->firstname . ' ' . $r->lastname . '<br>';
}
沒有留言:
張貼留言