/** 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); } }
function run() { $sPath = getPHPReportsFilePath(); $sTmp = getPHPReportsTmpPath(); $sXSLT = $sPath . "/output/txtfc/txtfc.xsl"; $sXML = $this->getInput(); $this->proc_rows($sXML); // 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); } }
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 preview($sXML_ = null) { if (is_null($sXML_)) { return; } if (!file_exists($sXML_)) { print "<b>The file {$sXML_} doesn't exists.</b><br>"; return; } $sPath = getPHPReportsFilePath(); $sXSLT = "{$sPath}/xslt/PHPReportPreview.xsl"; // XSLT processing $this->_oProc->setXML($sXML_); $this->_oProc->setXSLT($sXSLT); print $this->_oProc->run(); }
$sPass = "******"; // database password $sData = "./tests/sales.sqlite3"; // database name $sInte = "sqlite3"; // database interface $sConn = "sqlite3"; // database connection // check them if (strlen($sUser) < 1 || strlen($sPass) < 1 || strlen($sInte) < 1 || strlen($sConn) < 1) { print "ERROR: please configure this script before run!"; return; } // check paths $sIncPath = getPHPReportsIncludePath(); $sFilPath = getPHPReportsFilePath(); $sTmpPath = getPHPReportsTmpPath(); print "Checking paths ...\n"; if (is_null($sIncPath) || strlen(trim($sIncPath)) <= 0) { print "ERROR: No INCLUDE path defined."; return; } if (is_null($sFilPath) || strlen(trim($sFilPath)) <= 0) { print "ERROR: No FILE path defined."; return; } if (is_null($sTmpPath) || strlen(trim($sTmpPath)) <= 0) { print "ERROR: No TEMP path defined."; return; } print "Include path : {$sIncPath}\n";