Project

General

Profile

Using basicReportinc » History » Revision 3

Revision 2 (Amber Herold, 04/25/2011 03:09 PM) → Revision 3/8 (Amber Herold, 04/25/2011 03:13 PM)

h1. Using basicReport.inc 

 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. 
 The only input it needs is the expId, jobtype and a database table name. 

 Here is a sample file using the class to display information from a single run: 
 <pre> 
 <?php 

 require_once "inc/particledata.inc"; 
 require_once "inc/viewer.inc"; 
 require_once "inc/processing.inc"; 
 require_once "inc/leginon.inc"; 
 require_once "inc/project.inc"; 
 require_once "inc/summarytables.inc"; 


 require_once "inc/basicreport.inc"; 

 $expId = $_GET['expId']; 
 $runId = $_GET['rId']; 

 try { 
	 // Create an instance of the BasicReport class using the makeStack jobtype and DB table 
	 $testSuiteReport = new BasicReport( $expId, "makestack2", "ApStackRunData"); 
	
	 // Get the run data for the specific test run we are reporting on 
	 $runData =$testSuiteReport->getRunData($runId); 
	
	 // The jobReportLink provides a link to another page for further information.  
	 // If there is no more data to display, this should link back to the current page. 
	 // If the 3rd param to displaySummaryTable() is True, sub tables will be parsed and displayed. 
	 $jobReportLink = 'testsuiterunreport.php?expId='.$expId.'&rId='.$runData['DEF_id']; 
	 $summaryTable =    $testSuiteReport->displaySummaryTable($runData, $jobReportLink, True); 
	
 } catch (Exception $e) { 
     $message = $e->getMessage(); 
     $summaryTable = "<font color='#cc3333' size='+2'>Error creating report page: $message </font>\n"; 
 }  

 // Display the standard Appion interface header 
 processing_header("MakeStack Run Report","MakeStack Run Report for $runData[stackRunName]"); 

 // Display the table built by the BasicReport class or errors 
 echo $summaryTable; 

 // Display the standard Appion interface footer 
 processing_footer(); 

 ?> 
 </pre>