Class mr_report_abstract

Description

MR Report Abstract

Located in /report/abstract.php (line 69)

mr_readonly
   |
   --mr_report_abstract
Variable Summary
Method Summary
mr_report_abstract __construct ( $url, [int $courseid = NULL], [boolean $autorun = true])
int count_records ([array $filter = array()])
string export (string $exporter, [string $filename = NULL])
void filter_definition_hook ( &$mform, MoodleQuickForm $mform)
void filter_init ()
array filter_sql ()
string get_component ()
array get_count_sql (string $filtersql, array $filterparams)
mixed get_description ()
moodle_recordset get_recordset ([array $filter = array()], [string $sort = ''], [string $limitfrom = ''], [string $limitnum = ''])
array get_sql (string $fields, string $filtersql, array $filterparams)
void init ()
boolean is_exporting ()
string name ()
string output_wrapper (string $tablehtml)
void run ()
mixed save_cell (object $row, string $column, string $value)
void table_fill ()
void table_fill_row (mixed $row)
void table_init ()
string type ()
void _init ()
string __toString ()
Variables
mr_var $config (line 103)

Config Model

  • access: protected
int $courseid (line 117)

Course ID

  • access: protected
array $executedsql = array() (line 131)

SQL executed by this report

  • access: protected
mr_file_export $export (line 124)

Export plugin

  • access: protected
mr_html_filter $filter (line 89)

Filter model

  • access: protected
mr_html_paging $paging (line 82)

Paging model

  • access: protected
mr_preferences $preferences (line 96)

User preferences

  • access: protected
mr_html_table $table (line 75)

Table model

  • access: protected
moodle_url $url (line 110)

Base URL

  • access: protected
Methods
Constructor __construct (line 141)

Construct

  • access: public
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_records (line 463)

Count the total number of records that are included in the report

  • access: public
int count_records ([array $filter = array()])
  • array $filter: Filter SQL and params
export (line 355)

Export report

Example Code:

  1.  <?php
  2.       $report new some_report_class(...);
  3.       $file   $report->export('text/csv');
  4.  
  5.       // Do something with $file, then to delete it...
  6.       $report->get_export()->cleanup();
  7.  ?>

  • return: The file path
  • access: public
string export (string $exporter, [string $filename = NULL])
  • string $exporter: The exporter to use, like 'text/csv'
  • string $filename: Override the file name
filter_definition_hook (line 520)

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.

  • access: public
void filter_definition_hook ( &$mform, MoodleQuickForm $mform)
  • MoodleQuickForm $mform
  • MoodleQuickForm &$mform
filter_init (line 221)

Filter setup - override to add a filter

  • access: public
void filter_init ()
filter_sql (line 378)

Generate SQL from filter

  • access: public
array filter_sql ()
get_component (line 285)

Passed to get_string calls.

  • abstract:
  • access: public
string get_component ()
get_count_sql (line 493)

Get the SQL to count to the total report rows

  • return: Must return array(SQL, parameters)
  • access: public
array get_count_sql (string $filtersql, array $filterparams)
  • string $filtersql: The filter SQL
  • array $filterparams: The filter parameters
get_description (line 272)

Get report description text

  • access: public
mixed get_description ()
get_recordset (line 439)

Get the recordset to the data for the report

  • access: public
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_sql (line 484)

Get the SQL to generate the report rows

  • return: Must return array(SQL, parameters)
  • abstract:
  • access: public
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
init (line 213)

Set report specific configs

  • access: public
void init ()
is_exporting (line 330)

Determine if the report is currently exporting

This method must be called after _init() because the export is setup during _init().

  • access: public
boolean is_exporting ()
name (line 292)

Return a human readable name of the plugin

  • access: public
string name ()
output_wrapper (line 506)

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.

  • access: public
string output_wrapper (string $tablehtml)
  • string $tablehtml: The rendered table HTML
run (line 242)

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.

  • access: public
void run ()
save_cell (line 318)

YUI inline cell editing - this gets called to save the edited data.

Also perform any additional capability checks in this method!

  • return: Return false on error, return value saved to DB on success, or return a JSON object (see editcell_action in default controller)
  • todo: What to do with this...
  • access: public
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!
table_fill (line 390)

Fill table with data

  • access: public
void table_fill ()
table_fill_row (line 426)

Add a row to the table

  • access: public
void table_fill_row (mixed $row)
  • mixed $row: The row to add
table_init (line 232)

Table setup

Override and set $this->table to an instance of mr_html_table.

  • abstract:
  • access: public
void table_init ()
type (line 301)

Returns the plugin's name based on class name

  • access: public
string type ()
_init (line 187)

Run init routines

  • access: protected
void _init ()
__toString (line 175)

Convert this report into a simple string

  • access: public
string __toString ()

Inherited Methods

Inherited From mr_readonly

mr_readonly::__call()

Documentation generated on Thu, 28 Jun 2012 16:33:45 -0700 by phpDocumentor 1.4.3