Command disabled: revisions
Trace: • report_sources
Report Sources
Documentation:
Please note that the moodle.org documentation is neither complete nor entirely up to date, since it is about a project meant to port the Totara report builder to Moodle.
Required Columns
Required columns are not like default columns. There's an asymmetry here, because the defaultcolumns are defined by just listing the existing columns in the defaultcolumns array. For the required columns, you have to actually define them in the context of a requiredcolumns array.
/** * Defines the columns that a report must have if it is created from this source * * @return array An array of required columns. */ protected function define_requiredcolumns() { $requiredcolumns = array( new rb_column( 'learning_points', 'points_spent', get_string('points_spent', 'rb_source_learning_points'), 'points_spent.total', array( 'joins' => 'points_spent', 'hidden' => 1 ) ) ); return $requiredcolumns; } // function define_requiredcolumns
Things to pay attention to when using required columns:
- Use rb_column class (instead of rb_column_option)
- Don’t define the column elsewhere
- Use the hidden option if you don’t want the column to show up in the report (but you still need the data)
- It looks as though you can’t define filters for required columns… (I haven’t found out how, at least). If you use the standard way of defining filters, Totara will complain that it can’t find the “column option” - no wonder, it’s not an option, it’s required.
You are here: start » totara » report_sources