original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Return an array of valid options for the roles.
  
  @param stdClass $instance
  @param context $coursecontext
  @return array
docstring_tokens: Return an array of valid options for the roles .