Example #1
0
 /**
 	Run the output plugin
 */
 function run()
 {
     $sPath = getPHPReportsFilePath();
     $sXML = $this->getInput();
     $sCSS = $this->getCSS();
     // parameter array with CSS info
     $aParm = array();
     $aParm["css"] = $sCSS;
     $aParm["body"] = $this->getBody() ? "true" : "false";
     // get the tmp directory under the DocumentRoot
     $sDocRoot = $_SERVER["DOCUMENT_ROOT"];
     // get the host path
     $sHost = "http://" . $_SERVER["HTTP_HOST"];
     // create some tempnames there
     $sBook = tempnam(realpath($sDocRoot . "/tmp"), "bookmark");
     unlink($sBook);
     $sBook .= ".html";
     $sRepo = tempnam(realpath($sDocRoot . "/tmp"), "report");
     unlink($sRepo);
     $sRepo .= ".html";
     // create the bookmarks file
     $oProcFactory = new XSLTProcessorFactory();
     $oProc = $oProcFactory->get();
     $oProc->setXML($sXML);
     $oProc->setXSLT(realpath($sPath . "/output/bookmarks/bookmarks.xsl"));
     $oProc->setOutput($sBook);
     $oProc->setParms($aParm);
     $oProc->run();
     unset($oProc);
     $aParm = array();
     $aParm["body"] = $this->getBody() ? "true" : "false";
     // create the report file
     $oProcFactory = new XSLTProcessorFactory();
     $oProc = $oProcFactory->get();
     $oProc->setXML($sXML);
     $oProc->setXSLT(realpath($sPath . "/output/default/default.xsl"));
     $oProc->setOutput($sRepo);
     $oProc->setParms($aParm);
     $oProc->run();
     unset($oProc);
     // code of the framed content
     $sFrame = "<frameset cols=\"150,*\">\n" . "<frame name=\"bookmarks\" target=\"main\" src=\"{$sHost}/tmp/" . basename($sBook) . "\">\n" . "<frame name=\"report\"    target=\"main\" src=\"{$sHost}/tmp/" . basename($sRepo) . "\">\n" . "</frameset>";
     // if there is not an output file, write to browser window
     if (is_null($this->getOutput())) {
         print $sFrame;
     } else {
         // or open the file and store the frames there
         $fHandle = fopen($this->getOutput(), "w");
         fputs($fHandle, $sFrame);
         fclose($fHandle);
     }
     if ($this->isCleaning()) {
         unlink($sXML);
     }
 }
Example #2
0
 function run()
 {
     $sPath = getPHPReportsFilePath();
     $sTmp = getPHPReportsTmpPath();
     $sXSLT = $sPath . "/output/txt/txt.xsl";
     $sXML = $this->getInput();
     // create a new filename if its empty
     if (is_null($this->getOutput())) {
         $sOut = tempnam($sTmp, "txt");
         unlink($sOut);
         $sOut .= ".txt";
     } else {
         $sOut = $this->getOutput();
     }
     // XSLT processor
     $oProcFactory = new XSLTProcessorFactory();
     $oProc = $oProcFactory->get();
     $oProc->setXML($sXML);
     $oProc->setXSLT($sXSLT);
     $oProc->setOutput($sOut);
     $oProc->setParms(array("body" => $this->getBody() ? "true" : "false"));
     $sRst = $oProc->run();
     /*	
     	Read file to pre-processing, replacing the __formfeed__ indicator for a 
     	chr(12), and write it again
     */
     $fHand = fopen($sOut, "rb");
     $sText = fread($fHand, filesize($sOut));
     fclose($fHand);
     if (strpos($sText, "__formfeed__")) {
         $sText = str_replace("__formfeed__", chr(12), $sText);
         $sText = str_replace(chr(160), " ", $sText);
         $fHand = fopen($sOut, "wb");
         fwrite($fHand, $sText);
         fclose($fHand);
     }
     // if needs to jump to show the file, show it
     if ($this->isJumping()) {
         print $sText;
     }
     // check if needs to clean the XML data file
     if ($this->isCleaning()) {
         unlink($sXML);
     }
 }
 function run()
 {
     $sPath = getPHPReportsFilePath();
     $sXML = $this->getInput();
     $sXSLT = "{$sPath}/output/default/default.xsl";
     $oProcFactory = new XSLTProcessorFactory();
     $oProc = $oProcFactory->get();
     $oProc->setXML($sXML);
     $oProc->setXSLT($sXSLT);
     $oProc->setOutput($this->getOutput());
     $oProc->setParms(array("body" => $this->getBody() ? "true" : "false"));
     $sRst = $oProc->run();
     unset($oProc);
     if (is_null($this->getOutput())) {
         print $sRst;
     }
     if ($this->isCleaning()) {
         unlink($sXML);
     }
 }
