Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

reportbuilder/Adding a Filter: Difference between revisions

From MoodleDocs
(Created page with "Back to Index Here is a simple filter option to add a text-based search field on the course fullname column we created earlier. <pre> $this->filteroptions = a...")
 
No edit summary
Line 21: Line 21:
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:
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
* text: Match text entered into a text field
# select: Choose from a list of predefined options
* select: Choose from a list of predefined options
# date: Match against a range of dates
* date: Match against a range of dates


Some filter options require additional information to be passed into the filter options, see the [[reportbuilder/Advanced_Filter_Options|advanced filter options]] and [rb_filter_option documentation] for more information.
Some filter options require additional information to be passed into the filter options, see the [[reportbuilder/Advanced_Filter_Options|advanced filter options]] and [rb_filter_option documentation] for more information.


For details on how filter types are created, see [creating new filter options].
For details on how filter types are created, see [creating new filter options].

Revision as of 08:29, 8 June 2012

Back to Index

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',
        'fullname',
        'Course Name',
        'text'
    )
);

Every filter option object must include 4 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.)

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 and [rb_filter_option documentation] for more information.

For details on how filter types are created, see [creating new filter options].