Adding a filter

Here is a simple filter option to add a text-based search field on the course fullname column we created earlier.

$this->filteroptions = array(
    new rb_filter_option(
        'Course Name',

Required options

Every filter option object must include four required arguments:

  • Column type: Must match the type of an existing column option
  • Column value: Must match the value of an existing column option - the filter will act on the column option matched by the type and value
  • Filter name: A string which describes the filter - this appears in the pulldown menu when choosing filters, and also next to the filter in the report
  • Filter type: Defines the behaviour of the filter e.g. text field, pulldown, checkbox etc.

Filter types

The filter types are modular, allowing new filter types to be written. The available filter types are found in local/reportbuilder/filters/.

Some common filter types include:

  • text: Match text entered into a text field
  • select: Choose from a list of predefined options
  • date: Match against a range of dates

Some filter options require additional information to be passed into the filter options, see the advanced filter options for more information.