Construct
mr_report_abstract
__construct
( $url, [int $courseid = NULL], [boolean $autorun = true])
-
moodle_url
$url: Base URL
-
int
$courseid: Course ID
-
boolean
$autorun: Automatically run the report SQL and retrieve rows for rendering or exporting
Count the total number of records that are included in the report
int
count_records
([array $filter = array()])
-
array
$filter: Filter SQL and params
Export report
Example Code:
<?php
$report = new some_report_class(...);
$file =
$report->export('text/csv');
// Do something with $file, then to delete it...
$report->get_export()->cleanup();
?>
string
export
(string $exporter, [string $filename = NULL])
-
string
$exporter: The exporter to use, like 'text/csv'
-
string
$filename: Override the file name
A hook into the filter's form definition, called after all filters have been added.
This is handy for form customizations, etc. For major filter form customizations, define your own filter form class and pass the path to your new form to the mr_html_form constructor.
void
filter_definition_hook
( &$mform, MoodleQuickForm $mform)
-
MoodleQuickForm
$mform
-
MoodleQuickForm
&$mform
Filter setup - override to add a filter
void
filter_init
()
Generate SQL from filter
array
filter_sql
()
Passed to get_string calls.
string
get_component
()
Get the SQL to count to the total report rows
array
get_count_sql
(string $filtersql, array $filterparams)
-
string
$filtersql: The filter SQL
-
array
$filterparams: The filter parameters
Get report description text
mixed
get_description
()
Get the recordset to the data for the report
moodle_recordset
get_recordset
([array $filter = array()], [string $sort = ''], [string $limitfrom = ''], [string $limitnum = ''])
-
array
$filter: Filter SQL and params
-
string
$sort: Sort SQL
-
string
$limitfrom: Limit from SQL
-
string
$limitnum: Limit number SQL
Get the SQL to generate the report rows
array
get_sql
(string $fields, string $filtersql, array $filterparams)
-
string
$fields: The fields to select
-
string
$filtersql: The filter SQL
-
array
$filterparams: The filter parameters
Set report specific configs
void
init
()
Determine if the report is currently exporting
This method must be called after _init() because the export is setup during _init().
boolean
is_exporting
()
Return a human readable name of the plugin
string
name
()
A hook into the rendering of the table.
If you need to wrap the table in a form or anything like that, then use this method.
string
output_wrapper
(string $tablehtml)
-
string
$tablehtml: The rendered table HTML
Run the report SQL and retrieve rows for rendering or exporting.
This method also sends the export to the browser if the user is exporting the report.
void
run
()
YUI inline cell editing - this gets called to save the edited data.
Also perform any additional capability checks in this method!
mixed
save_cell
(object $row, string $column, string $value)
-
object
$row: Table row data - THIS MUST BE CLEANED BEFORE USE!
-
string
$column: The column that was edited
-
string
$value: The new column value, THIS MUST BE CLEANED BEFORE SAVING!
Fill table with data
void
table_fill
()
Add a row to the table
void
table_fill_row
(mixed $row)
-
mixed
$row: The row to add
Table setup
Override and set $this->table to an instance of mr_html_table.
void
table_init
()
Returns the plugin's name based on class name
string
type
()
Run init routines
void
_init
()
Convert this report into a simple string
string
__toString
()
Inherited Methods
Inherited From mr_readonly
mr_readonly::__call()