Ad-hoc database queries
Maintained by
Tim Hunt, Mahmoud Kassaei, Hieu Vu Van
This report plugin allows Administrators to set up arbitrary database queries
to act as ad-hoc reports. Reports can be of two types, either run on demand,
or scheduled to run automatically. Other users with the right capability can
go in and see a list of queries that they have access to. Results can be viewed
on-screen or downloaded as CSV.
Comments
Comments are no longer open for new posts. Existing comments remain available to read.
firstly thanks for such a great plugin - really makes life a lot easier for us!
Our site is fully hosted with https (due to reasons beyond my control) and this means that with IE, the download functionality doesn't work (see MS KB812935 and KB316431 for more info)
I've found that amending the code in download.php from
header('Content-Disposition: attachment; filename="report.csv"');
header('Content-Type: text/csv; charset=UTF-8');
readfile($csvfilename);
to
header('Content-Disposition: attachment; filename="report.csv"');
header('Content-Type: text/csv; charset=UTF-8');
/// Print header to force download to fix https issue
if (strpos($CFG->wwwroot, 'https://') === 0) { //https sites - watch out for IE! KB812935 and KB316431
header('Cache-Control: max-age=10');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
header('Pragma: ');
} else { //normal http - prevent caching at all cost
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
header('Pragma: no-cache');
}
// End of https fix
readfile($csvfilename);
fixes the issue here.
I was testing this report and it still works nicely in 2.4+. I noted that some of the given examples don't work when there is a ? (question mark) or : (colon) in strings within the query. Substituting CHAR(63) and CHAR(58) respectively allowed the characters through. It would be good if the report plugin could be updated to work around these characters or if the examples could be updated to include the CHAR() substitutions.
Nora: As this is a Report plugin, it is installed by copying into the /report directory within your Moodle installation.
Can you help? Thanks.