/** * Export report * * Example Code: * <code> * <?php * $report = new some_report_class(...); * $file = $report->export('text/csv'); * * // Do something with $file, then to delete it... * $report->get_export()->cleanup(); * ?> * </code> * * @param string $exporter The exporter to use, like 'text/csv' * @param string $filename Override the file name * @return string The file path */ public function export($exporter, $filename = NULL) { // Initialize the table and the filters $this->table_init(); $this->filter_init(); if ($this->filter instanceof mr_html_filter) { $this->filter->set_report($this); } // Set the exporter $this->export->init($exporter, $filename); // Send rows to export $this->table_fill(); // Return the file return $this->export->close(); }