Note:

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

reportbuilder/Setting Default Columns and Filters: Difference between revisions

From MoodleDocs
(Created page with "Back to Index Once a report has a large number of column and filter options it can be useful to define a set of default options. These columns and filters will...")
 
(Note about plan not to migrate this page to the new developer resources. See template for more info.)
 
Line 1: Line 1:
{{Template:WillNotMigrate}}
[[reportbuilder|Back to Index]]
[[reportbuilder|Back to Index]]



Latest revision as of 14:06, 24 June 2022


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.


Back to Index

Once a report has a large number of column and filter options it can be useful to define a set of default options. These columns and filters will be automatically added to any new report that is based on this source. This gives the user a headstart by generating a 'typical' report which they can further customise. To add default column options, add a new property to the class called defaultcolumns:

$this->defaultcolumns = array(
    array(
        'type' => 'course',
        'value' => 'fullname',
    )
 );

The 'type' and 'value' must match an existing column option.

To add default filters use a similar syntax:

$this->defaultfilters = array(
    array(
        'type' => 'course',
        'value' => 'fullname',
        'advanced' => 0
    )
);

The 'type' and 'value' elements match the column the filter is applied against. The 'advanced' option is described in the advanced filter options section.