edihistory -- revisions and cleanup of 277 claim status functions
[openemr.git] / ccr / display.php
blob2635c5d08b6919590e89d81d7c616f2ba1832e1b
1 <?php
2 require_once(dirname(__FILE__) . "/../interface/globals.php");
3 require_once(dirname(__FILE__) . "/../library/classes/Document.class.php");
5 $type = $_GET['type'];
6 $document_id = $_GET['doc_id'];
7 $d = new Document($document_id);
8 $url = $d->get_url();
9 $url = preg_replace("|^(.*)://|","",$url);
10 $from_all = explode("/",$url);
11 $from_filename = array_pop($from_all);
12 $from_patientid = array_pop($from_all);
13 $temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/' . $from_patientid . '/' . $from_filename;
14 if (!file_exists($temp_url)) {
15 echo xl('The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it.','','',' ') . $temp_url;
16 }else{
17 $url = $temp_url;
18 $f = fopen($url,"r");
19 $xml = fread($f,filesize($url));
20 fclose($f);
21 if($type == "CCR"){
22 $xmlDom = new DOMDocument();
23 $xmlDom->loadXML($xml);
24 $ss = new DOMDocument();
25 $ss->load(dirname(__FILE__).'/stylesheet/ccr.xsl');
26 $proc = new XSLTProcessor();
27 $proc->importStylesheet($ss);
28 $s_html = $proc->transformToXML($xmlDom);
29 echo $s_html;
30 }else{
31 $xmlDom = new DOMDocument();
32 $xmlDom->loadXML($xml);
33 $ss = new DOMDocument();
34 $ss->load(dirname(__FILE__).'/stylesheet/cda.xsl');
35 $xslt = new XSLTProcessor();
36 $xslt->importStyleSheet($ss);
37 $html = $xslt->transformToXML($xmlDom);
38 echo $html;