'Render this widget as HTML helper object(s)
@param resource: the resource
@param values: the search values from the URL query'

def widget(self, resource, values):

    attr = self._attr(resource)
    opts_get = self.opts.get
    name = attr['_name']
    (ftype, options, noopt) = self._options(resource, values=values)
    if (options is None):
        options = []
        hide_widget = True
        hide_noopt = ''
    else:
        options = OrderedDict(options)
        hide_widget = False
        hide_noopt = '    hide'
    if ((len(options) > 1) and (ftype[:4] == 'list')):
        operator = opts_get('operator', None)
        if operator:
            self.operator = operator
            any_all = ''
        else:
            operator = self.operator
            any_all = True
        if (operator == 'anyof'):
            filter_type = 'any'
        else:
            filter_type = 'all'
            if (operator == 'belongs'):
                operator = 'contains'
        if any_all:
            T = current.T
            any_all = DIV(T('Filter    type'), INPUT(_name=('%s_filter' % name), _id=('%s_filter_any' % name), _type='radio', _value='any', value=filter_type), LABEL(T('Any'), _for=('%s_filter_any' % name)), INPUT(_name=('%s_filter' % name), _id=('%s_filter_all' % name), _type='radio', _value='all', value=filter_type), LABEL(T('All'), _for=('%s_filter_all' % name)), _class='s3-options-filter-anyall')
    else:
        any_all = ''
    cols = opts_get('cols', None)
    if cols:
        widget_class = 'groupedopts-filter-widget'
        w = S3GroupedOptionsWidget(options=options, multiple=opts_get('multiple', True), cols=cols, size=opts_get('size', 12), help_field=opts_get('help_field'), sort=opts_get('sort', True), orientation=opts_get('orientation'), table=opts_get('table', True))
    else:
        widget_class = 'multiselect-filter-widget'
        w = S3MultiSelectWidget(filter=opts_get('filter', 'auto'), header=opts_get('header', False), selectedList=opts_get('selectedList', 3), noneSelectedText=opts_get('noneSelectedText', 'Select'), multiple=opts_get('multiple', True))
    classes = (attr.get('_class', '').split() + [widget_class, self._class])
    if hide_widget:
        classes.append('hide')
    attr['_class'] = ('    '.join(set(classes)) if classes else None)
    dummy_field = Storage(name=name, type=ftype, requires=IS_IN_SET(options, multiple=True))
    widget = w(dummy_field, values, **attr)
    return TAG[''](any_all, widget, SPAN(noopt, _class=('no-options-available%s' % hide_noopt)))
