| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:53:36 2008 ] | [ PHPReports 0.4.7 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 require_once ("PHPReportsUtil.php"); 3 4 /****************************************************************************** 5 * * 6 * PHPReportMaker * 7 * This is the base class of the output plugins. They need to extends this * 8 * class. * 9 * * 10 ******************************************************************************/ 11 class PHPReportOutputObject { 12 var $_sInput; 13 var $_sOutput; 14 var $_bClean; 15 var $_bJump; 16 var $_bBody; 17 18 /*************************************************************************** 19 * * 20 * Constructor, put default values * 21 * * 22 ***************************************************************************/ 23 function PHPReportOutputObject(){ 24 $this->_sInput = null; 25 $this->_sOutput = null; 26 $this->_bClean = true; 27 $this->_bJump = true; 28 $this->_bBody = true; 29 } 30 31 /*************************************************************************** 32 * * 33 * Sets the XML input file path * 34 * This is the XML layout file, not the data one. * 35 * @param String path * 36 * * 37 ***************************************************************************/ 38 function setInput($sInput_=null){ 39 $this->_sInput=$sInput_; 40 } 41 42 /*************************************************************************** 43 * * 44 * Returns the XML input file path * 45 * @return String path * 46 * * 47 ***************************************************************************/ 48 function getInput(){ 49 return $this->_sInput; 50 } 51 52 /*************************************************************************** 53 * * 54 * Sets the path of the plugin result file. * 55 * @param String path * 56 * * 57 ***************************************************************************/ 58 function setOutput($sOutput_=null){ 59 $this->_sOutput=$sOutput_; 60 } 61 62 /*************************************************************************** 63 * * 64 * Returns the path of the plugin result file. * 65 * @return String path * 66 * * 67 ***************************************************************************/ 68 function getOutput(){ 69 return $this->_sOutput; 70 } 71 72 /*************************************************************************** 73 * * 74 * Set the file erasing (after the report is rendered) flag * 75 * Erases (or not) the XML data file, not the plugin result. * 76 * @param boolean clean * 77 * * 78 ***************************************************************************/ 79 function setClean($bClean_=true){ 80 $this->_bClean=$bClean_; 81 } 82 83 /*************************************************************************** 84 * * 85 * Returns if this class will erase the file * 86 * after the report is rendered * 87 * @return boolean erase * 88 * * 89 ***************************************************************************/ 90 function isCleaning(){ 91 return $this->_bClean; 92 } 93 94 /*************************************************************************** 95 * * 96 * If true, makes the current URL "jumps" and show the plugin result. * 97 * * 98 ***************************************************************************/ 99 function setJump($bJump_=true){ 100 $this->_bJump=$bJump_; 101 } 102 103 /*************************************************************************** 104 * * 105 * Returns if it's "jumping". * 106 * * 107 ***************************************************************************/ 108 function isJumping(){ 109 return $this->_bJump; 110 } 111 112 /*************************************************************************** 113 * * 114 * This function needs to be defined on every plugin. * 115 * * 116 ***************************************************************************/ 117 function run(){ 118 } 119 120 function setBody($b=true){ 121 $this->_bBody=$b; 122 } 123 124 function getBody(){ 125 return $this->_bBody; 126 } 127 128 /*************************************************************************** 129 * * 130 * Load a saved report from a file. * 131 * @param file path * 132 * * 133 ***************************************************************************/ 134 function loadFrom($sPath_=null){ 135 if(is_null($sPath_)) 136 return; 137 138 if(!file_exists($sPath_)){ 139 $oError = new PHPReportsErrorTr(); 140 $oError->showMsg("NOLOAD",array($sPath_)); 141 } 142 143 $sTemp = tempnam(getPHPReportsTmpPath(),"xml"); 144 $fIn = fopen("compress.zlib://".$sPath_,"r"); 145 $fOut = fopen($sTemp,"w"); 146 147 // read the md5sum 148 $sMD5 = trim(fread($fIn,50)); 149 150 while($sStr=fread($fIn,1024)) 151 fwrite($fOut,$sStr); 152 fclose($fOut); 153 fclose($fIn); 154 155 $sMD5chk = md5_file($sTemp); 156 if(strcmp($sMD5,$sMD5chk)!=0){ 157 unlink($sTemp); 158 print "<b>ERROR</b>: the report stored in $sPath_ is corrupted."; 159 return; 160 } 161 162 //$sTemp = substr(strrchr($sTemp,"/"),1); 163 $this->setInput($sTemp); 164 $this->run(); 165 } 166 } 167 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |