Function to get roles used in a context

This commit is contained in:
moodler
2006-08-14 08:14:02 +00:00
parent 9fecfdfb83
commit e4dd322255
+14 -1
View File
@@ -1577,4 +1577,17 @@ function get_component_string($component, $contextlevel) {
}
?>
function get_roles_used_in_context($context) {
global $CFG;
return get_records_sql('SELECT distinct r.id, r.name
FROM '.$CFG->prefix.'role_assignments ra,
'.$CFG->prefix.'role r
WHERE r.id = ra.roleid
AND ra.contextid = '.$context->id.'
ORDER BY r.sortorder ASC');
}
?>