From: moodler Date: Mon, 14 Aug 2006 08:14:02 +0000 (+0000) Subject: Function to get roles used in a context X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e4dd3222559fcfc5fd2ab40e98010984c4eec81c;p=moodle.git Function to get roles used in a context --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 8fc7c59f6e..16e246eb9a 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1577,4 +1577,17 @@ function get_component_string($component, $contextlevel) { } -?> \ No newline at end of file +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'); +} + + +?>