From: moodler Date: Sat, 23 Sep 2006 12:46:53 +0000 (+0000) Subject: When getting lists of roles, put role names through format_string X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=65b0c132edd1692b57f288d9331f09c00781e0cd;p=moodle.git When getting lists of roles, put role names through format_string (ie for multilang filter) --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 0d5932a497..a459e1aa4d 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2476,7 +2476,7 @@ function get_assignable_roles ($context) { if ($roles = get_records('role', '', '', 'sortorder ASC')) { foreach ($roles as $role) { if (user_can_assign($context, $role->id)) { - $options[$role->id] = $role->name; + $options[$role->id] = strip_tags(format_string($role->name, true)); } } } @@ -2495,7 +2495,7 @@ function get_overridable_roles ($context) { if ($roles = get_records('role', '', '', 'sortorder ASC')) { foreach ($roles as $role) { if (user_can_override($context, $role->id)) { - $options[$role->id] = $role->name; + $options[$role->id] = strip_tags(format_string($role->name, true)); } } } @@ -2798,4 +2798,4 @@ function get_users_from_role_on_context($role, $context) { AND roleid = $role->id"); } -?> \ No newline at end of file +?> diff --git a/lib/weblib.php b/lib/weblib.php index 633d1ef7ef..3e2cbb7423 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1424,7 +1424,7 @@ function text_format_name( $key ) { */ function format_string ($string, $striplinks = false, $courseid=NULL ) { - global $CFG, $course; + global $CFG, $COURSE; //We'll use a in-memory cache here to speed up repeated strings static $strcache; @@ -1438,8 +1438,8 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) { } if (empty($courseid)) { - if (!empty($course->id)) { // An ugly hack for better compatibility - $courseid = $course->id; // (copied from format_text) + if (!empty($COURSE->id)) { // An ugly hack for better compatibility + $courseid = $COURSE->id; // (copied from format_text) } }