1
by budgester at budgester
Initial import of IRM codebase |
1 |
IRM Modular Reports System |
2 |
||
3 |
As of 0.9c.1 IRM featured a modular reports system. This allows third-parties |
|
4 |
to develop report modules that work regardless of the version of IRM (almost). |
|
5 |
Reports are scripts which probe the database and generate interesting |
|
6 |
statistics, outputting in HTML and graphics (GIF,PNG). A small demo |
|
7 |
report was included with IRM, default.php3. It contains some useful |
|
8 |
starting code for making your own reports. |
|
9 |
This document mainly talks about how to create and install your report. |
|
10 |
||
11 |
1. Creating the Report Module |
|
12 |
----------------------------- |
|
13 |
||
14 |
This is mainly up to you. You can build it however you please, but |
|
15 |
using some IRM functions may make your life easier. First off, include |
|
16 |
irm.inc and reports.inc.php3. Second, use 'connectDB();' to establish |
|
17 |
a connection to the database. There is no need to use commonHeader("diz"); |
|
18 |
and commonFooter(); in your report, make your own (printer friendly :)) |
|
19 |
layout. Those functions would just produce a screwy menubar which doesn't |
|
20 |
work.
|
|
21 |
||
22 |
Also, don't be fooled by default.php3, you can make your report modules |
|
23 |
spread over several scripts. This is needed for making graphs on the |
|
24 |
fly.
|
|
25 |
||
26 |
2. Installing Your Report Module |
|
27 |
-------------------------------- |
|
28 |
||
29 |
This is incredibly simple. Open up the file reports.inc.php3 in your |
|
30 |
favorite text editor, and add a simple two lines (or just make a script |
|
31 |
so end users can run that). You have to add two lines to correctly |
|
32 |
install the module, these are the 'file' line and the 'name' line. |
|
33 |
||
34 |
First, add a 'name' line. |
|
35 |
||
36 |
$report_list["<name of your report>"]["name"] = "<name of your report>"; |
|
37 |
||
38 |
Replacing the stuff in the <> markers. Note the ; mark, and avoid quotes |
|
39 |
in your name.
|
|
40 |
||
41 |
Next, add a 'file' line.
|
|
42 |
||
43 |
$report_list["<name of your report>"]["file"] = "reports/<filename>.php"; |
|
44 |
||
45 |
Replacing filename with the appropiate filename. Keep the module name to |
|
46 |
.php3, keeping uniformity in extensions. Also note that the file is in 'reports' |
|
47 |
(in /users). Please try keeping your modules here, so it keeps the directory |
|
48 |
layout cleaner and allows for easier upgrades. |
|
49 |
||
50 |
That should be it! |
|
51 |
||
52 |
Yann
|