protected function get_role_options($instance, $coursecontext) {
        global $DB;

        $roles = get_assignable_roles($coursecontext);
        $roles[0] = get_string('none');
        $roles = array_reverse($roles, true); // Descending default sortorder.
        if ($instance->id and !isset($roles[$instance->roleid])) {
            if ($role = $DB->get_record('role', array('id' => $instance->roleid))) {
                $roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS, true);
                $roles[$instance->roleid] = role_get_name($role, $coursecontext);
            } else {
                $roles[$instance->roleid] = get_string('error');
            }
        }

        return $roles;
    }
protected function get_role_options($instance, $coursecontext) {
        global $DB;

        $roles = get_assignable_roles($coursecontext);
        $roles[0] = get_string('none');
        $roles = array_reverse($roles, true); // Descending default sortorder.
        if ($instance->id and !isset($roles[$instance->roleid])) {
            if ($role = $DB->get_record('role', array('id' => $instance->roleid))) {
                $roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS, true);
                $roles[$instance->roleid] = role_get_name($role, $coursecontext);
            } else {
                $roles[$instance->roleid] = get_string('error');
            }
        }

        return $roles;
    }
protected function get_role_options ( $ instance , $ coursecontext ) { global $ DB ; $ roles = get_assignable_roles ( $ coursecontext ) ; $ roles [ 0 ] = get_string ( 'none' ) ; $ roles = array_reverse ( $ roles , true ) ; // Descending default sortorder. if ( $ instance -> id and ! isset ( $ roles [ $ instance -> roleid ] ) ) { if ( $ role = $ DB -> get_record ( 'role' , array ( 'id' => $ instance -> roleid ) ) ) { $ roles = role_fix_names ( $ roles , $ coursecontext , ROLENAME_ALIAS , true ) ; $ roles [ $ instance -> roleid ] = role_get_name ( $ role , $ coursecontext ) ; } else { $ roles [ $ instance -> roleid ] = get_string ( 'error' ) ; } } return $ roles ; }
Return an array of valid options for the roles.

@param stdClass $instance
@param context $coursecontext
@return array
Return an array of valid options for the roles .