$main_stylesheet = str_replace($replace_string, '', $main_stylesheet); // embed the stylesheet in the raw xml file $replace_string = '<ContinuityOfCareRecord xmlns="urn:astm-org:CCR">'; $main_stylesheet = $replace_string . $main_stylesheet; $main_xml = str_replace($replace_string, $main_stylesheet, $main_xml); // insert style1 id into the stylesheet parameter $substitute_string = 'xsl:stylesheet id="style1" exclude-result-prefixes'; $replace_string = 'xsl:stylesheet exclude-result-prefixes'; $main_xml = str_replace($replace_string, $substitute_string, $main_xml); // prepare the filename to use // LASTNAME-FIRSTNAME-PID-DATESTAMP-ccr.xml $main_filename = getReportFilename() . "-ccr.xml"; // send the output as a file to the user header("Content-type: text/xml"); header("Content-Disposition: attachment; filename=" . $main_filename . ""); echo $main_xml; } if ($_POST['ccrAction']) { $raw = $_POST['raw']; /* If transmit requested, fail fast if the recipient address fails basic validation */ if (substr($raw, 0, 4) == "send") { $send_to = trim(stripslashes(substr($raw, 5))); if (!PHPMailer::ValidateAddress($send_to)) { echo htmlspecialchars(xl('Invalid recipient address. Please try again.'), ENT_QUOTES); return; } createCCR($_POST['ccrAction'], $raw, $_POST['requested_by']); } else { createCCR($_POST['ccrAction'], $raw); } }
$xslt->importStylesheet($ccr_ccd); $ccd = new DOMDocument(); $ccd->preserveWhiteSpace = false; $ccd->formatOutput = true; $ccd->loadXML($xslt->transformToXML($xmlDom)); $ccd->save('generatedXml/ccdDebug.xml'); if ($raw == "yes") { echo '-->'; echo "<textarea rows='25' cols='500' style='width:95%' readonly>"; echo $ccd->saveXml(); echo "</textarea>"; return; } $ss = new DOMDocument(); $ss->load("ccd/cda.xsl"); $xslt->importStyleSheet($ss); $html = $xslt->transformToXML($ccd); echo '-->'; echo $html; } function sourceType($ccr, $uuid) { $e_Source = $ccr->createElement('Source'); $e_Actor = $ccr->createElement('Actor'); $e_Source->appendChild($e_Actor); $e_ActorID = $ccr->createElement('ActorID', $uuid); $e_Actor->appendChild($e_ActorID); return $e_Source; } createCCR($_POST['ccrAction'], $_POST['raw']);
public function print_ccr_report($data) { if (UserService::valid($data[0]) == 'existingpatient') { $ccraction = $data[1]; $raw = $data[2]; require_once "../../ccr/createCCR.php"; ob_start(); createCCR($ccraction, $raw); $html = ob_get_clean(); if ($ccraction == 'viewccd') { $html = preg_replace('/<!DOCTYPE html PUBLIC "-\\/\\/W3C\\/\\/DTD HTML 4.01\\/\\/EN" "http:\\/\\/www.w3.org\\/TR\\/html4\\/strict.dtd">/', '', $html); $pos1 = strpos($html, 'body {'); $pos2 = strpos($html, '.h1center'); $tes = substr("{$html}", $pos1, $pos2 - $pos1); $html = str_replace($tes, '', $html); $html = str_replace('h3>', 'h2>', $html); $html = base64_encode($html); } else { $pos1 = strpos($html, '*{'); $pos2 = strpos($html, 'h1'); $tes = substr("{$html}", $pos1, $pos2 - $pos1); $html = str_replace($tes, '', $html); } return $html; } else { throw new SoapFault("Server", "credentials failed"); } }