Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
<?php

class rb_source_example1 extends rb_base_source {
    public $base, $joinlist, $columnoptions, $filteroptions;

    function __construct() {
        $this->base = '{course}';
        $this->joinlist = array();
        $this->columnoptions = array(
            new rb_column_option(
                'course',
                'fullname',
                'Course Fullname',
                'base.fullname'
            )
        );
        $this->filteroptions = array();
        $this->sourcetitle   = "Example1";

        parent::__construct();
    }
}
?>

Creating the report

To create this source save the code above in a file called rb_source_example1.php in the /local/reportbuilder/rb_sources/ directory. The class name must start with 'rb_source_', and the class name and filename must match. You should now be able to generate a report based on this source as follows:

...

You should now be able to see the report by clicking View this report.

Understanding the report

This should give a list of all the courses in your site, including the top-level 'front page' course. If you don't have any courses in your site yet you may want to create a few for test purposes.

...

The columnoptions property contains an array of column option objects. Each column option object defines a column that can be included in a report that uses this source. It is up to the person building the report to decide which columns they actually want to use. See adding a column for more information about this section.

...

The filteroptions property contains an array of filter option objects, which define possible search options for the report. Because this is a very basic source there are no search options yet, although some will be added later.

Code Block
        parent::__construct();

...