Using basicReportinc » History » Version 1
Amber Herold, 04/25/2011 03:07 PM
1 | 1 | Amber Herold | h1. Using basicReport.inc |
---|---|---|---|
2 | |||
3 | basicReport.inc is a class that can be used to quickly display run information as well as parameters and results. It creates html tables by reading database tables. |
||
4 | The only input it needs is the expId, jobtype and a database table name. |
||
5 | |||
6 | Here is a sample file using the class to display information from a single run: |
||
7 | <pre> |
||
8 | <?php |
||
9 | |||
10 | require_once "inc/particledata.inc"; |
||
11 | require_once "inc/viewer.inc"; |
||
12 | require_once "inc/processing.inc"; |
||
13 | require_once "inc/leginon.inc"; |
||
14 | require_once "inc/project.inc"; |
||
15 | require_once "inc/summarytables.inc"; |
||
16 | |||
17 | |||
18 | require_once "inc/basicreport.inc"; |
||
19 | |||
20 | $expId = $_GET['expId']; |
||
21 | $runId = $_GET['rId']; |
||
22 | |||
23 | try { |
||
24 | // Create an instance of the BasicReport class and set the test suite database table names |
||
25 | $testSuiteReport = new BasicReport( $expId, "makestack2", "ApStackRunData"); |
||
26 | |||
27 | // Get the run data for the specific test run we are reporting on |
||
28 | $runData =$testSuiteReport->getRunData($runId); |
||
29 | |||
30 | // The jobReportLink provides a link to another page for further information. |
||
31 | // If there is no more data to display, this should link back to the current page. |
||
32 | // If the 3rd param to displaySummaryTable() is True, sub tables will be parsed and displayed. |
||
33 | $jobReportLink = 'testsuiterunreport.php?expId='.$expId.'&rId='.$runData['DEF_id']; |
||
34 | $summaryTable = $testSuiteReport->displaySummaryTable($runData, $jobReportLink, True); |
||
35 | |||
36 | } catch (Exception $e) { |
||
37 | $message = $e->getMessage(); |
||
38 | $summaryTable = "<font color='#cc3333' size='+2'>Error creating report page: $message </font>\n"; |
||
39 | } |
||
40 | |||
41 | // Display the standard Appion interface header |
||
42 | processing_header("MakeStack Run Report","MakeStack Run Report for $runData[stackRunName]"); |
||
43 | |||
44 | // Display the table built by the BasicReport class or errors |
||
45 | echo $summaryTable; |
||
46 | |||
47 | // Display the standard Appion interface footer |
||
48 | processing_footer(); |
||
49 | |||
50 | ?> |
||
51 | </pre> |