protected function get_role_map(progress_trace $trace) {
        global $DB;

        // Get all roles.
        $rolemap = array();
        $roles = $DB->get_records('role', null, '', 'id, name, shortname');
        foreach ($roles as $id=>$role) {
            $alias = $this->get_config('map_'.$id, $role->shortname, '');
            $alias = trim(core_text::strtolower($alias));
            if ($alias === '') {
                // Either not configured yet or somebody wants to skip these intentionally.
                continue;
            }
            if (isset($rolemap[$alias])) {
                $trace->output("Duplicate role alias $alias detected!");
            } else {
                $rolemap[$alias] = $id;
            }
        }

        return $rolemap;
    }
protected function get_role_map(progress_trace $trace) {
        global $DB;

        // Get all roles.
        $rolemap = array();
        $roles = $DB->get_records('role', null, '', 'id, name, shortname');
        foreach ($roles as $id=>$role) {
            $alias = $this->get_config('map_'.$id, $role->shortname, '');
            $alias = trim(core_text::strtolower($alias));
            if ($alias === '') {
                // Either not configured yet or somebody wants to skip these intentionally.
                continue;
            }
            if (isset($rolemap[$alias])) {
                $trace->output("Duplicate role alias $alias detected!");
            } else {
                $rolemap[$alias] = $id;
            }
        }

        return $rolemap;
    }
protected function get_role_map ( progress_trace $ trace ) { global $ DB ; // Get all roles. $ rolemap = array ( ) ; $ roles = $ DB -> get_records ( 'role' , null , '' , 'id, name, shortname' ) ; foreach ( $ roles as $ id => $ role ) { $ alias = $ this -> get_config ( 'map_' . $ id , $ role -> shortname , '' ) ; $ alias = trim ( core_text :: strtolower ( $ alias ) ) ; if ( $ alias === '' ) { // Either not configured yet or somebody wants to skip these intentionally. continue ; } if ( isset ( $ rolemap [ $ alias ] ) ) { $ trace -> output ( "Duplicate role alias $alias detected!" ) ; } else { $ rolemap [ $ alias ] = $ id ; } } return $ rolemap ; }
Returns a mapping of ims roles to role ids.

@param progress_trace $trace
@return array imsrolename=>roleid
Returns a mapping of ims roles to role ids .