Example #4
0
 function run()
 {
     // get the files paths
     $sPath = getPHPReportsFilePath();
     $sXSLT = "{$sPath}/output/page/page.xsl";
     $sXML = $this->getInput();
     // get the DOCUMENT_ROOT path, for temporary copy
     $sRoot = $_SERVER["DOCUMENT_ROOT"];
     // copy the page.php file to the temporary dir
     if (!copy(realpath($sPath . "/output/page/page.php"), realpath($sRoot . "/tmp") . "/page.php")) {
         $oError = new PHPReportsErrorTr();
         $oError->showMsg("PAGEPARSER");
     }
     // get the HOST root URL
     $sHost = "http://" . $_SERVER["HTTP_HOST"];
     $aParm = array();
     $aParm["curpage"] = 1;
     $aParm["incr"] = $this->_iIncr;
     $aParm["l1"] = 1;
     $aParm["l2"] = $this->_iIncr;
     $aParm["first"] = $this->_sFirst;
     $aParm["last"] = $this->_sLast;
     $aParm["next"] = $this->_sNext;
     $aParm["prev"] = $this->_sPrev;
     $aParm["xmlfile"] = $this->getInput();
     $aParm["url"] = $sHost . "/tmp/page.php";
     $aParm["body"] = $this->getBody() ? "true" : "false";
     $oProcFactory = new XSLTProcessorFactory();
     $oProc = $oProcFactory->get();
     $oProc->setXML($sXML);
     $oProc->setXSLT($sXSLT);
     $oProc->setOutput($this->getOutput());
     $oProc->setParms($aParm);
     $sRst = $oProc->run();
     print $sRst;
 }
 function PHPReportMaker()
 {
     $this->_sPath = getPHPReportsFilePath();
     //			$this->_sTmp				= getPHPReportsTmpPath();
     $this->_sTmp = dirname(dirname(dirname(__FILE__))) . "/tmp/cache";
     // done for SI to work - Ap.Muthu
     $this->sXML = null;
     $this->sXSLT = $this->_sPath . "/xslt/PHPReport.xsl";
     $this->sUser = null;
     $this->sPass = null;
     $this->sCon = null;
     $this->sDataI = null;
     $this->sSQL = null;
     $this->_oParm = array();
     $this->sDatabase = null;
     $this->sCodeOut = null;
     $this->sOut = null;
     $this->bDebug = false;
     $this->_sNoDataMsg = "";
     $this->_sNoDataFunc = "";
     $this->_sOutputPlugin = "default";
     $this->_oOutputPlugin = null;
     $this->_sSaveTo = null;
     $this->_aEnv = array();
     $this->_sClassName = "PHPReport";
     $this->_iPageSize = 0;
     $this->_aBench = array();
     $this->_sLang = "default";
     $this->_bBody = true;
     $this->_bDeleteXML = false;
     $this->_oError = new PHPReportsErrorTr();
     $this->_oInput = array();
     /*
     	Now we get the XSLT processor
     	new code on the 0.2.8 version, because PHP5 have XSL
     	support with libxslt, by default
     */
     $oProcFactory = new XSLTProcessorFactory();
     $this->_oProc = $oProcFactory->get();
     if (is_null($this->_oProc)) {
         $this->_oError->showMsg("NOXSLT");
     }
     // check path stuff
     if (is_null(getPHPReportsFilePath())) {
         $this->_oError->showMsg("NOPATH");
     }
 }
	function createProcessorByOption ($opt) {
		if (is_string($opt))
			$opt = new StylesheetOptions($opt);
		$conv = $opt->getValue('processor.xslt');
		return XSLTProcessorFactory::createProcessor($conv);
	}
Example #7
0
$aParm = array();
$l1 = intval($_REQUEST["l1"]);
$l2 = intval($_REQUEST["l2"]);
$incr = intval($_REQUEST["incr"]);
$curpage = intval($_REQUEST["curpage"]);
if ($curpage > $incr) {
    $l1 = $curpage - ($curpage % $incr == 0 ? $incr : $curpage % $incr) + 1;
    $l2 = $l1 + ($incr - 1);
} else {
    if ($curpage <= $incr) {
        $l1 = 1;
        $l2 = $l1 + ($incr - 1);
    }
}
$aParm["xmlfile"] = realpath($_REQUEST["xmlfile"]);
$aParm["curpage"] = $curpage;
$aParm["incr"] = $incr;
$aParm["l1"] = $l1;
$aParm["l2"] = $l2;
$aParm["first"] = $_REQUEST["first"];
$aParm["last"] = $_REQUEST["last"];
$aParm["next"] = $_REQUEST["next"];
$aParm["prev"] = $_REQUEST["prev"];
$aParm["url"] = $_REQUEST["url"];
$oProcFactory = new XSLTProcessorFactory();
$oProc = $oProcFactory->get();
$oProc->setXML($sXML);
$oProc->setXSLT($sXSLT);
$oProc->setParms($aParm);
$sRst = $oProc->run();
print $sRst;